-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from marp-team/eslint-flat-config
Migrate ESLint config to flat config
- Loading branch information
Showing
21 changed files
with
550 additions
and
80 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,86 @@ | ||
import js from '@eslint/js' | ||
import eslintConfigPrettier from 'eslint-config-prettier' | ||
import eslintPluginImport from 'eslint-plugin-import' | ||
import eslintPluginJest from 'eslint-plugin-jest' | ||
import eslintPluginUnicorn from 'eslint-plugin-unicorn' | ||
import globals from 'globals' | ||
import tseslint from 'typescript-eslint' | ||
|
||
const tsFiles = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'] | ||
const testFiles = [ | ||
'**/*.test.ts', | ||
'**/*.test.tsx', | ||
'**/*.test.mts', | ||
'**/*.test.cts', | ||
'jest.setup.js', | ||
] | ||
|
||
const forFiles = (files, confs) => confs.map((conf) => ({ ...conf, files })) | ||
|
||
export default tseslint.config( | ||
js.configs.recommended, | ||
eslintPluginImport.flatConfigs.recommended, | ||
{ | ||
plugins: { | ||
unicorn: eslintPluginUnicorn, | ||
}, | ||
rules: { | ||
'unicorn/prefer-node-protocol': 'error', | ||
}, | ||
}, | ||
...forFiles(tsFiles, [ | ||
...tseslint.configs.recommended, | ||
...tseslint.configs.stylistic, | ||
{ | ||
extends: [eslintPluginImport.flatConfigs.recommended], | ||
}, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/consistent-type-assertions': [ | ||
'error', | ||
{ assertionStyle: 'as' }, | ||
], | ||
}, | ||
}, | ||
]), | ||
...forFiles(testFiles, [ | ||
eslintPluginJest.configs['flat/recommended'], | ||
eslintPluginJest.configs['flat/style'], | ||
{ languageOptions: { globals: { ...globals.jest } } }, | ||
]), | ||
eslintConfigPrettier, | ||
{ | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'error', | ||
}, | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
parserOptions: { | ||
ecmaFeatures: { jsx: true }, | ||
}, | ||
globals: { | ||
...globals.node, | ||
...globals.browser, | ||
}, | ||
}, | ||
rules: { | ||
'import/order': ['error', { alphabetize: { order: 'asc' } }], | ||
}, | ||
settings: { | ||
'import/resolver': { typescript: { alwaysTryTypes: true } }, | ||
}, | ||
}, | ||
{ | ||
ignores: [ | ||
'.vscode-test-web/**/*', | ||
'coverage/**/*', | ||
'dist/**/*', | ||
'lib/**/*', | ||
'node_modules/**/*', | ||
'preview/**/*', | ||
], | ||
}, | ||
) |
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.