@stride.it/appoint-lint-governance 0.1.22 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1858 -20
- package/dist/index.js +274 -206
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,41 +2,42 @@
|
|
|
2
2
|
import tseslint from "typescript-eslint";
|
|
3
3
|
function typescriptBase(options = {}) {
|
|
4
4
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
files,
|
|
8
|
+
plugins: {
|
|
9
|
+
"@typescript-eslint": tseslint.plugin
|
|
10
|
+
},
|
|
11
|
+
languageOptions: {
|
|
12
|
+
parser: tseslint.parser,
|
|
13
|
+
parserOptions: {
|
|
14
|
+
ecmaVersion: "latest",
|
|
15
|
+
sourceType: "module"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
20
|
+
"@typescript-eslint/no-unused-vars": "error",
|
|
21
|
+
"@typescript-eslint/no-shadow": "error",
|
|
22
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
23
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
24
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
25
|
+
"no-undef": "off",
|
|
26
|
+
"no-unused-vars": "off",
|
|
27
|
+
"no-var": "error",
|
|
28
|
+
"prefer-const": "error",
|
|
29
|
+
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
30
|
+
"no-implicit-coercion": "error"
|
|
15
31
|
}
|
|
16
|
-
},
|
|
17
|
-
rules: {
|
|
18
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
|
19
|
-
"@typescript-eslint/no-unused-vars": "error",
|
|
20
|
-
"@typescript-eslint/no-shadow": "error",
|
|
21
|
-
"@typescript-eslint/ban-ts-comment": "error",
|
|
22
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
23
|
-
"@typescript-eslint/no-inferrable-types": "error",
|
|
24
|
-
"no-undef": "off",
|
|
25
|
-
"no-unused-vars": "off",
|
|
26
|
-
"no-var": "error",
|
|
27
|
-
"prefer-const": "error",
|
|
28
|
-
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
29
|
-
"no-implicit-coercion": "error"
|
|
30
32
|
}
|
|
31
|
-
|
|
33
|
+
];
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
// src/configs/typescript/conventions.ts
|
|
35
37
|
import importPlugin from "eslint-plugin-import";
|
|
36
|
-
import tseslint2 from "typescript-eslint";
|
|
37
38
|
function typescriptConventions(options = {}) {
|
|
38
39
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
39
|
-
return
|
|
40
|
+
return [
|
|
40
41
|
{
|
|
41
42
|
files,
|
|
42
43
|
plugins: {
|
|
@@ -47,7 +48,6 @@ function typescriptConventions(options = {}) {
|
|
|
47
48
|
"import/no-default-export": "error",
|
|
48
49
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
49
50
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
50
|
-
"@typescript-eslint/consistent-type-exports": "error",
|
|
51
51
|
"prefer-arrow-callback": "error"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
@@ -56,90 +56,121 @@ function typescriptConventions(options = {}) {
|
|
|
56
56
|
files: [
|
|
57
57
|
"**/*.config.{js,mjs,ts}",
|
|
58
58
|
"**/app/**/{page,layout,template,not-found,global-error,loading,error}.tsx",
|
|
59
|
-
"**/*.stories.tsx"
|
|
59
|
+
"**/*.stories.tsx",
|
|
60
|
+
"**/*.d.ts"
|
|
60
61
|
],
|
|
61
62
|
rules: {
|
|
62
63
|
"import/no-default-export": "off"
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
|
|
66
|
+
];
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
// src/configs/typescript/docs.ts
|
|
69
70
|
import comments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
70
71
|
import jsdoc from "eslint-plugin-jsdoc";
|
|
71
|
-
import tseslint3 from "typescript-eslint";
|
|
72
72
|
function typescriptDocs(options = {}) {
|
|
73
73
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
files,
|
|
77
|
+
plugins: {
|
|
78
|
+
jsdoc,
|
|
79
|
+
"eslint-comments": comments
|
|
80
|
+
},
|
|
81
|
+
rules: {
|
|
82
|
+
"eslint-comments/no-unused-disable": "error",
|
|
83
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
84
|
+
"eslint-comments/require-description": "error",
|
|
85
|
+
"eslint-comments/disable-enable-pair": "error",
|
|
86
|
+
"jsdoc/check-alignment": "error",
|
|
87
|
+
"jsdoc/require-param": "error",
|
|
88
|
+
"jsdoc/require-returns": "error"
|
|
89
|
+
}
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// src/configs/typescript/functional.ts
|
|
95
|
+
import tseslint2 from "typescript-eslint";
|
|
96
|
+
var FUNCTIONAL_RULES = {
|
|
97
|
+
// Type Safety
|
|
98
|
+
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
99
|
+
// Modern Syntax
|
|
100
|
+
"@typescript-eslint/default-param-last": "error",
|
|
101
|
+
"prefer-rest-params": "error",
|
|
102
|
+
"prefer-spread": "error",
|
|
103
|
+
"no-new-func": "error",
|
|
104
|
+
// Clean Code
|
|
105
|
+
"@typescript-eslint/no-empty-function": "error"
|
|
106
|
+
};
|
|
107
|
+
function typescriptFunctional(options = {}) {
|
|
108
|
+
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
109
|
+
return [
|
|
110
|
+
{
|
|
111
|
+
files,
|
|
112
|
+
plugins: {
|
|
113
|
+
"@typescript-eslint": tseslint2.plugin
|
|
114
|
+
},
|
|
115
|
+
rules: FUNCTIONAL_RULES
|
|
116
|
+
}
|
|
117
|
+
];
|
|
89
118
|
}
|
|
90
119
|
|
|
91
120
|
// src/configs/typescript/imports.ts
|
|
92
121
|
import importPlugin2 from "eslint-plugin-import";
|
|
93
122
|
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
|
94
|
-
|
|
123
|
+
var IMPORTS_RULES = {
|
|
124
|
+
"import/no-duplicates": "error",
|
|
125
|
+
"import/no-cycle": "error",
|
|
126
|
+
"import/no-mutable-exports": "error",
|
|
127
|
+
"import/first": "error",
|
|
128
|
+
"import/newline-after-import": "error",
|
|
129
|
+
"import/no-extraneous-dependencies": [
|
|
130
|
+
"error",
|
|
131
|
+
{
|
|
132
|
+
devDependencies: [
|
|
133
|
+
"**/*.test.ts",
|
|
134
|
+
"**/*.spec.ts",
|
|
135
|
+
"test/**",
|
|
136
|
+
"tests/**",
|
|
137
|
+
"**/*.config.{js,ts,mjs}",
|
|
138
|
+
"**/*.stories.tsx",
|
|
139
|
+
"scripts/**"
|
|
140
|
+
],
|
|
141
|
+
optionalDependencies: false,
|
|
142
|
+
peerDependencies: false
|
|
143
|
+
}
|
|
144
|
+
],
|
|
145
|
+
"simple-import-sort/imports": "error",
|
|
146
|
+
"simple-import-sort/exports": "error",
|
|
147
|
+
"import/no-deprecated": "error",
|
|
148
|
+
"no-restricted-imports": "off"
|
|
149
|
+
};
|
|
95
150
|
function typescriptImports(options = {}) {
|
|
96
151
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
settings: {
|
|
104
|
-
"import/parsers": {
|
|
105
|
-
"@typescript-eslint/parser": [".ts", ".tsx", ".mts", ".cts"]
|
|
152
|
+
return [
|
|
153
|
+
{
|
|
154
|
+
files,
|
|
155
|
+
plugins: {
|
|
156
|
+
import: importPlugin2,
|
|
157
|
+
"simple-import-sort": simpleImportSort
|
|
106
158
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
project: ["tsconfig.json", "*/tsconfig.json"]
|
|
159
|
+
settings: {
|
|
160
|
+
"import/parsers": {
|
|
161
|
+
"@typescript-eslint/parser": [".ts", ".tsx", ".mts", ".cts"]
|
|
111
162
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"import/no-cycle": "error",
|
|
119
|
-
"import/no-mutable-exports": "error",
|
|
120
|
-
"import/first": "error",
|
|
121
|
-
"import/newline-after-import": "error",
|
|
122
|
-
"import/no-extraneous-dependencies": [
|
|
123
|
-
"error",
|
|
124
|
-
{
|
|
125
|
-
devDependencies: [
|
|
126
|
-
"**/*.test.ts",
|
|
127
|
-
"**/*.spec.ts",
|
|
128
|
-
"test/**",
|
|
129
|
-
"tests/**",
|
|
130
|
-
"**/*.config.{js,ts,mjs}",
|
|
131
|
-
"**/*.stories.tsx",
|
|
132
|
-
"scripts/**"
|
|
133
|
-
],
|
|
134
|
-
optionalDependencies: false,
|
|
135
|
-
peerDependencies: false
|
|
163
|
+
"import/resolver": {
|
|
164
|
+
typescript: {
|
|
165
|
+
alwaysTryTypes: true,
|
|
166
|
+
project: ["tsconfig.json", "*/tsconfig.json"]
|
|
167
|
+
},
|
|
168
|
+
node: true
|
|
136
169
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"simple-import-sort/imports": "error",
|
|
140
|
-
"simple-import-sort/exports": "error"
|
|
170
|
+
},
|
|
171
|
+
rules: IMPORTS_RULES
|
|
141
172
|
}
|
|
142
|
-
|
|
173
|
+
];
|
|
143
174
|
}
|
|
144
175
|
|
|
145
176
|
// src/configs/typescript/minimal.ts
|
|
@@ -147,174 +178,211 @@ function typescriptMinimal(options = {}) {
|
|
|
147
178
|
return typescriptBase(options);
|
|
148
179
|
}
|
|
149
180
|
|
|
181
|
+
// src/configs/typescript/naming-env.ts
|
|
182
|
+
import unicorn from "eslint-plugin-unicorn";
|
|
183
|
+
var NAMING_RULES = {
|
|
184
|
+
"unicorn/filename-case": [
|
|
185
|
+
"error",
|
|
186
|
+
{
|
|
187
|
+
cases: {
|
|
188
|
+
kebabCase: true,
|
|
189
|
+
pascalCase: true
|
|
190
|
+
},
|
|
191
|
+
ignore: ["NEXT_", "README", "CHANGELOG", "LICENSE", "Dockerfile", "^_"]
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"no-restricted-globals": ["error", "event", "fdescribe"]
|
|
195
|
+
};
|
|
196
|
+
function typescriptNamingEnv(options = {}) {
|
|
197
|
+
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
198
|
+
return [
|
|
199
|
+
{
|
|
200
|
+
files,
|
|
201
|
+
plugins: {
|
|
202
|
+
unicorn
|
|
203
|
+
},
|
|
204
|
+
rules: NAMING_RULES
|
|
205
|
+
}
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
|
|
150
209
|
// src/configs/typescript/prettier.ts
|
|
151
210
|
import eslintConfigPrettier from "eslint-config-prettier";
|
|
152
|
-
import tseslint5 from "typescript-eslint";
|
|
153
211
|
function typescriptPrettierInterop(options = {}) {
|
|
154
212
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
155
|
-
return
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
213
|
+
return [
|
|
214
|
+
{
|
|
215
|
+
files,
|
|
216
|
+
rules: {
|
|
217
|
+
...eslintConfigPrettier.rules
|
|
218
|
+
}
|
|
159
219
|
}
|
|
160
|
-
|
|
220
|
+
];
|
|
161
221
|
}
|
|
162
222
|
|
|
163
223
|
// src/configs/typescript/recommended.ts
|
|
164
|
-
import
|
|
224
|
+
import tseslint4 from "typescript-eslint";
|
|
165
225
|
|
|
166
226
|
// src/configs/typescript/quality.ts
|
|
167
227
|
import sonarjs from "eslint-plugin-sonarjs";
|
|
168
|
-
import
|
|
169
|
-
|
|
228
|
+
import unicorn2 from "eslint-plugin-unicorn";
|
|
229
|
+
var UNICORN_ABBREVIATIONS = {
|
|
230
|
+
allowList: {
|
|
231
|
+
Props: true,
|
|
232
|
+
props: true,
|
|
233
|
+
Ref: true,
|
|
234
|
+
ref: true,
|
|
235
|
+
Src: true,
|
|
236
|
+
src: true,
|
|
237
|
+
Params: true,
|
|
238
|
+
params: true,
|
|
239
|
+
Env: true,
|
|
240
|
+
env: true,
|
|
241
|
+
Args: true,
|
|
242
|
+
args: true,
|
|
243
|
+
Docs: true,
|
|
244
|
+
docs: true,
|
|
245
|
+
arg: true,
|
|
246
|
+
err: true,
|
|
247
|
+
req: true,
|
|
248
|
+
res: true,
|
|
249
|
+
ctx: true,
|
|
250
|
+
val: true
|
|
251
|
+
}
|
|
252
|
+
};
|
|
170
253
|
function typescriptQuality(options = {}) {
|
|
171
254
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"warn",
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Env: true,
|
|
198
|
-
env: true,
|
|
199
|
-
Args: true,
|
|
200
|
-
args: true,
|
|
201
|
-
Docs: true,
|
|
202
|
-
docs: true,
|
|
203
|
-
arg: true,
|
|
204
|
-
err: true,
|
|
205
|
-
req: true,
|
|
206
|
-
res: true,
|
|
207
|
-
ctx: true,
|
|
208
|
-
val: true
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
],
|
|
212
|
-
// Best Practices
|
|
213
|
-
"consistent-return": "error",
|
|
214
|
-
// SonarJS
|
|
215
|
-
"sonarjs/cognitive-complexity": ["error", 15],
|
|
216
|
-
"sonarjs/no-identical-functions": "error",
|
|
217
|
-
"sonarjs/no-duplicated-branches": "error",
|
|
218
|
-
"sonarjs/no-redundant-boolean": "error",
|
|
219
|
-
"sonarjs/no-inverted-boolean-check": "error"
|
|
255
|
+
return [
|
|
256
|
+
{
|
|
257
|
+
files,
|
|
258
|
+
plugins: {
|
|
259
|
+
unicorn: unicorn2,
|
|
260
|
+
sonarjs
|
|
261
|
+
},
|
|
262
|
+
rules: {
|
|
263
|
+
// Unicorn
|
|
264
|
+
"unicorn/prefer-node-protocol": "error",
|
|
265
|
+
"unicorn/no-useless-undefined": "error",
|
|
266
|
+
"unicorn/no-lonely-if": "error",
|
|
267
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
268
|
+
"unicorn/prefer-string-replace-all": "error",
|
|
269
|
+
"unicorn/prevent-abbreviations": ["warn", UNICORN_ABBREVIATIONS],
|
|
270
|
+
// Best Practices
|
|
271
|
+
"consistent-return": "error",
|
|
272
|
+
"no-implicit-coercion": "error",
|
|
273
|
+
// SonarJS
|
|
274
|
+
"sonarjs/cognitive-complexity": ["error", 15],
|
|
275
|
+
"sonarjs/no-identical-functions": "error",
|
|
276
|
+
"sonarjs/no-duplicated-branches": "error",
|
|
277
|
+
"sonarjs/no-redundant-boolean": "error",
|
|
278
|
+
"sonarjs/no-inverted-boolean-check": "error"
|
|
279
|
+
}
|
|
220
280
|
}
|
|
221
|
-
|
|
281
|
+
];
|
|
222
282
|
}
|
|
223
283
|
|
|
224
284
|
// src/configs/typescript/security.ts
|
|
225
285
|
import regexpPlugin from "eslint-plugin-regexp";
|
|
226
286
|
import securityPlugin from "eslint-plugin-security";
|
|
227
|
-
import tseslint7 from "typescript-eslint";
|
|
228
287
|
function typescriptSecurity(options = {}) {
|
|
229
288
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
230
|
-
return
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
289
|
+
return [
|
|
290
|
+
{
|
|
291
|
+
files,
|
|
292
|
+
plugins: {
|
|
293
|
+
security: securityPlugin,
|
|
294
|
+
regexp: regexpPlugin
|
|
295
|
+
},
|
|
296
|
+
rules: {
|
|
297
|
+
// eslint-plugin-security
|
|
298
|
+
"security/detect-object-injection": "error",
|
|
299
|
+
"security/detect-unsafe-regex": "error",
|
|
300
|
+
// eslint-plugin-regexp
|
|
301
|
+
"regexp/no-super-linear-backtracking": "error",
|
|
302
|
+
"regexp/no-useless-escape": "error",
|
|
303
|
+
"regexp/no-empty-capturing-group": "error"
|
|
304
|
+
}
|
|
244
305
|
}
|
|
245
|
-
|
|
306
|
+
];
|
|
246
307
|
}
|
|
247
308
|
|
|
248
309
|
// src/configs/typescript/size-complexity.ts
|
|
249
|
-
import tseslint8 from "typescript-eslint";
|
|
250
310
|
function typescriptSizeComplexity(options = {}) {
|
|
251
311
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
252
|
-
return
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
"
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
"
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
312
|
+
return [
|
|
313
|
+
{
|
|
314
|
+
files,
|
|
315
|
+
rules: {
|
|
316
|
+
"max-lines": [
|
|
317
|
+
"error",
|
|
318
|
+
{ max: 100, skipBlankLines: true, skipComments: true }
|
|
319
|
+
],
|
|
320
|
+
"max-lines-per-function": [
|
|
321
|
+
"error",
|
|
322
|
+
{ max: 50, skipBlankLines: true, skipComments: true }
|
|
323
|
+
],
|
|
324
|
+
complexity: ["error", 15],
|
|
325
|
+
"max-params": ["error", 3],
|
|
326
|
+
"max-depth": ["error", 4],
|
|
327
|
+
"no-var": "error",
|
|
328
|
+
"prefer-const": "warn"
|
|
329
|
+
}
|
|
267
330
|
}
|
|
268
|
-
|
|
331
|
+
];
|
|
269
332
|
}
|
|
270
333
|
|
|
271
334
|
// src/configs/typescript/type-aware.ts
|
|
272
|
-
import
|
|
335
|
+
import tseslint3 from "typescript-eslint";
|
|
273
336
|
function typescriptTypeAware(options = {}) {
|
|
274
337
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
338
|
+
return [
|
|
339
|
+
{
|
|
340
|
+
files,
|
|
341
|
+
plugins: {
|
|
342
|
+
"@typescript-eslint": tseslint3.plugin
|
|
343
|
+
},
|
|
344
|
+
languageOptions: {
|
|
345
|
+
parserOptions: {
|
|
346
|
+
project: options.tsconfigPath ?? "./tsconfig.json",
|
|
347
|
+
tsconfigRootDir: options.tsconfigRootDir
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
rules: {
|
|
351
|
+
"@typescript-eslint/require-await": "error",
|
|
352
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
353
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
354
|
+
"@typescript-eslint/await-thenable": "error",
|
|
355
|
+
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
356
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
357
|
+
"@typescript-eslint/restrict-template-expressions": "error",
|
|
358
|
+
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
359
|
+
"@typescript-eslint/prefer-optional-chain": "error",
|
|
360
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
361
|
+
"@typescript-eslint/no-deprecated": "error",
|
|
362
|
+
"@typescript-eslint/consistent-type-exports": "error"
|
|
284
363
|
}
|
|
285
|
-
},
|
|
286
|
-
rules: {
|
|
287
|
-
"@typescript-eslint/require-await": "error",
|
|
288
|
-
"@typescript-eslint/no-floating-promises": "error",
|
|
289
|
-
"@typescript-eslint/no-misused-promises": "error",
|
|
290
|
-
"@typescript-eslint/await-thenable": "error",
|
|
291
|
-
"@typescript-eslint/no-unnecessary-condition": "warn",
|
|
292
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
293
|
-
"@typescript-eslint/restrict-template-expressions": "error",
|
|
294
|
-
"@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
295
|
-
"@typescript-eslint/prefer-optional-chain": "error",
|
|
296
|
-
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
297
|
-
"@typescript-eslint/no-deprecated": "error"
|
|
298
364
|
}
|
|
299
|
-
|
|
365
|
+
];
|
|
300
366
|
}
|
|
301
367
|
|
|
302
368
|
// src/configs/typescript/recommended.ts
|
|
303
369
|
function typescriptRecommended(options = {}) {
|
|
304
370
|
const files = options.files ?? ["**/*.{ts,tsx,mts,cts}"];
|
|
305
371
|
const enableConventions = options.enableConventions ?? true;
|
|
306
|
-
const upstreamConfigs = options.typeChecked ?
|
|
372
|
+
const upstreamConfigs = options.typeChecked ? tseslint4.configs.recommendedTypeChecked : tseslint4.configs.recommended;
|
|
307
373
|
const typeAwareConfig = options.typeChecked ? typescriptTypeAware({
|
|
308
374
|
files,
|
|
309
375
|
tsconfigPath: options.tsconfigPath,
|
|
310
376
|
tsconfigRootDir: options.tsconfigRootDir
|
|
311
377
|
}) : [];
|
|
312
378
|
const conventionsConfig = enableConventions ? typescriptConventions({ files }) : [];
|
|
313
|
-
return
|
|
379
|
+
return [
|
|
314
380
|
...typescriptBase({ files }),
|
|
315
381
|
...typescriptQuality({ files }),
|
|
316
382
|
...typescriptImports({ files }),
|
|
317
383
|
...typescriptSecurity({ files }),
|
|
384
|
+
...typescriptNamingEnv({ files }),
|
|
385
|
+
...typescriptFunctional({ files }),
|
|
318
386
|
...typescriptDocs({ files }),
|
|
319
387
|
...typescriptSizeComplexity({ files }),
|
|
320
388
|
...conventionsConfig,
|
|
@@ -323,7 +391,7 @@ function typescriptRecommended(options = {}) {
|
|
|
323
391
|
...config,
|
|
324
392
|
files
|
|
325
393
|
}))
|
|
326
|
-
|
|
394
|
+
];
|
|
327
395
|
}
|
|
328
396
|
|
|
329
397
|
// src/plugin/index.ts
|