-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: replace deprecated eslint config (#1093)
Co-authored-by: takaro-ci-bot[bot] <138661031+takaro-ci-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
38a3b43
commit f0a154c
Showing
236 changed files
with
3,569 additions
and
2,209 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ node_modules | |
dist | ||
packages/lib-apiclient/src/generated | ||
packages/web-main/src/routeTree.gen.ts | ||
eslint.config.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
// @ts-check | ||
|
||
import url from 'node:url'; | ||
import eslint from '@eslint/js'; | ||
import tseslint from 'typescript-eslint'; | ||
import deprecationPlugin from 'eslint-plugin-deprecation'; | ||
import reactPlugin from 'eslint-plugin-react'; | ||
import reactHooksPlugin from 'eslint-plugin-react-hooks'; | ||
import importPlugin from 'eslint-plugin-import'; | ||
import storybookPlugin from 'eslint-plugin-storybook'; | ||
|
||
import { FlatCompat } from '@eslint/eslintrc'; | ||
|
||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); | ||
const compat = new FlatCompat({ baseDirectory: __dirname }); | ||
|
||
export default tseslint.config( | ||
{ | ||
plugins: { | ||
'@typescript-eslint': tseslint.plugin, | ||
'deprecation': deprecationPlugin, | ||
'import': importPlugin, | ||
'react': reactPlugin, | ||
'react-hooks': reactHooksPlugin, | ||
}, | ||
}, | ||
|
||
// ignore in all configs | ||
{ | ||
ignores: [ | ||
'**/node_modules/**', | ||
'**/dist/**', | ||
'**/build/**', | ||
'**/fixtures/**', | ||
'**/__snapshots__/**', | ||
'**/coverage/**', | ||
'**/_data/**', | ||
'**/generated/**', | ||
'**/storybook-static/**', | ||
'**/.next/**', | ||
'**/migrations/**', | ||
'**/*.d.ts', | ||
'**/jest.config.js', | ||
'**/mocharc.js', | ||
'**/.storybook/**' | ||
], | ||
}, | ||
|
||
// extends | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommended, | ||
|
||
// | ||
// base config | ||
// | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
allowAutommaticSingleRunInference: true, | ||
cacheLiftetime: { | ||
// We never create/change tsconfig structure - so no need to ever evict the cache | ||
// In the rare case that we do - just manually restart IDE | ||
glob: 'infinity', | ||
}, | ||
project: ['tsconfig.json', 'tsconfig.esm.json', 'tsconfig.react.json', 'packages/*/tsconfig.json'], | ||
tsconfigRootDir: __dirname, | ||
warnOnUnsupportedTypeScriptVersion: true, | ||
}, | ||
}, | ||
rules: { | ||
'deprecation/deprecation': 'error', | ||
|
||
'no-console': 'off', | ||
quotes: ['error', 'single'], | ||
semi: ['error', 'always'], | ||
'logical-assignment-operators': 'error', | ||
'no-else-return': 'off', | ||
'no-process-exit': 'off', | ||
'no-fallthrough': ['error', { commentPattern: '.*intentional fallthrough.*' }], | ||
'no-implicit-coercion': ['error', { boolean: false }], | ||
'no-lonely-if': 'error', | ||
'no-unreachable-loop': 'error', | ||
'no-useless-call': 'error', | ||
'no-useless-computed-key': 'off', | ||
'no-useless-escape': 'off', | ||
'no-useless-concat': 'error', | ||
'no-var': 'error', | ||
'no-void': ['error', { allowAsStatement: true }], | ||
'one-var': ['error', 'never'], | ||
'operator-assignment': 'error', | ||
'prefer-const': 'error', | ||
'prefer-object-spread': 'error', | ||
'prefer-rest-params': 'error', | ||
|
||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/triple-slash-reference': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-argument': 'off', | ||
'@typescript-eslint/no-unused-expressions': 'error', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-return': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'error', | ||
{ | ||
caughtErrors: 'all', | ||
varsIgnorePattern: '^_', | ||
argsIgnorePattern: '^_', | ||
}, | ||
], | ||
'@typescript-eslint/no-empty-function': [ | ||
'error', | ||
{ | ||
allow: ['arrowFunctions'], | ||
}, | ||
], | ||
|
||
// eslint-plugin-import | ||
'import/consistent-type-specifier-style': 'error', | ||
'import/first': 'error', | ||
'import/newline-after-import': 'error', | ||
'import/no-absolute-path': 'error', | ||
'import/no-amd': 'error', | ||
'import/no-default-export': 'error', | ||
'import/no-duplicates': 'error', | ||
'import/no-mutable-exports': 'error', | ||
'import/no-named-default': 'error', | ||
'import/no-named-export': 'off', | ||
'import/no-self-import': 'error', | ||
'import/prefer-default-export': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.js'], | ||
extends: [tseslint.configs.disableTypeChecked], | ||
rules: { | ||
// turn off other type-aware rules | ||
'deprecation/deprecation': 'off', | ||
'no-undef': 'off', | ||
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
}, | ||
}, | ||
|
||
|
||
// config for storybook | ||
{ | ||
files: ['**/*.stories.tsx'], | ||
extends: [ | ||
...compat.config(storybookPlugin.configs.recommended) | ||
], | ||
rules: { | ||
'react-hooks/rules-of-hooks': 'off' | ||
} | ||
}, | ||
|
||
// config for tests | ||
{ | ||
files: ['**/*.test.{ts,tsx,js,jsx}'], | ||
rules: { | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-unused-expressions': 'off', | ||
'@typescript-eslint/no-unsafe-assignment': 'off', | ||
'@typescript-eslint/no-unsafe-call': 'off', | ||
'@typescript-eslint/no-unsafe-member-access': 'off', | ||
'@typescript-eslint/no-unsafe-return': 'off', | ||
} | ||
}, | ||
|
||
// config for react packages | ||
{ | ||
files: ['packages/lib-components/**/*.{ts,tsx,mts,cts,js,jsx}', 'packages/web-main/**/*.{ts,tsx,mts,cts,js,jsx}'], | ||
extends: [ | ||
...compat.config(reactPlugin.configs.recommended), | ||
...compat.config(reactHooksPlugin.configs.recommended), | ||
], | ||
rules: { | ||
'import/no-default-export': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'react/no-unescaped-entities': 'off', | ||
'react/prop-types': 'off', | ||
'react/exhaustive-deps': 'off', | ||
'react-hooks/exhaustive-deps': 'off', | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
}, | ||
); |
Oops, something went wrong.