Skip to content

Commit

Permalink
chore: fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Jul 25, 2020
1 parent 5fea0b0 commit 9fe8a4b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down
5 changes: 4 additions & 1 deletion src/components/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
5 changes: 2 additions & 3 deletions src/services/RedocNormalizedOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
}

Expand Down Expand Up @@ -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 || {};
Expand Down
14 changes: 7 additions & 7 deletions src/services/models/Operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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');
Expand All @@ -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;
}
Expand All @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 9fe8a4b

Please sign in to comment.