-
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: update to eslint v9 with flat config
- Loading branch information
Showing
24 changed files
with
859 additions
and
1,746 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// @ts-check | ||
|
||
import js from '@eslint/js'; | ||
import eslintPluginN from 'eslint-plugin-n'; | ||
import eslintPluginJest from 'eslint-plugin-jest'; | ||
import eslintPluginUnicorn from 'eslint-plugin-unicorn'; | ||
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; // eslint-disable-line import/extensions -- false positive | ||
import * as eslintPluginImport from 'eslint-plugin-import'; | ||
import tseslint from 'typescript-eslint'; | ||
|
||
export default tseslint.config( | ||
// Configs: | ||
js.configs.recommended, | ||
eslintPluginImport.flatConfigs | ||
? eslintPluginImport.flatConfigs.recommended // TODO: use typescript config | ||
: {}, | ||
eslintPluginJest.configs['flat/recommended'], | ||
eslintPluginN.configs['flat/recommended'], | ||
eslintPluginPrettierRecommended, | ||
eslintPluginUnicorn.configs['flat/recommended'], | ||
...tseslint.configs.recommendedTypeChecked, | ||
|
||
// Individual rules: | ||
{ | ||
rules: { | ||
'import/extensions': ['error', 'always'], | ||
'import/no-unresolved': 'off', | ||
|
||
'n/no-missing-import': 'off', // bug with recognizing node: prefix https://github.com/mysticatea/eslint-plugin-node/issues/275 | ||
'n/no-unsupported-features/es-syntax': [ | ||
'error', | ||
{ ignores: ['modules'] }, | ||
], | ||
|
||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
singleQuote: true, | ||
}, | ||
], | ||
|
||
'unicorn/import-style': 'off', | ||
'unicorn/no-useless-undefined': 'off', // We use a lot of `return undefined` to satisfy the `consistent-return` rule. | ||
|
||
'@typescript-eslint/prefer-readonly': 'error', | ||
'@typescript-eslint/require-array-sort-compare': 'error', | ||
}, | ||
|
||
// typescript-eslint parser options: | ||
languageOptions: { | ||
parserOptions: { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}, | ||
|
||
// Disabling type-checking for JS files: | ||
{ | ||
files: ['**/*.js'], | ||
extends: [tseslint.configs.disableTypeChecked], | ||
}, | ||
|
||
// Ignore files: | ||
{ | ||
ignores: [ | ||
// compiled output | ||
'dist/**', | ||
|
||
// coverage | ||
'coverage/**', | ||
], | ||
}, | ||
); |
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
Oops, something went wrong.