-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert to flat config with FlatCompat * Remove FlatCompat * Update to ESLint v9
- Loading branch information
1 parent
ecb2f71
commit 004f880
Showing
8 changed files
with
665 additions
and
750 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
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
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
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,158 @@ | ||
import path from 'node:path'; | ||
import { fileURLToPath } from 'node:url'; | ||
|
||
import { fixupPluginRules, includeIgnoreFile } from '@eslint/compat'; | ||
import js from '@eslint/js'; | ||
import prettier from 'eslint-config-prettier'; | ||
import _import from 'eslint-plugin-import'; | ||
import jsxA11y from 'eslint-plugin-jsx-a11y'; | ||
import noOnlyTests from 'eslint-plugin-no-only-tests'; | ||
import playwright from 'eslint-plugin-playwright'; | ||
import react from 'eslint-plugin-react'; | ||
import reactHooks from 'eslint-plugin-react-hooks'; | ||
import simpleImportSort from 'eslint-plugin-simple-import-sort'; | ||
import unicorn from 'eslint-plugin-unicorn'; | ||
import unusedImports from 'eslint-plugin-unused-imports'; | ||
import globals from 'globals'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const gitignorePath = path.resolve(__dirname, '.gitignore'); | ||
|
||
export default tseslint.config( | ||
js.configs.recommended, | ||
react.configs.flat.recommended, | ||
react.configs.flat['jsx-runtime'], | ||
// This doesn't work yet | ||
// reactHooks.configs.recommended, | ||
jsxA11y.flatConfigs.recommended, | ||
playwright.configs['flat/recommended'], | ||
|
||
...tseslint.configs.recommendedTypeChecked, | ||
...tseslint.configs.strictTypeChecked, | ||
...tseslint.configs.stylisticTypeChecked, | ||
|
||
unicorn.configs['flat/recommended'], | ||
|
||
prettier, | ||
|
||
{ | ||
plugins: { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
import: fixupPluginRules(_import), | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
'no-only-tests': noOnlyTests, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
'react-hooks': reactHooks, | ||
'simple-import-sort': simpleImportSort, | ||
'unused-imports': unusedImports, | ||
}, | ||
|
||
languageOptions: { | ||
ecmaVersion: 5, | ||
sourceType: 'script', | ||
|
||
parserOptions: { | ||
projectService: true, | ||
}, | ||
}, | ||
|
||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
formComponents: ['Form'], | ||
linkComponents: [ | ||
{ name: 'Link', linkAttribute: 'to' }, | ||
{ name: 'NavLink', linkAttribute: 'to' }, | ||
], | ||
}, | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
rules: { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
...reactHooks.configs.recommended.rules, | ||
|
||
'no-plusplus': 'error', | ||
'object-shorthand': 'warn', | ||
quotes: ['warn', 'single', { avoidEscape: true }], | ||
'require-unicode-regexp': 'warn', | ||
|
||
'import/first': 'warn', | ||
'import/newline-after-import': 'warn', | ||
'import/no-duplicates': 'warn', | ||
|
||
'simple-import-sort/imports': 'warn', | ||
'simple-import-sort/exports': 'warn', | ||
|
||
'playwright/expect-expect': [ | ||
'warn', | ||
{ | ||
assertFunctionNames: [ | ||
'expectAudioIsPlaying', | ||
'expectAudioIsNotPlaying', | ||
'expectAudioCurrentTimeToAlmostEqual', | ||
], | ||
}, | ||
], | ||
'no-only-tests/no-only-tests': 'error', | ||
|
||
'@typescript-eslint/no-unused-vars': 'off', | ||
'unused-imports/no-unused-imports': 'warn', | ||
'unused-imports/no-unused-vars': 'warn', | ||
|
||
'@typescript-eslint/consistent-type-exports': 'warn', | ||
'@typescript-eslint/consistent-type-imports': 'warn', | ||
'@typescript-eslint/no-non-null-assertion': 'off', // Used for route params and in tests | ||
'@typescript-eslint/only-throw-error': 'off', // Remix allows throwing `Response`s | ||
'@typescript-eslint/prefer-promise-reject-errors': 'off', | ||
'@typescript-eslint/restrict-template-expressions': [ | ||
'error', | ||
{ | ||
allowAny: false, | ||
allowBoolean: false, | ||
allowNullish: false, | ||
allowNumber: true, | ||
allowRegExp: false, | ||
allowNever: false, | ||
}, | ||
], | ||
'@typescript-eslint/switch-exhaustiveness-check': [ | ||
'error', | ||
{ | ||
allowDefaultCaseForExhaustiveSwitch: false, | ||
requireDefaultForNonUnion: true, | ||
}, | ||
], | ||
|
||
'unicorn/better-regex': 'off', | ||
'unicorn/filename-case': 'off', | ||
'unicorn/no-array-callback-reference': 'off', | ||
'unicorn/no-null': 'off', | ||
'unicorn/no-useless-undefined': 'off', | ||
'unicorn/prefer-module': 'off', | ||
'unicorn/prefer-switch': 'off', | ||
'unicorn/prevent-abbreviations': 'off', | ||
'unicorn/switch-case-braces': 'off', | ||
|
||
'react/jsx-no-leaked-render': ['warn', { validStrategies: ['ternary'] }], | ||
}, | ||
}, | ||
{ | ||
files: ['.eslintrc.cjs', 'stylelint.config.js', 'svgo.config.js'], | ||
|
||
languageOptions: { | ||
globals: globals.node, | ||
}, | ||
}, | ||
{ | ||
files: ['playwright/**/*.ts', 'playwright/**/*.tsx'], | ||
|
||
rules: { | ||
'no-empty-pattern': 'off', | ||
'@typescript-eslint/unbound-method': 'off', | ||
}, | ||
}, | ||
includeIgnoreFile(gitignorePath), | ||
); |
Oops, something went wrong.