-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
117 lines (108 loc) · 3.96 KB
/
eslint.config.ts
File metadata and controls
117 lines (108 loc) · 3.96 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import js from '@eslint/js';
import globals from 'globals';
import ts from 'typescript-eslint';
const config = [
{
ignores: ['dist/**', 'node_modules/**', '.scratchpad/**'],
},
js.configs.recommended,
...ts.configs.recommended,
{
files: ['src/**/*.ts'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.builtin, ...globals.node, ...globals.es2020,
},
parser: ts.parser,
parserOptions: {
project: './tsconfig.json',
},
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports', disallowTypeAnnotations: false }],
"@typescript-eslint/no-unsafe-function-type": "off",
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/await-thenable': 'error',
'constructor-super': 'error',
'curly': ['error', 'multi-line'],
'default-case-last': 'error',
'default-param-last': ['error'],
'dot-notation': ['error', { allowKeywords: true }],
'eqeqeq': ['error', 'smart'],
'indent': ['error', 2],
'max-len': ['error', { code: 200, tabWidth: 2 }],
'no-console': ['error', { allow: ['debug'] }],
'no-const-assign': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-empty': 'error',
'no-throw-literal': 'error',
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unused-expressions': 'error',
'no-use-before-define': 'off',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-constructor': 'error',
'no-useless-return': 'error',
'object-shorthand': ['error', 'always'],
'prefer-const': ['error', { destructuring: 'all' }],
'prefer-destructuring': ['error', { object: true, array: true }],
'prefer-spread': 'error',
'prefer-template': 'error',
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
'sort-imports': ['error', { ignoreDeclarationSort: true }],
// 'sort-keys': ['error', 'asc', { caseSensitive: true, natural: true }],
},
},
{
files: ['tests/**/*.ts'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.builtin, ...globals.node,
},
parser: ts.parser,
parserOptions: {
project: './tsconfig.json',
},
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports', disallowTypeAnnotations: false }],
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'curly': ['error', 'multi-line'],
'eqeqeq': ['error', 'smart'],
'indent': ['error', 2],
'no-console': 'off',
'no-throw-literal': 'error',
'no-unused-expressions': 'error',
'prefer-const': ['error', { destructuring: 'all' }],
'prefer-template': 'error',
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
},
}
];
export default config;