-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.eslintrc.js
176 lines (176 loc) · 6.67 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
165
166
167
168
169
170
171
172
173
174
175
176
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
plugins: [
"@typescript-eslint",
],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
rules: {
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin/docs/rules
"@typescript-eslint/adjacent-overload-signatures": ["warn"],
"@typescript-eslint/array-type": ["warn", {
"default": "generic",
}],
"@typescript-eslint/await-thenable": ["warn"],
"@typescript-eslint/ban-ts-comment": ["warn", {
"ts-expect-error": "allow-with-description",
"ts-ignore": "allow-with-description",
"ts-nocheck": "allow-with-description",
"ts-check": false,
"minimumDescriptionLength": 3,
}],
"brace-style": "off",
"@typescript-eslint/brace-style": ["warn", "1tbs"],
"@typescript-eslint/class-literal-property-style": ["warn", "getters"],
"comma-spacing": "off",
"@typescript-eslint/comma-spacing": ["warn"],
"@typescript-eslint/consistent-type-assertions": ["warn", {
"assertionStyle": "as",
"objectLiteralTypeAssertions": "allow-as-parameter",
}],
"@typescript-eslint/consistent-type-definitions": ["warn", "type"],
"default-param-last": "off",
"@typescript-eslint/default-param-last": ["warn"],
"@typescript-eslint/explicit-member-accessibility": ["warn", {
"accessibility": "no-public",
}],
"func-call-spacing": "off",
"@typescript-eslint/func-call-spacing": ["warn"],
"keyword-spacing": "off",
"@typescript-eslint/keyword-spacing": ["warn"],
"lines-between-class-members": "off",
"@typescript-eslint/member-delimiter-style": ["warn", {
"multiline": {
"delimiter": "comma",
"requireLast": true,
},
"singleline": {
"delimiter": "comma",
"requireLast": false,
},
}],
"@typescript-eslint/naming-convention": ["warn",
{
"selector": "default",
"format": ["camelCase"],
},
{
"selector": "typeLike",
"format": ["PascalCase"],
},
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require",
},
{
"selector": "parameter",
"format": ["camelCase"],
"leadingUnderscore": "allow",
},
{
"selector": "memberLike",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require",
},
{
"selector": "class",
"format": ["PascalCase"],
},
{
"selector": "typeAlias",
"format": ["PascalCase"],
"custom": {
"regex": "^T[A-Z]",
"match": true,
},
},
],
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": ["warn"],
"@typescript-eslint/no-confusing-non-null-assertion": ["warn"],
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": ["error"],
"@typescript-eslint/no-dynamic-delete": ["warn"],
"@typescript-eslint/no-empty-function": ["warn", {
"allow": [
"setters", // Required for custom elements
],
}],
"@typescript-eslint/no-empty-interface": ["warn"],
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/no-extra-non-null-assertion": ["warn"],
"no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": ["warn"],
"@typescript-eslint/no-extraneous-class": ["warn"],
"@typescript-eslint/no-floating-promises": ["warn"],
"@typescript-eslint/no-for-in-array": ["warn"],
"@typescript-eslint/no-inferrable-types": ["warn"],
"no-invalid-this": "off",
// Rule is buggy with instance fields.
// "@typescript-eslint/no-invalid-this": ["warn"],
"@typescript-eslint/no-invalid-void-type": ["warn", {
"allowInGenericTypeArguments": true,
}],
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": ["error"],
"@typescript-eslint/no-misused-new": ["error"],
"@typescript-eslint/no-misused-promises": ["error"],
"@typescript-eslint/no-namespace": ["warn"],
"@typescript-eslint/no-non-null-asserted-optional-chain": ["warn"],
"@typescript-eslint/no-non-null-assertion": ["off"],
"@typescript-eslint/no-parameter-properties": ["warn"],
"@typescript-eslint/no-require-imports": ["error"],
"@typescript-eslint/no-this-alias": ["warn"],
"@typescript-eslint/no-throw-literal": ["error"],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["warn"],
"@typescript-eslint/no-unnecessary-condition": ["warn", {
"allowConstantLoopConditions": true,
}],
"@typescript-eslint/no-unnecessary-type-arguments": ["warn"],
"@typescript-eslint/no-unnecessary-type-assertion": ["warn"],
"@typescript-eslint/no-unsafe-assignment": ["warn"],
"@typescript-eslint/no-unsafe-call": ["warn"],
"@typescript-eslint/no-unsafe-return": ["warn"],
"@typescript-eslint/no-unused-vars-experimental": ["warn"],
"@typescript-eslint/no-unused-vars": ["off"],
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["warn"],
"@typescript-eslint/prefer-as-const": ["warn"],
"@typescript-eslint/prefer-for-of": ["warn"],
"@typescript-eslint/prefer-function-type": ["warn"],
"@typescript-eslint/prefer-nullish-coalescing": ["warn"],
"@typescript-eslint/prefer-optional-chain": ["warn"],
// "@typescript-eslint/prefer-readonly-parameter-types": ["warn"],
"@typescript-eslint/prefer-readonly": ["warn"],
"@typescript-eslint/prefer-reduce-type-parameter": ["warn"],
"@typescript-eslint/prefer-regexp-exec": ["warn"],
"@typescript-eslint/prefer-string-starts-ends-with": ["warn"],
"quotes": "off",
"@typescript-eslint/quotes": ["warn", "double"],
"@typescript-eslint/require-array-sort-compare": ["warn"],
"@typescript-eslint/require-await": ["warn"],
"@typescript-eslint/restrict-plus-operands": ["error"],
"no-return-await": "off",
"@typescript-eslint/return-await": ["warn", "always"],
"semi": "off",
"@typescript-eslint/semi": ["warn", "always"],
"space-before-function-paren": "off",
"@typescript-eslint/space-before-function-paren": ["warn"],
"@typescript-eslint/switch-exhaustiveness-check": ["warn"],
"@typescript-eslint/triple-slash-reference": ["error"],
"@typescript-eslint/type-annotation-spacing": ["warn"],
"@typescript-eslint/unbound-method": ["warn"],
"@typescript-eslint/unified-signatures": ["warn"],
},
};