-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.mjs
More file actions
54 lines (48 loc) · 1.6 KB
/
eslint.config.mjs
File metadata and controls
54 lines (48 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import eslintPluginTs from '@typescript-eslint/eslint-plugin';
import parserTs from '@typescript-eslint/parser';
export default [
{
files: ['**/*.ts'],
languageOptions: {
parser: parserTs,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: process.cwd(),
},
},
plugins: {
'@typescript-eslint': eslintPluginTs,
},
rules: {
// --- Recommended ---
...eslintPluginTs.configs.recommended.rules,
// --- Safety ---
'no-implicit-coercion': 'error',
'eqeqeq': ['error', 'always'],
'curly': 'error',
'no-fallthrough': 'error',
'default-case': 'error',
// --- Style ---
'quotes': ['error', 'single', { avoidEscape: true }],
'comma-dangle': ['error', 'always-multiline'],
'no-trailing-spaces': 'error',
'no-multi-spaces': 'error',
'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
// --- Clean code ---
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
// --- Customization ---
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
// --- Others ---
'no-var': 'error',
'prefer-const': 'error',
'no-shadow': 'error',
},
},
];