From cd8a5a8a8b7e21ce7c243b0963d9380528a98d81 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sun, 11 Oct 2020 21:19:12 +0300 Subject: [PATCH] chore: fix linting errors --- @types/chalk.d.ts | 126 +++++++++--------- packages/app/components/i18n/localeFlags.ts | 1 + .../multiFactorAuth/MultiFactorAuth.story.tsx | 2 +- packages/app/first-render.js | 1 + packages/app/pages/root/RootPage.tsx | 4 +- packages/app/shell/App.tsx | 4 +- packages/app/storeFactory.ts | 7 +- packages/scripts/build-dll.ts | 6 +- 8 files changed, 81 insertions(+), 70 deletions(-) diff --git a/@types/chalk.d.ts b/@types/chalk.d.ts index 4d5d419..66b5c45 100644 --- a/@types/chalk.d.ts +++ b/@types/chalk.d.ts @@ -7,30 +7,30 @@ declare module 'chalk' { const enum LevelEnum { /** All colors disabled. - */ + */ None = 0, /** Basic 16 colors support. - */ + */ Basic = 1, /** ANSI 256 colors support. - */ + */ Ansi256 = 2, /** Truecolor 16 million colors support. - */ + */ TrueColor = 3, } /** Basic foreground colors. - + [More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) - */ + */ type ForegroundColor = | 'black' | 'red' @@ -53,9 +53,9 @@ declare module 'chalk' { /** Basic background colors. - + [More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) - */ + */ type BackgroundColor = | 'bgBlack' | 'bgRed' @@ -78,9 +78,9 @@ declare module 'chalk' { /** Basic colors. - + [More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support) - */ + */ type Color = ForegroundColor | BackgroundColor; type Modifiers = @@ -101,59 +101,59 @@ declare module 'chalk' { /** Specify the color support for Chalk. By default, color support is automatically detected based on the environment. - */ + */ level?: Level; } interface Instance { /** Return a new Chalk instance. - */ + */ new (options?: Options): Chalk; } /** Detect whether the terminal supports color. - */ + */ interface ColorSupport { /** The color level used by Chalk. - */ + */ level: Level; /** Return whether Chalk supports basic 16 colors. - */ + */ hasBasic: boolean; /** Return whether Chalk supports ANSI 256 colors. - */ + */ has256: boolean; /** Return whether Chalk supports Truecolor 16 million colors. - */ + */ has16m: boolean; } interface ChalkFunction { /** Use a template string. - + @remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341)) - + @example ``` import chalk = require('chalk'); - + log(chalk` CPU: {red ${cpu.totalPercent}%} RAM: {green ${ram.used / ram.total * 100}%} DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%} `); ``` - */ + */ (text: TemplateStringsArray, ...placeholders: unknown[]): string; (...text: unknown[]): string; @@ -162,182 +162,182 @@ declare module 'chalk' { interface Chalk extends ChalkFunction { /** Return a new Chalk instance. - */ + */ Instance: Instance; /** The color support for Chalk. By default, color support is automatically detected based on the environment. - */ + */ level: Level; /** Use HEX value to set text color. - + @param color - Hexadecimal value representing the desired color. - + @example ``` import chalk = require('chalk'); - + chalk.hex('#DEADED'); ``` - */ + */ hex(color: string): Chalk; /** Use keyword color value to set text color. - + @param color - Keyword value representing the desired color. - + @example ``` import chalk = require('chalk'); - + chalk.keyword('orange'); ``` - */ + */ keyword(color: string): Chalk; /** Use RGB values to set text color. - */ + */ rgb(red: number, green: number, blue: number): Chalk; /** Use HSL values to set text color. - */ + */ hsl(hue: number, saturation: number, lightness: number): Chalk; /** Use HSV values to set text color. - */ + */ hsv(hue: number, saturation: number, value: number): Chalk; /** Use HWB values to set text color. - */ + */ hwb(hue: number, whiteness: number, blackness: number): Chalk; /** Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color. - + 30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright. - */ + */ ansi(code: number): Chalk; /** Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color. - */ + */ ansi256(index: number): Chalk; /** Use HEX value to set background color. - + @param color - Hexadecimal value representing the desired color. - + @example ``` import chalk = require('chalk'); - + chalk.bgHex('#DEADED'); ``` - */ + */ bgHex(color: string): Chalk; /** Use keyword color value to set background color. - + @param color - Keyword value representing the desired color. - + @example ``` import chalk = require('chalk'); - + chalk.bgKeyword('orange'); ``` - */ + */ bgKeyword(color: string): Chalk; /** Use RGB values to set background color. - */ + */ bgRgb(red: number, green: number, blue: number): Chalk; /** Use HSL values to set background color. - */ + */ bgHsl(hue: number, saturation: number, lightness: number): Chalk; /** Use HSV values to set background color. - */ + */ bgHsv(hue: number, saturation: number, value: number): Chalk; /** Use HWB values to set background color. - */ + */ bgHwb(hue: number, whiteness: number, blackness: number): Chalk; /** Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color. - + 30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright. Use the foreground code, not the background code (for example, not 41, nor 101). - */ + */ bgAnsi(code: number): Chalk; /** Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color. - */ + */ bgAnsi256(index: number): Chalk; /** Modifier: Resets the current color chain. - */ + */ readonly reset: Chalk; /** Modifier: Make text bold. - */ + */ readonly bold: Chalk; /** Modifier: Emitting only a small amount of light. - */ + */ readonly dim: Chalk; /** Modifier: Make text italic. (Not widely supported) - */ + */ readonly italic: Chalk; /** Modifier: Make text underline. (Not widely supported) - */ + */ readonly underline: Chalk; /** Modifier: Inverse background and foreground colors. - */ + */ readonly inverse: Chalk; /** Modifier: Prints the text, but makes it invisible. - */ + */ readonly hidden: Chalk; /** Modifier: Puts a horizontal line through the center of the text. (Not widely supported) - */ + */ readonly strikethrough: Chalk; /** Modifier: Prints the text only when Chalk has a color support level > 0. Can be useful for things that are purely cosmetic. - */ + */ readonly visible: Chalk; readonly black: Chalk; @@ -403,7 +403,7 @@ declare module 'chalk' { Call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`. - */ + */ const chalk: chalk.Chalk & chalk.ChalkFunction & { supportsColor: chalk.ColorSupport | false; diff --git a/packages/app/components/i18n/localeFlags.ts b/packages/app/components/i18n/localeFlags.ts index 2b5f426..c0151af 100644 --- a/packages/app/components/i18n/localeFlags.ts +++ b/packages/app/components/i18n/localeFlags.ts @@ -41,5 +41,6 @@ export function getLocaleIconUrl(locale: string): string { } } + // eslint-disable-next-line @typescript-eslint/no-var-requires return require('./flags/unknown.svg').default; } diff --git a/packages/app/components/profile/multiFactorAuth/MultiFactorAuth.story.tsx b/packages/app/components/profile/multiFactorAuth/MultiFactorAuth.story.tsx index 7048fba..0aa3277 100644 --- a/packages/app/components/profile/multiFactorAuth/MultiFactorAuth.story.tsx +++ b/packages/app/components/profile/multiFactorAuth/MultiFactorAuth.story.tsx @@ -49,7 +49,7 @@ storiesOf('Components/Profile/MultiFactorAuth', module) )) .add('Enabled', () => ( { action('onSubmit')(form, sendData); diff --git a/packages/app/first-render.js b/packages/app/first-render.js index dfbc2d1..d4d0210 100644 --- a/packages/app/first-render.js +++ b/packages/app/first-render.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ /** * Returns the content to be displayed on first render */ diff --git a/packages/app/pages/root/RootPage.tsx b/packages/app/pages/root/RootPage.tsx index 5f9c9a2..039014e 100644 --- a/packages/app/pages/root/RootPage.tsx +++ b/packages/app/pages/root/RootPage.tsx @@ -23,8 +23,8 @@ import siteName from './siteName.intl'; import PageNotFound from 'app/pages/404/PageNotFound'; -const ProfileController = React.lazy(() => - import(/* webpackChunkName: "page-profile-all" */ 'app/pages/profile/ProfileController'), +const ProfileController = React.lazy( + () => import(/* webpackChunkName: "page-profile-all" */ 'app/pages/profile/ProfileController'), ); const RulesPage = React.lazy(() => import(/* webpackChunkName: "page-rules" */ 'app/pages/rules/RulesPage')); const DevPage = React.lazy(() => import(/* webpackChunkName: "page-dev-applications" */ 'app/pages/dev/DevPage')); diff --git a/packages/app/shell/App.tsx b/packages/app/shell/App.tsx index a12ac5f..24bd7ca 100644 --- a/packages/app/shell/App.tsx +++ b/packages/app/shell/App.tsx @@ -11,8 +11,8 @@ import ContextProvider from './ContextProvider'; import type { History } from 'history'; -const SuccessOauthPage = React.lazy(() => - import(/* webpackChunkName: "page-oauth-success" */ 'app/pages/auth/SuccessOauthPage'), +const SuccessOauthPage = React.lazy( + () => import(/* webpackChunkName: "page-oauth-success" */ 'app/pages/auth/SuccessOauthPage'), ); interface Props { diff --git a/packages/app/storeFactory.ts b/packages/app/storeFactory.ts index f7544ad..6e7ad7a 100644 --- a/packages/app/storeFactory.ts +++ b/packages/app/storeFactory.ts @@ -28,7 +28,12 @@ export default function storeFactory(preloadedState = {}): Store { // Hot reload reducers if (module.hot && typeof module.hot.accept === 'function') { - module.hot.accept('app/reducers', () => store.replaceReducer(require('app/reducers').default)); + module.hot.accept('app/reducers', () => + store.replaceReducer( + // eslint-disable-next-line @typescript-eslint/no-var-requires + require('app/reducers').default, + ), + ); } return store; diff --git a/packages/scripts/build-dll.ts b/packages/scripts/build-dll.ts index 8d8bcca..0a48cc9 100644 --- a/packages/scripts/build-dll.ts +++ b/packages/scripts/build-dll.ts @@ -38,7 +38,11 @@ Promise.all([stat(`${__dirname}/../../yarn.lock`), stat(`${__dirname}/../../dll/ return reject(err); } - logResult(chalk.green('Dll was successfully build in %s ms'), stats.endTime! - stats.startTime!); + logResult( + chalk.green('Dll was successfully build in %s ms'), + // @ts-expect-error - something wrong with webpack types + stats.endTime - stats.startTime, + ); resolve(); });