Skip to content

Commit edbf6c8

Browse files
committed
(feat) flat config for eslint migrated from old config
1 parent db44cce commit edbf6c8

10 files changed

+617
-346
lines changed

.eslintignore

-3
This file was deleted.

.eslintrc.json

-65
This file was deleted.

eslint.config.js

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
const eslint = require('@eslint/js');
2+
const nodePlugin = require('eslint-plugin-n');
3+
const eslintConfigPrettier = require('eslint-config-prettier');
4+
const eslintPluginPrettier = require('eslint-plugin-prettier');
5+
const tsEslint = require('typescript-eslint');
6+
const typescriptParser = require('@typescript-eslint/parser');
7+
8+
module.exports = [
9+
eslint.configs.recommended,
10+
nodePlugin.configs['flat/recommended'],
11+
eslintConfigPrettier,
12+
{
13+
plugins: {
14+
n: nodePlugin,
15+
prettier: eslintPluginPrettier,
16+
},
17+
rules: {
18+
'prettier/prettier': 'error',
19+
'block-scoped-var': 'error',
20+
eqeqeq: 'error',
21+
'no-var': 'error',
22+
'prefer-const': 'error',
23+
'eol-last': 'error',
24+
'prefer-arrow-callback': 'error',
25+
'no-trailing-spaces': 'error',
26+
quotes: ['warn', 'single', {avoidEscape: true}],
27+
'no-restricted-properties': [
28+
'error',
29+
{
30+
object: 'describe',
31+
property: 'only',
32+
},
33+
{
34+
object: 'it',
35+
property: 'only',
36+
},
37+
],
38+
},
39+
},
40+
...tsEslint.configs.recommended.map(config => ({
41+
...config,
42+
files: ['**/*.ts', '**/*.tsx'],
43+
})),
44+
{
45+
files: ['**/*.ts', '**/*.tsx'],
46+
languageOptions: {
47+
parser: typescriptParser,
48+
parserOptions: {
49+
ecmaVersion: 2018,
50+
sourceType: 'module',
51+
},
52+
},
53+
rules: {
54+
'@typescript-eslint/ban-ts-comment': 'warn',
55+
'@typescript-eslint/no-non-null-assertion': 'off',
56+
'@typescript-eslint/no-use-before-define': 'off',
57+
'@typescript-eslint/no-warning-comments': 'off',
58+
'@typescript-eslint/no-empty-function': 'off',
59+
'@typescript-eslint/no-var-requires': 'off',
60+
'@typescript-eslint/explicit-function-return-type': 'off',
61+
'@typescript-eslint/explicit-module-boundary-types': 'off',
62+
'@typescript-eslint/ban-types': 'off',
63+
'@typescript-eslint/camelcase': 'off',
64+
'n/no-missing-import': 'off',
65+
'n/no-empty-function': 'off',
66+
'n/no-unsupported-features/es-syntax': 'off',
67+
'n/no-missing-require': 'off',
68+
'n/shebang': 'off',
69+
'no-dupe-class-members': 'off',
70+
'require-atomic-updates': 'off',
71+
},
72+
},
73+
{
74+
ignores: ['build/', 'test/fixtures/', 'template/'],
75+
},
76+
];

0 commit comments

Comments
 (0)