-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
164 lines (164 loc) · 4.59 KB
/
.eslintrc.js
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/** @type { import("eslint").ESLint.ConfigData } */
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
],
globals: {
Atomics: 'readonly',
SharedArrayBuffer: 'readonly',
},
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
plugins: ['@typescript-eslint', 'import'],
rules: {
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
overrides: {
constructors: 'no-public',
},
},
],
'@typescript-eslint/member-ordering': ['warn'],
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['classProperty'],
format: ['strictCamelCase', 'UPPER_CASE', 'snake_case'],
leadingUnderscore: 'allow',
},
{
selector: 'typeParameter',
format: ['StrictPascalCase'],
prefix: ['T'],
},
{
selector: ['typeLike'],
format: ['StrictPascalCase'],
},
{
selector: ['function', 'classMethod'],
format: ['strictCamelCase'],
leadingUnderscore: 'allow',
},
{
selector: ['parameter'],
format: ['strictCamelCase'],
leadingUnderscore: 'allow',
},
{
selector: ['variableLike'],
format: ['strictCamelCase', 'UPPER_CASE', 'snake_case'],
},
],
'@typescript-eslint/no-dynamic-delete': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-floating-promises': ['error'],
'no-magic-numbers': 'off',
'@typescript-eslint/no-magic-numbers': [
'warn',
{
ignore: [0, 1],
ignoreArrayIndexes: true,
ignoreEnums: true,
ignoreReadonlyClassProperties: true,
},
],
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unused-expressions': ['error'],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-nullish-coalescing': ['off'],
'@typescript-eslint/prefer-optional-chain': 'off',
'@typescript-eslint/prefer-readonly': ['warn'],
'@typescript-eslint/promise-function-async': ['error'],
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/restrict-plus-operands': [
'error',
{
checkCompoundAssignments: true,
},
],
'@typescript-eslint/typedef': [
'error',
{
arrayDestructuring: true,
arrowParameter: true,
memberVariableDeclaration: true,
objectDestructuring: true,
parameter: true,
propertyDeclaration: true,
variableDeclaration: true,
},
],
'@typescript-eslint/unified-signatures': 'error',
'import/default': 'off',
'import/namespace': 'off',
'import/newline-after-import': 'error',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
groups: ['builtin', 'external'],
'newlines-between': 'always',
pathGroups: [
{
pattern: '@jest/globals',
group: 'external',
position: 'before',
},
{
pattern: 'jest-mock',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['@jest/globals', 'jest-mock'],
},
],
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'sort-keys': [
'error',
'asc',
{
caseSensitive: false,
natural: true,
},
],
},
overrides: [
{
files: ['**/*.spec.ts'],
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
rules: {
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-magic-numbers': 'off',
'jest/valid-title': 'off',
},
},
],
};