-
Notifications
You must be signed in to change notification settings - Fork 243
/
Copy patheslint.config.mjs
93 lines (90 loc) · 3.27 KB
/
eslint.config.mjs
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
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';
import globals from 'globals';
export default tseslint.config(
{
ignores: ['out/', 'dist/'],
},
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
stylistic.configs.customize({
arrowParens: 'always',
braceStyle: '1tbs',
commaDangle: 'only-multiline',
indent: 4,
quotes: 'single',
semi: 'always',
}),
{
files: ['resources/*.js'],
languageOptions: {
globals: {
acquireVsCodeApi: true, // available for VSCode WebViews
},
},
},
{
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/no-base-to-string': 'off', // 1 instance
'@typescript-eslint/prefer-promise-reject-errors': ['error', {
// for catch (e) { reject(e); } scenarios, until promises are refactored
allowThrowingAny: true,
allowThrowingUnknown: true,
}],
'@stylistic/indent-binary-ops': 'off', // this is a weird rule
'@stylistic/max-len': ['error', {
code: 160,
ignoreTrailingComments: true,
}],
'@stylistic/max-statements-per-line': ['error', {
ignoredNodes: ['IfStatement'],
}],
'@stylistic/member-delimiter-style': ['error', {
multiline: { delimiter: 'semi' },
singleline: { delimiter: 'semi' },
}],
'@stylistic/no-multi-spaces': ['error', {
ignoreEOLComments: true,
}],
'@stylistic/quote-props': ['error', 'as-needed', {
unnecessary: false,
}],
}
},
{
// the following rules are being heavily violated in the current codebase,
// we should work on being able to enable them...
rules: {
'@typescript-eslint/no-unsafe-member-access': 'off', // 655 instances
'@typescript-eslint/no-unsafe-call': 'off', // 381 instances
'@typescript-eslint/no-unsafe-assignment': 'off', // 354 instances
'@typescript-eslint/no-unsafe-argument': 'off', // 309 instances
'@typescript-eslint/no-explicit-any': 'off', // 187 instances
'@typescript-eslint/no-unused-vars': 'off', // 169 instances
'@typescript-eslint/no-misused-promises': 'off', // 53 instances
'@typescript-eslint/no-floating-promises': 'off', // 48 instances
'no-async-promise-executor': 'off', // 25 instances
}
},
{
files: ['**/*.{js,mjs}'],
extends: [tseslint.configs.disableTypeChecked],
},
{
files: ['**/*.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
}
}
);