mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 08:36:33 +03:00
chore: fix eslint errors
This commit is contained in:
parent
5fea0b0fea
commit
9fe8a4b685
|
@ -20,12 +20,15 @@ module.exports = {
|
||||||
plugins: ['@typescript-eslint', 'import'],
|
plugins: ['@typescript-eslint', 'import'],
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
'@typescript-eslint/no-use-before-define': 'off',
|
'@typescript-eslint/no-use-before-define': 'off',
|
||||||
'@typescript-eslint/interface-name-prefix': 'off',
|
'@typescript-eslint/interface-name-prefix': 'off',
|
||||||
'@typescript-eslint/no-inferrable-types': 'off',
|
'@typescript-eslint/no-inferrable-types': 'off',
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
'@typescript-eslint/ban-ts-ignore': 'off',
|
'@typescript-eslint/ban-ts-ignore': 'off',
|
||||||
|
'@typescript-eslint/ban-types': ['error', { types: { object: false }, extendDefaults: true }],
|
||||||
|
'@typescript-eslint/no-var-requires': 'off',
|
||||||
|
|
||||||
'react/prop-types': 'off',
|
'react/prop-types': 'off',
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,10 @@ const ErrorWrapper = styled.div`
|
||||||
color: red;
|
color: red;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export class ErrorBoundary extends React.Component<{}, { error?: Error }> {
|
export class ErrorBoundary extends React.Component<
|
||||||
|
React.PropsWithChildren<unknown>,
|
||||||
|
{ error?: Error }
|
||||||
|
> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { error: undefined };
|
this.state = { error: undefined };
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class RedocNormalizedOptions {
|
||||||
}
|
}
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
const res = {};
|
const res = {};
|
||||||
value.split(',').forEach(code => {
|
value.split(',').forEach((code) => {
|
||||||
res[code.trim()] = true;
|
res[code.trim()] = true;
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
|
@ -134,7 +134,7 @@ export class RedocNormalizedOptions {
|
||||||
case 'false':
|
case 'false':
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return value.split(',').map(ext => ext.trim());
|
return value.split(',').map((ext) => ext.trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,6 @@ export class RedocNormalizedOptions {
|
||||||
this.payloadSampleIdx = RedocNormalizedOptions.normalizePayloadSampleIdx(raw.payloadSampleIdx);
|
this.payloadSampleIdx = RedocNormalizedOptions.normalizePayloadSampleIdx(raw.payloadSampleIdx);
|
||||||
this.expandSingleSchemaField = argValueToBoolean(raw.expandSingleSchemaField);
|
this.expandSingleSchemaField = argValueToBoolean(raw.expandSingleSchemaField);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
|
||||||
this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);
|
this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);
|
||||||
|
|
||||||
this.allowedMdComponents = raw.allowedMdComponents || {};
|
this.allowedMdComponents = raw.allowedMdComponents || {};
|
||||||
|
|
|
@ -50,7 +50,7 @@ export class OperationModel implements IMenuItem {
|
||||||
absoluteIdx?: number;
|
absoluteIdx?: number;
|
||||||
name: string;
|
name: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
type = 'operation' as 'operation';
|
type = 'operation' as const;
|
||||||
|
|
||||||
parent?: GroupModel;
|
parent?: GroupModel;
|
||||||
externalDocs?: OpenAPIExternalDocumentation;
|
externalDocs?: OpenAPIExternalDocumentation;
|
||||||
|
@ -102,7 +102,7 @@ export class OperationModel implements IMenuItem {
|
||||||
// NOTE: Callbacks by default should not inherit the specification's global `security` definition.
|
// NOTE: Callbacks by default should not inherit the specification's global `security` definition.
|
||||||
// Can be defined individually per-callback in the specification. Defaults to none.
|
// Can be defined individually per-callback in the specification. Defaults to none.
|
||||||
this.security = (operationSpec.security || []).map(
|
this.security = (operationSpec.security || []).map(
|
||||||
security => new SecurityRequirementModel(security, parser),
|
(security) => new SecurityRequirementModel(security, parser),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: update getting pathInfo for overriding servers on path level
|
// TODO: update getting pathInfo for overriding servers on path level
|
||||||
|
@ -116,7 +116,7 @@ export class OperationModel implements IMenuItem {
|
||||||
: this.pointer;
|
: this.pointer;
|
||||||
|
|
||||||
this.security = (operationSpec.security || parser.spec.security || []).map(
|
this.security = (operationSpec.security || parser.spec.security || []).map(
|
||||||
security => new SecurityRequirementModel(security, parser),
|
(security) => new SecurityRequirementModel(security, parser),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.servers = normalizeServers(
|
this.servers = normalizeServers(
|
||||||
|
@ -208,7 +208,7 @@ export class OperationModel implements IMenuItem {
|
||||||
this.operationSpec.pathParameters,
|
this.operationSpec.pathParameters,
|
||||||
this.operationSpec.parameters,
|
this.operationSpec.parameters,
|
||||||
// TODO: fix pointer
|
// TODO: fix pointer
|
||||||
).map(paramOrRef => new FieldModel(this.parser, paramOrRef, this.pointer, this.options));
|
).map((paramOrRef) => new FieldModel(this.parser, paramOrRef, this.pointer, this.options));
|
||||||
|
|
||||||
if (this.options.sortPropsAlphabetically) {
|
if (this.options.sortPropsAlphabetically) {
|
||||||
return sortByField(_parameters, 'name');
|
return sortByField(_parameters, 'name');
|
||||||
|
@ -224,7 +224,7 @@ export class OperationModel implements IMenuItem {
|
||||||
get responses() {
|
get responses() {
|
||||||
let hasSuccessResponses = false;
|
let hasSuccessResponses = false;
|
||||||
return Object.keys(this.operationSpec.responses || [])
|
return Object.keys(this.operationSpec.responses || [])
|
||||||
.filter(code => {
|
.filter((code) => {
|
||||||
if (code === 'default') {
|
if (code === 'default') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ export class OperationModel implements IMenuItem {
|
||||||
|
|
||||||
return isStatusCode(code);
|
return isStatusCode(code);
|
||||||
}) // filter out other props (e.g. x-props)
|
}) // filter out other props (e.g. x-props)
|
||||||
.map(code => {
|
.map((code) => {
|
||||||
return new ResponseModel(
|
return new ResponseModel(
|
||||||
this.parser,
|
this.parser,
|
||||||
code,
|
code,
|
||||||
|
@ -248,7 +248,7 @@ export class OperationModel implements IMenuItem {
|
||||||
|
|
||||||
@memoize
|
@memoize
|
||||||
get callbacks() {
|
get callbacks() {
|
||||||
return Object.keys(this.operationSpec.callbacks || []).map(callbackEventName => {
|
return Object.keys(this.operationSpec.callbacks || []).map((callbackEventName) => {
|
||||||
return new CallbackModel(
|
return new CallbackModel(
|
||||||
this.parser,
|
this.parser,
|
||||||
callbackEventName,
|
callbackEventName,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user