chore: fix eslint errors

This commit is contained in:
Roman Hotsiy 2020-07-25 20:14:11 +03:00
parent 5fea0b0fea
commit 9fe8a4b685
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
4 changed files with 16 additions and 11 deletions

View File

@ -20,12 +20,15 @@ module.exports = {
plugins: ['@typescript-eslint', 'import'],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-non-null-assertion': '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',

View File

@ -6,7 +6,10 @@ const ErrorWrapper = styled.div`
color: red;
`;
export class ErrorBoundary extends React.Component<{}, { error?: Error }> {
export class ErrorBoundary extends React.Component<
React.PropsWithChildren<unknown>,
{ error?: Error }
> {
constructor(props) {
super(props);
this.state = { error: undefined };

View File

@ -68,7 +68,7 @@ export class RedocNormalizedOptions {
}
if (typeof value === 'string') {
const res = {};
value.split(',').forEach(code => {
value.split(',').forEach((code) => {
res[code.trim()] = true;
});
return res;
@ -134,7 +134,7 @@ export class RedocNormalizedOptions {
case 'false':
return false;
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.expandSingleSchemaField = argValueToBoolean(raw.expandSingleSchemaField);
// eslint-disable-next-line @typescript-eslint/camelcase
this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);
this.allowedMdComponents = raw.allowedMdComponents || {};

View File

@ -50,7 +50,7 @@ export class OperationModel implements IMenuItem {
absoluteIdx?: number;
name: string;
description?: string;
type = 'operation' as 'operation';
type = 'operation' as const;
parent?: GroupModel;
externalDocs?: OpenAPIExternalDocumentation;
@ -102,7 +102,7 @@ export class OperationModel implements IMenuItem {
// 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.
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
@ -116,7 +116,7 @@ export class OperationModel implements IMenuItem {
: this.pointer;
this.security = (operationSpec.security || parser.spec.security || []).map(
security => new SecurityRequirementModel(security, parser),
(security) => new SecurityRequirementModel(security, parser),
);
this.servers = normalizeServers(
@ -208,7 +208,7 @@ export class OperationModel implements IMenuItem {
this.operationSpec.pathParameters,
this.operationSpec.parameters,
// 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) {
return sortByField(_parameters, 'name');
@ -224,7 +224,7 @@ export class OperationModel implements IMenuItem {
get responses() {
let hasSuccessResponses = false;
return Object.keys(this.operationSpec.responses || [])
.filter(code => {
.filter((code) => {
if (code === 'default') {
return true;
}
@ -235,7 +235,7 @@ export class OperationModel implements IMenuItem {
return isStatusCode(code);
}) // filter out other props (e.g. x-props)
.map(code => {
.map((code) => {
return new ResponseModel(
this.parser,
code,
@ -248,7 +248,7 @@ export class OperationModel implements IMenuItem {
@memoize
get callbacks() {
return Object.keys(this.operationSpec.callbacks || []).map(callbackEventName => {
return Object.keys(this.operationSpec.callbacks || []).map((callbackEventName) => {
return new CallbackModel(
this.parser,
callbackEventName,