diff --git a/.eslintrc.js b/.eslintrc.js index f511c4d3..959a9d64 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,6 +23,8 @@ module.exports = { '@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', + 'react/prop-types': 'off', 'import/no-extraneous-dependencies': 'error', diff --git a/src/components/Markdown/styled.elements.tsx b/src/components/Markdown/styled.elements.tsx index 0a2d62bb..321a41e2 100644 --- a/src/components/Markdown/styled.elements.tsx +++ b/src/components/Markdown/styled.elements.tsx @@ -19,11 +19,13 @@ export const linksCss = css` } `; -export const StyledMarkdownBlock = styled(PrismDiv as StyledComponent< - 'div', - ResolvedThemeInterface, - { compact?: boolean; inline?: boolean } ->)` +export const StyledMarkdownBlock = styled( + PrismDiv as StyledComponent< + 'div', + ResolvedThemeInterface, + { compact?: boolean; inline?: boolean } + >, +)` font-family: ${props => props.theme.typography.fontFamily}; font-weight: ${props => props.theme.typography.fontWeightRegular}; diff --git a/src/services/OpenAPIParser.ts b/src/services/OpenAPIParser.ts index 8adbc7ab..f299488e 100644 --- a/src/services/OpenAPIParser.ts +++ b/src/services/OpenAPIParser.ts @@ -148,7 +148,7 @@ export class OpenAPIParser { * @param obj object to dereference * @param forceCircular whether to dereference even if it is circular ref */ - deref(obj: OpenAPIRef | T, forceCircular: boolean = false): T { + deref(obj: OpenAPIRef | T, forceCircular = false): T { if (this.isRef(obj)) { const resolved = this.byRef(obj.$ref)!; const visited = this._refCounter.visited(obj.$ref); diff --git a/src/services/RedocNormalizedOptions.ts b/src/services/RedocNormalizedOptions.ts index 4ae12dce..282f4eb1 100644 --- a/src/services/RedocNormalizedOptions.ts +++ b/src/services/RedocNormalizedOptions.ts @@ -204,6 +204,7 @@ 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 || {}; diff --git a/src/services/ScrollService.ts b/src/services/ScrollService.ts index 3e946c37..1843ea37 100644 --- a/src/services/ScrollService.ts +++ b/src/services/ScrollService.ts @@ -9,7 +9,7 @@ const EVENT = 'scroll'; export class ScrollService { private _scrollParent: Window | HTMLElement | undefined; private _emiter: EventEmitter; - private _prevOffsetY: number = 0; + private _prevOffsetY = 0; constructor(private options: RedocNormalizedOptions) { this._scrollParent = IS_BROWSER ? window : undefined; this._emiter = new EventEmitter(); diff --git a/src/types/components.d.ts b/src/types/components.d.ts deleted file mode 100644 index 2ee0de1a..00000000 --- a/src/types/components.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AppStore } from '../services/AppStore'; - -export interface BaseContainerProps { - store: AppStore; -} diff --git a/src/utils/__tests__/helpers.test.ts b/src/utils/__tests__/helpers.test.ts index 52e3e289..b9f389ae 100644 --- a/src/utils/__tests__/helpers.test.ts +++ b/src/utils/__tests__/helpers.test.ts @@ -8,7 +8,11 @@ describe('Utils', () => { const fn = (...args) => args; const actual = mapWithLast(arr, fn); - const expected = [[1, false], [2, false], [3, true]]; + const expected = [ + [1, false], + [2, false], + [3, true], + ]; expect(actual).toEqual(expected); }); diff --git a/src/utils/decorators.ts b/src/utils/decorators.ts index 62624a01..bfe5726f 100644 --- a/src/utils/decorators.ts +++ b/src/utils/decorators.ts @@ -16,6 +16,7 @@ function throttle(func, wait) { const now = new Date().getTime(); const remaining = wait - (now - previous); context = this; + // eslint-disable-next-line prefer-rest-params args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index d2cbcfe7..f460fe14 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -189,7 +189,7 @@ export function removeQueryString(serverUrl: string): string { function parseURL(url: string) { if (typeof URL === 'undefined') { // node - return new (require('url')).URL(url); + return new (require('url').URL)(url); } else { return new URL(url); } diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts index 2572b1d5..74511e3d 100644 --- a/src/utils/openapi.ts +++ b/src/utils/openapi.ts @@ -1,5 +1,5 @@ import { dirname } from 'path'; -const URLtemplate = require('url-template'); +import * as URLtemplate from 'url-template'; import { FieldModel } from '../services/models'; import { OpenAPIParser } from '../services/OpenAPIParser';