-
Notifications
You must be signed in to change notification settings - Fork 157
/
.eslintrc.cjs
141 lines (141 loc) · 5.54 KB
/
.eslintrc.cjs
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
module.exports = {
root: true,
env: {
es2022: true,
node: true,
},
extends: 'eslint:recommended',
parserOptions: {
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
rules: {
'array-bracket-spacing': 'error',
'brace-style': 'error',
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': 'error',
'computed-property-spacing': 'error',
curly: 'error',
'dot-notation': 'error',
'eol-last': 'error',
eqeqeq: 'error',
'func-call-spacing': 'error',
indent: [
'error', 4, {
SwitchCase: 1,
},
],
'keyword-spacing': 'error',
'linebreak-style': 'error',
'no-console': [
'error', {
allow: ['assert', 'warn', 'error'],
},
],
'no-constant-binary-expression': 'error',
'no-constructor-return': 'error',
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'no-multiple-empty-lines': ['error', { max: 1 }],
'no-tabs': 'error',
'no-template-curly-in-string': 'error',
'no-trailing-spaces': 'error',
'no-var': 'error',
'no-whitespace-before-property': 'error',
'object-curly-spacing': ['error', 'always'],
'one-var-declaration-per-line': ['error', 'always'],
'prefer-const': 'error',
'quote-props': ['error', 'as-needed'],
quotes: ['error', 'single'],
'padded-blocks': ['error', 'never'],
semi: ['error', 'always'],
'space-before-blocks': 'error',
'space-before-function-paren': [
'error', {
anonymous: 'never',
named: 'never',
},
],
'space-in-parens': 'error',
'space-infix-ops': 'error',
},
overrides: [
{
files: ['*.ts'],
extends: 'plugin:@typescript-eslint/recommended',
rules: {
// Disable base rules that have typescript equivalents.
indent: 'off',
'no-extra-parens': 'off',
'no-extra-semi': 'off',
quotes: 'off',
semi: 'off',
// TODO: Try to remove existing uses.
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
'@typescript-eslint/explicit-function-return-type': [
'off', {
allowExpressions: true,
},
],
'@typescript-eslint/explicit-module-boundary-types': [
'error', {
allowArgumentsExplicitlyTypedAsAny: true,
},
],
'@typescript-eslint/indent': [
'error', 4, {
SwitchCase: 1,
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
CallExpression: { arguments: 'first' },
},
],
'@typescript-eslint/member-delimiter-style': [
'error', {
singleline: {
delimiter: 'semi',
requireLast: true,
},
},
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-extra-parens': 'error',
'@typescript-eslint/no-extra-semi': 'error',
// TODO: Investigate whether we can replace it with modern syntax.
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unused-vars': [
'error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-useless-constructor': 'error',
// TODO: Try to remove existing uses.
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/semi': ['error', 'always'],
},
},
{
files: ['**/*.test.*'],
extends: [
'plugin:vitest/all',
],
rules: {
'vitest/max-expects': 'off',
'vitest/no-conditional-in-test': 'off',
'vitest/no-conditional-tests': 'off',
'vitest/no-hooks': 'off',
'vitest/prefer-expect-assertions': 'off',
'vitest/require-top-level-describe': 'off',
},
},
],
};