@xylabs/eslint-config-flat 8.1.21 → 8.2.1
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/README.md +30 -2
- package/dist/neutral/core/index.d.ts +2 -0
- package/dist/neutral/core/index.d.ts.map +1 -1
- package/dist/neutral/import/index.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +9 -8
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +719 -191
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/rules/consistency.d.ts +3 -0
- package/dist/neutral/rules/consistency.d.ts.map +1 -0
- package/dist/neutral/rules/correctness.d.ts +3 -0
- package/dist/neutral/rules/correctness.d.ts.map +1 -0
- package/dist/neutral/rules/index.d.ts +2 -0
- package/dist/neutral/rules/index.d.ts.map +1 -1
- package/dist/neutral/sonar/index.d.ts.map +1 -1
- package/dist/neutral/tiers/conflicts.d.ts +20 -0
- package/dist/neutral/tiers/conflicts.d.ts.map +1 -0
- package/dist/neutral/tiers/index.d.ts +35 -0
- package/dist/neutral/tiers/index.d.ts.map +1 -0
- package/dist/neutral/tiers/opinionated.d.ts +5 -0
- package/dist/neutral/tiers/opinionated.d.ts.map +1 -0
- package/dist/neutral/tiers/plugin-rules.d.ts +8 -0
- package/dist/neutral/tiers/plugin-rules.d.ts.map +1 -0
- package/dist/neutral/typescript/index.d.ts +5 -0
- package/dist/neutral/typescript/index.d.ts.map +1 -1
- package/dist/neutral/unicorn/index.d.ts +3 -0
- package/dist/neutral/unicorn/index.d.ts.map +1 -1
- package/dist/neutral/workspaces/index.d.ts.map +1 -1
- package/dist/node/core/index.d.ts +2 -0
- package/dist/node/core/index.d.ts.map +1 -1
- package/dist/node/import/index.d.ts.map +1 -1
- package/dist/node/index.d.ts +9 -8
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.mjs +719 -191
- package/dist/node/index.mjs.map +4 -4
- package/dist/node/rules/consistency.d.ts +3 -0
- package/dist/node/rules/consistency.d.ts.map +1 -0
- package/dist/node/rules/correctness.d.ts +3 -0
- package/dist/node/rules/correctness.d.ts.map +1 -0
- package/dist/node/rules/index.d.ts +2 -0
- package/dist/node/rules/index.d.ts.map +1 -1
- package/dist/node/sonar/index.d.ts.map +1 -1
- package/dist/node/tiers/conflicts.d.ts +20 -0
- package/dist/node/tiers/conflicts.d.ts.map +1 -0
- package/dist/node/tiers/index.d.ts +35 -0
- package/dist/node/tiers/index.d.ts.map +1 -0
- package/dist/node/tiers/opinionated.d.ts +5 -0
- package/dist/node/tiers/opinionated.d.ts.map +1 -0
- package/dist/node/tiers/plugin-rules.d.ts +8 -0
- package/dist/node/tiers/plugin-rules.d.ts.map +1 -0
- package/dist/node/typescript/index.d.ts +5 -0
- package/dist/node/typescript/index.d.ts.map +1 -1
- package/dist/node/unicorn/index.d.ts +3 -0
- package/dist/node/unicorn/index.d.ts.map +1 -1
- package/dist/node/workspaces/index.d.ts.map +1 -1
- package/package.json +6 -4
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
import
|
|
1
|
+
// src/json/index.ts
|
|
2
|
+
import json from "@eslint/json";
|
|
3
3
|
|
|
4
4
|
// src/ignores.ts
|
|
5
5
|
var ignores = [
|
|
@@ -22,6 +22,32 @@ var ignores = [
|
|
|
22
22
|
"yarn.lock"
|
|
23
23
|
];
|
|
24
24
|
|
|
25
|
+
// src/json/index.ts
|
|
26
|
+
var jsonConfig = {
|
|
27
|
+
ignores,
|
|
28
|
+
files: ["**/*.json"],
|
|
29
|
+
plugins: { json },
|
|
30
|
+
language: "json/json",
|
|
31
|
+
rules: { "json/no-duplicate-keys": ["error"] }
|
|
32
|
+
};
|
|
33
|
+
var jsoncConfig = {
|
|
34
|
+
ignores,
|
|
35
|
+
files: ["**/*.jsonc"],
|
|
36
|
+
plugins: { json },
|
|
37
|
+
language: "json/jsonc",
|
|
38
|
+
rules: { "json/no-duplicate-keys": ["error"] }
|
|
39
|
+
};
|
|
40
|
+
var json5Config = {
|
|
41
|
+
ignores,
|
|
42
|
+
files: ["**/*.json5"],
|
|
43
|
+
plugins: { json },
|
|
44
|
+
language: "json/json5",
|
|
45
|
+
rules: { "json/no-duplicate-keys": ["error"] }
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/markdown/index.ts
|
|
49
|
+
import markdown from "@eslint/markdown";
|
|
50
|
+
|
|
25
51
|
// src/shared.ts
|
|
26
52
|
import tsParser from "@typescript-eslint/parser";
|
|
27
53
|
var scriptFiles = [
|
|
@@ -91,7 +117,34 @@ function scopeConfigs(configs, options = {}) {
|
|
|
91
117
|
return (Array.isArray(configs) ? configs : [configs]).map((config2) => scopeConfig(config2, options));
|
|
92
118
|
}
|
|
93
119
|
|
|
94
|
-
// src/
|
|
120
|
+
// src/markdown/index.ts
|
|
121
|
+
var markdownConfig = scopeConfigs(markdown.configs.recommended);
|
|
122
|
+
|
|
123
|
+
// src/core/index.ts
|
|
124
|
+
import js from "@eslint/js";
|
|
125
|
+
|
|
126
|
+
// src/rules/consistency.ts
|
|
127
|
+
var consistencyRulesConfig = {
|
|
128
|
+
ignores,
|
|
129
|
+
rules: {
|
|
130
|
+
"complexity": ["error", 18],
|
|
131
|
+
"max-depth": ["error", 6],
|
|
132
|
+
"max-lines": [
|
|
133
|
+
"error",
|
|
134
|
+
{
|
|
135
|
+
max: 512,
|
|
136
|
+
skipBlankLines: true
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"array-element-newline": ["warn", "consistent"],
|
|
140
|
+
// Owned by max-nested-callbacks — measures callback nesting, not call depth
|
|
141
|
+
"max-nested-callbacks": ["error", 6],
|
|
142
|
+
"max-statements": ["error", 32],
|
|
143
|
+
"no-tabs": ["error"]
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// src/rules/correctness.ts
|
|
95
148
|
var restrictedImportPaths = [
|
|
96
149
|
"./index.ts",
|
|
97
150
|
"../index.ts",
|
|
@@ -102,6 +155,33 @@ var restrictedImportPaths = [
|
|
|
102
155
|
"../../../../../../index.ts",
|
|
103
156
|
"../../../../../../../index.ts"
|
|
104
157
|
];
|
|
158
|
+
var correctnessRulesConfig = {
|
|
159
|
+
ignores,
|
|
160
|
+
rules: {
|
|
161
|
+
// Owned by @typescript-eslint/no-unused-vars
|
|
162
|
+
"no-unused-vars": "off",
|
|
163
|
+
// Owned by unicorn/escape-case
|
|
164
|
+
"no-useless-escape": "off",
|
|
165
|
+
// Owned by unicorn/prefer-spread
|
|
166
|
+
"prefer-spread": "off",
|
|
167
|
+
"no-restricted-imports": [
|
|
168
|
+
"error",
|
|
169
|
+
{ paths: restrictedImportPaths }
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
// src/rules/index.ts
|
|
175
|
+
var restrictedImportPaths2 = [
|
|
176
|
+
"./index.ts",
|
|
177
|
+
"../index.ts",
|
|
178
|
+
"../../index.ts",
|
|
179
|
+
"../../../index.ts",
|
|
180
|
+
"../../../../index.ts",
|
|
181
|
+
"../../../../../index.ts",
|
|
182
|
+
"../../../../../../index.ts",
|
|
183
|
+
"../../../../../../../index.ts"
|
|
184
|
+
];
|
|
105
185
|
var restrictedSrcImportPatterns = [
|
|
106
186
|
{
|
|
107
187
|
group: [
|
|
@@ -115,25 +195,8 @@ var restrictedSrcImportPatterns = [
|
|
|
115
195
|
var rulesConfig = {
|
|
116
196
|
ignores,
|
|
117
197
|
rules: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"max-lines": [
|
|
121
|
-
"error",
|
|
122
|
-
{
|
|
123
|
-
max: 512,
|
|
124
|
-
skipBlankLines: true
|
|
125
|
-
}
|
|
126
|
-
],
|
|
127
|
-
"array-element-newline": ["warn", "consistent"],
|
|
128
|
-
"max-nested-callbacks": ["error", 6],
|
|
129
|
-
"max-statements": ["error", 32],
|
|
130
|
-
"no-restricted-imports": [
|
|
131
|
-
"error",
|
|
132
|
-
{ paths: restrictedImportPaths }
|
|
133
|
-
],
|
|
134
|
-
"no-tabs": ["error"],
|
|
135
|
-
"no-unused-vars": "off",
|
|
136
|
-
"no-useless-escape": "off"
|
|
198
|
+
...correctnessRulesConfig.rules,
|
|
199
|
+
...consistencyRulesConfig.rules
|
|
137
200
|
}
|
|
138
201
|
};
|
|
139
202
|
var srcImportsConfig = {
|
|
@@ -143,7 +206,7 @@ var srcImportsConfig = {
|
|
|
143
206
|
"no-restricted-imports": [
|
|
144
207
|
"error",
|
|
145
208
|
{
|
|
146
|
-
paths:
|
|
209
|
+
paths: restrictedImportPaths2,
|
|
147
210
|
patterns: restrictedSrcImportPatterns
|
|
148
211
|
}
|
|
149
212
|
]
|
|
@@ -152,19 +215,103 @@ var srcImportsConfig = {
|
|
|
152
215
|
|
|
153
216
|
// src/unicorn/index.ts
|
|
154
217
|
import unicornPlugin from "eslint-plugin-unicorn";
|
|
218
|
+
var unicornV66MigrationQueue = [
|
|
219
|
+
"unicorn/class-reference-in-static-methods",
|
|
220
|
+
"unicorn/comment-content",
|
|
221
|
+
"unicorn/consistent-export-decorator-position",
|
|
222
|
+
"unicorn/consistent-optional-chaining",
|
|
223
|
+
"unicorn/explicit-timer-delay",
|
|
224
|
+
"unicorn/no-array-reverse",
|
|
225
|
+
"unicorn/no-array-sort",
|
|
226
|
+
"unicorn/no-break-in-nested-loop",
|
|
227
|
+
"unicorn/no-computed-property-existence-check",
|
|
228
|
+
"unicorn/no-confusing-array-with",
|
|
229
|
+
"unicorn/no-declarations-before-early-exit",
|
|
230
|
+
"unicorn/no-duplicate-loops",
|
|
231
|
+
"unicorn/no-error-property-assignment",
|
|
232
|
+
"unicorn/no-for-each",
|
|
233
|
+
"unicorn/no-global-object-property-assignment",
|
|
234
|
+
"unicorn/no-incorrect-template-string-interpolation",
|
|
235
|
+
"unicorn/no-invalid-argument-count",
|
|
236
|
+
"unicorn/no-mismatched-map-key",
|
|
237
|
+
"unicorn/no-negated-array-predicate",
|
|
238
|
+
"unicorn/no-negated-comparison",
|
|
239
|
+
"unicorn/no-object-methods-with-collections",
|
|
240
|
+
"unicorn/no-optional-chaining-on-undeclared-variable",
|
|
241
|
+
"unicorn/no-redundant-comparison",
|
|
242
|
+
"unicorn/no-return-array-push",
|
|
243
|
+
"unicorn/no-subtraction-comparison",
|
|
244
|
+
"unicorn/no-top-level-side-effects",
|
|
245
|
+
"unicorn/no-undeclared-class-members",
|
|
246
|
+
"unicorn/no-unnecessary-global-this",
|
|
247
|
+
"unicorn/no-unnecessary-splice",
|
|
248
|
+
"unicorn/no-unreadable-new-expression",
|
|
249
|
+
"unicorn/no-unreadable-object-destructuring",
|
|
250
|
+
"unicorn/no-unsafe-buffer-conversion",
|
|
251
|
+
"unicorn/no-unsafe-property-key",
|
|
252
|
+
"unicorn/no-unsafe-string-replacement",
|
|
253
|
+
"unicorn/no-useless-boolean-cast",
|
|
254
|
+
"unicorn/no-useless-concat",
|
|
255
|
+
"unicorn/no-useless-else",
|
|
256
|
+
"unicorn/no-useless-recursion",
|
|
257
|
+
"unicorn/no-useless-template-literals",
|
|
258
|
+
"unicorn/prefer-add-event-listener-options",
|
|
259
|
+
"unicorn/prefer-array-from-map",
|
|
260
|
+
"unicorn/prefer-await",
|
|
261
|
+
"unicorn/prefer-direct-iteration",
|
|
262
|
+
"unicorn/prefer-early-return",
|
|
263
|
+
"unicorn/prefer-global-number-constants",
|
|
264
|
+
"unicorn/prefer-identifier-import-export-specifiers",
|
|
265
|
+
"unicorn/prefer-iterable-in-constructor",
|
|
266
|
+
"unicorn/prefer-iterator-to-array",
|
|
267
|
+
"unicorn/prefer-location-assign",
|
|
268
|
+
"unicorn/prefer-minimal-ternary",
|
|
269
|
+
"unicorn/prefer-number-coercion",
|
|
270
|
+
"unicorn/prefer-number-is-safe-integer",
|
|
271
|
+
"unicorn/prefer-object-define-properties",
|
|
272
|
+
"unicorn/prefer-object-destructuring-defaults",
|
|
273
|
+
"unicorn/prefer-object-iterable-methods",
|
|
274
|
+
"unicorn/prefer-path2d",
|
|
275
|
+
"unicorn/prefer-private-class-fields",
|
|
276
|
+
"unicorn/prefer-scoped-selector",
|
|
277
|
+
"unicorn/prefer-short-arrow-method",
|
|
278
|
+
"unicorn/prefer-simple-sort-comparator",
|
|
279
|
+
"unicorn/prefer-single-array-predicate",
|
|
280
|
+
"unicorn/prefer-single-object-destructuring",
|
|
281
|
+
"unicorn/prefer-smaller-scope",
|
|
282
|
+
"unicorn/prefer-type-literal-last",
|
|
283
|
+
"unicorn/prefer-uint8array-base64",
|
|
284
|
+
"unicorn/prefer-unicode-code-point-escapes",
|
|
285
|
+
"unicorn/prefer-url-href",
|
|
286
|
+
"unicorn/require-array-sort-compare",
|
|
287
|
+
"unicorn/require-proxy-trap-boolean-return"
|
|
288
|
+
];
|
|
289
|
+
var unicornV66NewRules = unicornV66MigrationQueue;
|
|
155
290
|
var unicornConfig = {
|
|
156
291
|
...unicornPlugin.configs.recommended,
|
|
157
292
|
plugins: { unicorn: unicornPlugin },
|
|
158
293
|
rules: {
|
|
159
294
|
...unicornPlugin.configs.recommended.rules,
|
|
295
|
+
...Object.fromEntries(unicornV66MigrationQueue.map((rule) => [rule, "warn"])),
|
|
296
|
+
// Owned by @typescript-eslint/member-ordering
|
|
297
|
+
"unicorn/consistent-class-member-order": ["off"],
|
|
298
|
+
// Owned by max-nested-callbacks
|
|
299
|
+
"unicorn/max-nested-calls": ["off"],
|
|
300
|
+
// Naming preference — too disruptive for org-wide enforcement
|
|
160
301
|
"unicorn/catch-error-name": ["off"],
|
|
302
|
+
// Closure patterns are valid in our codebase
|
|
161
303
|
"unicorn/consistent-function-scoping": ["off"],
|
|
304
|
+
// Tier 3 opinionated — enabled in opinionatedConfig
|
|
162
305
|
"unicorn/filename-case": ["off"],
|
|
163
306
|
"unicorn/new-for-builtins": ["off"],
|
|
164
307
|
"unicorn/no-array-callback-reference": ["off"],
|
|
308
|
+
// Tier 3 opinionated — enabled in opinionatedConfig
|
|
165
309
|
"unicorn/no-await-expression-member": ["off"],
|
|
310
|
+
// Owned by unicorn/no-unnecessary-nested-ternary
|
|
166
311
|
"unicorn/no-nested-ternary": ["off"],
|
|
312
|
+
// Org uses null alongside undefined
|
|
167
313
|
"unicorn/no-null": ["off"],
|
|
314
|
+
// Formatting — candidate for stylistic tier; overlaps @stylistic formatting
|
|
168
315
|
"unicorn/number-literal-case": ["off"],
|
|
169
316
|
"unicorn/prefer-module": ["off"],
|
|
170
317
|
"unicorn/prefer-top-level-await": ["off"],
|
|
@@ -180,19 +327,27 @@ var workspacesConfig = {
|
|
|
180
327
|
plugins: { workspaces: workspacesPlugin },
|
|
181
328
|
rules: {
|
|
182
329
|
...workspacesPlugin.configs.recommended.rules,
|
|
330
|
+
// Tier 3 opinionated — enabled in opinionatedConfig
|
|
183
331
|
"workspaces/no-relative-imports": ["off"],
|
|
184
332
|
"workspaces/require-dependency": ["off"]
|
|
185
333
|
}
|
|
186
334
|
};
|
|
187
335
|
|
|
188
336
|
// src/core/index.ts
|
|
189
|
-
var
|
|
337
|
+
var correctnessCoreConfig = [
|
|
190
338
|
scopeConfig(js.configs.recommended, { files: scriptFiles, languageOptions: scriptLanguageOptions }),
|
|
191
|
-
|
|
339
|
+
correctnessRulesConfig,
|
|
192
340
|
srcImportsConfig,
|
|
193
|
-
scopeConfig(unicornConfig, { files: scriptFiles }),
|
|
194
341
|
workspacesConfig
|
|
195
342
|
];
|
|
343
|
+
var bestPracticesCoreConfig = [
|
|
344
|
+
scopeConfig(unicornConfig, { files: scriptFiles })
|
|
345
|
+
];
|
|
346
|
+
var coreConfig = [
|
|
347
|
+
...correctnessCoreConfig,
|
|
348
|
+
consistencyRulesConfig,
|
|
349
|
+
...bestPracticesCoreConfig
|
|
350
|
+
];
|
|
196
351
|
|
|
197
352
|
// src/import/index.ts
|
|
198
353
|
import importPlugin from "eslint-plugin-import-x";
|
|
@@ -210,13 +365,15 @@ var importConfig = [
|
|
|
210
365
|
},
|
|
211
366
|
settings: { "import-x/resolver": { typescript: { alwaysTryTypes: true, project: "./tsconfig.json" } } },
|
|
212
367
|
rules: {
|
|
368
|
+
// Owned by simple-import-sort/imports
|
|
213
369
|
"simple-import-sort/imports": ["warn"],
|
|
214
370
|
"simple-import-sort/exports": ["warn"],
|
|
371
|
+
// Type-aware resolution is slow and requires per-repo resolver setup
|
|
215
372
|
"import-x/default": ["off"],
|
|
216
373
|
"import-x/named": ["off"],
|
|
217
374
|
"import-x/namespace": ["off"],
|
|
218
|
-
"import-x/no-absolute-path": ["warn"],
|
|
219
375
|
"import-x/no-unresolved": ["off"],
|
|
376
|
+
"import-x/no-absolute-path": ["warn"],
|
|
220
377
|
"import-x/no-cycle": [
|
|
221
378
|
"warn",
|
|
222
379
|
{ maxDepth: 5 }
|
|
@@ -231,57 +388,281 @@ var importConfig = [
|
|
|
231
388
|
}
|
|
232
389
|
];
|
|
233
390
|
|
|
234
|
-
// src/
|
|
235
|
-
import
|
|
236
|
-
var
|
|
237
|
-
|
|
238
|
-
files: ["**/*.json"],
|
|
239
|
-
plugins: { json },
|
|
240
|
-
language: "json/json",
|
|
241
|
-
rules: { "json/no-duplicate-keys": ["error"] }
|
|
242
|
-
};
|
|
243
|
-
var jsoncConfig = {
|
|
244
|
-
ignores,
|
|
245
|
-
files: ["**/*.jsonc"],
|
|
246
|
-
plugins: { json },
|
|
247
|
-
language: "json/jsonc",
|
|
248
|
-
rules: { "json/no-duplicate-keys": ["error"] }
|
|
249
|
-
};
|
|
250
|
-
var json5Config = {
|
|
391
|
+
// src/sonar/index.ts
|
|
392
|
+
import sonarjs from "eslint-plugin-sonarjs";
|
|
393
|
+
var sonarConfig = {
|
|
394
|
+
plugins: { sonarjs },
|
|
251
395
|
ignores,
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
396
|
+
rules: {
|
|
397
|
+
"sonarjs/no-small-switch": ["off"],
|
|
398
|
+
"sonarjs/os-command": ["off"],
|
|
399
|
+
"sonarjs/no-os-command-from-path": ["off"],
|
|
400
|
+
"sonarjs/no-nested-conditional": ["off"],
|
|
401
|
+
"sonarjs/todo-tag": ["off"],
|
|
402
|
+
"sonarjs/deprecation": ["warn"],
|
|
403
|
+
"sonarjs/no-nested-functions": ["off"],
|
|
404
|
+
"sonarjs/function-return-type": ["off"],
|
|
405
|
+
"sonarjs/pseudo-random": ["off"],
|
|
406
|
+
"sonarjs/public-static-readonly": ["warn"],
|
|
407
|
+
"sonarjs/post-message": ["off"],
|
|
408
|
+
"sonarjs/different-types-comparison": ["off"],
|
|
409
|
+
// Owned by simple-import-sort/imports
|
|
410
|
+
"sonarjs/no-alphabetical-sort": ["off"],
|
|
411
|
+
"sonarjs/no-identical-functions": ["warn"],
|
|
412
|
+
"sonarjs/no-empty-test-file": ["off"],
|
|
413
|
+
"sonarjs/no-dead-store": ["warn"],
|
|
414
|
+
"sonarjs/no-redundant-jump": ["warn"],
|
|
415
|
+
"sonarjs/void-use": ["off"],
|
|
416
|
+
// Owned by complexity
|
|
417
|
+
"sonarjs/cognitive-complexity": ["off"],
|
|
418
|
+
// Owned by @typescript-eslint/no-unused-vars
|
|
419
|
+
"sonarjs/unused-import": ["off"],
|
|
420
|
+
"sonarjs/no-unused-vars": ["off"],
|
|
421
|
+
"sonarjs/no-commented-code": ["off"],
|
|
422
|
+
"sonarjs/prefer-single-boolean-return": ["off"],
|
|
423
|
+
"sonarjs/redundant-type-aliases": ["off"]
|
|
424
|
+
}
|
|
256
425
|
};
|
|
257
426
|
|
|
258
|
-
// src/
|
|
259
|
-
|
|
260
|
-
|
|
427
|
+
// src/tiers/conflicts.ts
|
|
428
|
+
var RULE_OWNERSHIP_GROUPS = [
|
|
429
|
+
{
|
|
430
|
+
description: "Class member ordering with alphabetical within-group sorting",
|
|
431
|
+
owner: "@typescript-eslint/member-ordering",
|
|
432
|
+
disabled: ["unicorn/consistent-class-member-order"]
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
description: "Callback nesting depth limit",
|
|
436
|
+
owner: "max-nested-callbacks",
|
|
437
|
+
disabled: ["unicorn/max-nested-calls"]
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
description: "Spread over Function.prototype.apply",
|
|
441
|
+
owner: "unicorn/prefer-spread",
|
|
442
|
+
disabled: ["prefer-spread"]
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
description: "Semicolon style",
|
|
446
|
+
owner: "@stylistic/semi",
|
|
447
|
+
disabled: ["semi"]
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
description: "Quote style",
|
|
451
|
+
owner: "@stylistic/quotes",
|
|
452
|
+
disabled: ["quotes"]
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
description: "Unused variable detection with TypeScript support",
|
|
456
|
+
owner: "@typescript-eslint/no-unused-vars",
|
|
457
|
+
disabled: ["no-unused-vars", "sonarjs/no-unused-vars"]
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
description: "Escape sequence casing in strings and regexes",
|
|
461
|
+
owner: "unicorn/escape-case",
|
|
462
|
+
disabled: ["no-useless-escape"]
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
description: "Negated condition style",
|
|
466
|
+
owner: "unicorn/no-negated-condition",
|
|
467
|
+
disabled: ["no-negated-condition"]
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
description: "Nested ternary restrictions",
|
|
471
|
+
owner: "unicorn/no-unnecessary-nested-ternary",
|
|
472
|
+
disabled: ["no-nested-ternary", "unicorn/no-nested-ternary"]
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
description: "Cyclomatic complexity per function",
|
|
476
|
+
owner: "complexity",
|
|
477
|
+
disabled: ["sonarjs/cognitive-complexity"]
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
description: "Unused import detection",
|
|
481
|
+
owner: "@typescript-eslint/no-unused-vars",
|
|
482
|
+
disabled: ["sonarjs/unused-import"]
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
description: "Import statement ordering",
|
|
486
|
+
owner: "simple-import-sort/imports",
|
|
487
|
+
disabled: ["import-x/order", "sonarjs/no-alphabetical-sort"]
|
|
488
|
+
}
|
|
489
|
+
];
|
|
490
|
+
function isRuleEnabled(setting) {
|
|
491
|
+
if (setting === void 0) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
if (setting === "off" || setting === 0) {
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
if (Array.isArray(setting) && setting[0] === "off") {
|
|
498
|
+
return false;
|
|
499
|
+
}
|
|
500
|
+
return true;
|
|
501
|
+
}
|
|
502
|
+
function mergeConfigRules(configs) {
|
|
503
|
+
const merged = {};
|
|
504
|
+
for (const entry of configs) {
|
|
505
|
+
if (!entry.rules) {
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
Object.assign(merged, entry.rules);
|
|
509
|
+
}
|
|
510
|
+
return merged;
|
|
511
|
+
}
|
|
512
|
+
function findRuleOwnershipConflicts(rules) {
|
|
513
|
+
const conflicts = [];
|
|
514
|
+
for (const group of RULE_OWNERSHIP_GROUPS) {
|
|
515
|
+
const ownerSetting = rules[group.owner];
|
|
516
|
+
if (!isRuleEnabled(ownerSetting)) {
|
|
517
|
+
continue;
|
|
518
|
+
}
|
|
519
|
+
for (const conflictingRule of group.disabled) {
|
|
520
|
+
if (isRuleEnabled(rules[conflictingRule])) {
|
|
521
|
+
conflicts.push({
|
|
522
|
+
description: group.description,
|
|
523
|
+
owner: group.owner,
|
|
524
|
+
conflictingRule,
|
|
525
|
+
ownerSetting,
|
|
526
|
+
conflictingSetting: rules[conflictingRule]
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
return conflicts;
|
|
532
|
+
}
|
|
533
|
+
function assertNoRuleOwnershipConflicts(configs) {
|
|
534
|
+
const conflicts = findRuleOwnershipConflicts(mergeConfigRules(configs));
|
|
535
|
+
if (conflicts.length === 0) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const details = conflicts.map((conflict) => `${conflict.owner} conflicts with ${conflict.conflictingRule} (${conflict.description})`).join("\n");
|
|
539
|
+
throw new Error(`ESLint rule ownership conflicts detected:
|
|
540
|
+
${details}`);
|
|
541
|
+
}
|
|
261
542
|
|
|
262
543
|
// src/typescript/index.ts
|
|
263
544
|
import esStylistic from "@stylistic/eslint-plugin";
|
|
264
545
|
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
265
546
|
var flatConfigs = tsPlugin.configs;
|
|
266
|
-
|
|
547
|
+
var memberOrderingRule = [
|
|
548
|
+
"warn",
|
|
549
|
+
{
|
|
550
|
+
default: {
|
|
551
|
+
memberTypes: [
|
|
552
|
+
"signature",
|
|
553
|
+
"call-signature",
|
|
554
|
+
"public-static-field",
|
|
555
|
+
"protected-static-field",
|
|
556
|
+
"private-static-field",
|
|
557
|
+
"public-decorated-field",
|
|
558
|
+
"protected-decorated-field",
|
|
559
|
+
"private-decorated-field",
|
|
560
|
+
"public-instance-field",
|
|
561
|
+
"protected-instance-field",
|
|
562
|
+
"private-instance-field",
|
|
563
|
+
"public-abstract-field",
|
|
564
|
+
"protected-abstract-field",
|
|
565
|
+
"public-field",
|
|
566
|
+
"protected-field",
|
|
567
|
+
"private-field",
|
|
568
|
+
"static-field",
|
|
569
|
+
"instance-field",
|
|
570
|
+
"abstract-field",
|
|
571
|
+
"decorated-field",
|
|
572
|
+
"field",
|
|
573
|
+
"public-constructor",
|
|
574
|
+
"protected-constructor",
|
|
575
|
+
"private-constructor",
|
|
576
|
+
"constructor",
|
|
577
|
+
["public-static-get", "public-static-set"],
|
|
578
|
+
["protected-static-get", "protected-static-set"],
|
|
579
|
+
["private-static-get", "private-static-set"],
|
|
580
|
+
["public-decorated-get", "public-decorated-set"],
|
|
581
|
+
["protected-decorated-get", "protected-decorated-set"],
|
|
582
|
+
["private-decorated-get", "private-decorated-set"],
|
|
583
|
+
["public-instance-get", "public-instance-set"],
|
|
584
|
+
["protected-instance-get", "protected-instance-set"],
|
|
585
|
+
["private-instance-get", "private-instance-set"],
|
|
586
|
+
["public-abstract-get", "public-abstract-set"],
|
|
587
|
+
["protected-abstract-get", "protected-abstract-set"],
|
|
588
|
+
["public-get", "public-set"],
|
|
589
|
+
["protected-get", "protected-set"],
|
|
590
|
+
["private-get", "private-set"],
|
|
591
|
+
["static-get", "static-set"],
|
|
592
|
+
["instance-get", "instance-set"],
|
|
593
|
+
["abstract-get", "abstract-set"],
|
|
594
|
+
["decorated-get", "decorated-set"],
|
|
595
|
+
"get",
|
|
596
|
+
"set",
|
|
597
|
+
"public-static-method",
|
|
598
|
+
"protected-static-method",
|
|
599
|
+
"private-static-method",
|
|
600
|
+
"public-decorated-method",
|
|
601
|
+
"protected-decorated-method",
|
|
602
|
+
"private-decorated-method",
|
|
603
|
+
"public-instance-method",
|
|
604
|
+
"protected-instance-method",
|
|
605
|
+
"private-instance-method",
|
|
606
|
+
"public-abstract-method",
|
|
607
|
+
"protected-abstract-method",
|
|
608
|
+
"public-method",
|
|
609
|
+
"protected-method",
|
|
610
|
+
"private-method",
|
|
611
|
+
"static-method",
|
|
612
|
+
"instance-method",
|
|
613
|
+
"abstract-method",
|
|
614
|
+
"decorated-method",
|
|
615
|
+
"method"
|
|
616
|
+
],
|
|
617
|
+
order: "alphabetically"
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
];
|
|
621
|
+
function createCorrectnessOverride(languageOptions) {
|
|
622
|
+
return {
|
|
623
|
+
files: scriptFiles,
|
|
624
|
+
languageOptions,
|
|
625
|
+
rules: {
|
|
626
|
+
"@typescript-eslint/no-unused-vars": [
|
|
627
|
+
"warn",
|
|
628
|
+
{
|
|
629
|
+
argsIgnorePattern: "^_",
|
|
630
|
+
varsIgnorePattern: "^_",
|
|
631
|
+
ignoreRestSiblings: true
|
|
632
|
+
}
|
|
633
|
+
],
|
|
634
|
+
"@typescript-eslint/require-await": "off",
|
|
635
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
636
|
+
"@typescript-eslint/no-empty-object-type": ["off"],
|
|
637
|
+
"@typescript-eslint/triple-slash-reference": ["off"],
|
|
638
|
+
// Tier 3 opinionated — enabled in opinionatedConfig
|
|
639
|
+
"@typescript-eslint/strict-boolean-expressions": ["off"],
|
|
640
|
+
// Owned by @stylistic/quotes
|
|
641
|
+
"quotes": ["off"],
|
|
642
|
+
// Owned by @stylistic/semi
|
|
643
|
+
"semi": ["off"],
|
|
644
|
+
// Owned by unicorn/prefer-spread
|
|
645
|
+
"prefer-spread": ["off"],
|
|
646
|
+
"require-await": "off"
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
function createConsistencyOverride(languageOptions) {
|
|
267
651
|
return {
|
|
268
652
|
files: scriptFiles,
|
|
269
653
|
languageOptions,
|
|
270
654
|
plugins: { "@stylistic": esStylistic },
|
|
271
655
|
rules: {
|
|
272
656
|
...esStylistic.configs.recommended.rules,
|
|
273
|
-
"@typescript-eslint/no-empty-object-type": ["off"],
|
|
274
657
|
"@typescript-eslint/no-empty-function": "warn",
|
|
275
658
|
"@stylistic/eol-last": "warn",
|
|
276
659
|
"@typescript-eslint/explicit-member-accessibility": ["warn", { accessibility: "no-public" }],
|
|
277
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
278
660
|
"@stylistic/brace-style": ["warn", "1tbs", { allowSingleLine: true }],
|
|
279
661
|
"@stylistic/quotes": ["warn", "single", { avoidEscape: true }],
|
|
280
662
|
"@typescript-eslint/consistent-type-imports": ["warn", { fixStyle: "separate-type-imports", prefer: "type-imports" }],
|
|
281
663
|
"@stylistic/object-property-newline": ["warn", { allowAllPropertiesOnSameLine: true }],
|
|
282
664
|
"@stylistic/function-call-argument-newline": ["warn", "consistent"],
|
|
283
665
|
"@stylistic/function-paren-newline": ["warn", "multiline-arguments"],
|
|
284
|
-
"@typescript-eslint/triple-slash-reference": ["off"],
|
|
285
666
|
"@stylistic/member-delimiter-style": [
|
|
286
667
|
"error",
|
|
287
668
|
{
|
|
@@ -325,185 +706,332 @@ function createTypeScriptOverride(languageOptions) {
|
|
|
325
706
|
message: "Enums are disallowed. Consider using a union of string literals or a `const` object instead."
|
|
326
707
|
}
|
|
327
708
|
],
|
|
328
|
-
"@typescript-eslint/member-ordering":
|
|
329
|
-
"warn",
|
|
330
|
-
{
|
|
331
|
-
default: {
|
|
332
|
-
memberTypes: [
|
|
333
|
-
"signature",
|
|
334
|
-
"call-signature",
|
|
335
|
-
"public-static-field",
|
|
336
|
-
"protected-static-field",
|
|
337
|
-
"private-static-field",
|
|
338
|
-
"public-decorated-field",
|
|
339
|
-
"protected-decorated-field",
|
|
340
|
-
"private-decorated-field",
|
|
341
|
-
"public-instance-field",
|
|
342
|
-
"protected-instance-field",
|
|
343
|
-
"private-instance-field",
|
|
344
|
-
"public-abstract-field",
|
|
345
|
-
"protected-abstract-field",
|
|
346
|
-
"public-field",
|
|
347
|
-
"protected-field",
|
|
348
|
-
"private-field",
|
|
349
|
-
"static-field",
|
|
350
|
-
"instance-field",
|
|
351
|
-
"abstract-field",
|
|
352
|
-
"decorated-field",
|
|
353
|
-
"field",
|
|
354
|
-
"public-constructor",
|
|
355
|
-
"protected-constructor",
|
|
356
|
-
"private-constructor",
|
|
357
|
-
"constructor",
|
|
358
|
-
["public-static-get", "public-static-set"],
|
|
359
|
-
["protected-static-get", "protected-static-set"],
|
|
360
|
-
["private-static-get", "private-static-set"],
|
|
361
|
-
["public-decorated-get", "public-decorated-set"],
|
|
362
|
-
["protected-decorated-get", "protected-decorated-set"],
|
|
363
|
-
["private-decorated-get", "private-decorated-set"],
|
|
364
|
-
["public-instance-get", "public-instance-set"],
|
|
365
|
-
["protected-instance-get", "protected-instance-set"],
|
|
366
|
-
["private-instance-get", "private-instance-set"],
|
|
367
|
-
["public-abstract-get", "public-abstract-set"],
|
|
368
|
-
["protected-abstract-get", "protected-abstract-set"],
|
|
369
|
-
["public-get", "public-set"],
|
|
370
|
-
["protected-get", "protected-set"],
|
|
371
|
-
["private-get", "private-set"],
|
|
372
|
-
["static-get", "static-set"],
|
|
373
|
-
["instance-get", "instance-set"],
|
|
374
|
-
["abstract-get", "abstract-set"],
|
|
375
|
-
["decorated-get", "decorated-set"],
|
|
376
|
-
"get",
|
|
377
|
-
"set",
|
|
378
|
-
"public-static-method",
|
|
379
|
-
"protected-static-method",
|
|
380
|
-
"private-static-method",
|
|
381
|
-
"public-decorated-method",
|
|
382
|
-
"protected-decorated-method",
|
|
383
|
-
"private-decorated-method",
|
|
384
|
-
"public-instance-method",
|
|
385
|
-
"protected-instance-method",
|
|
386
|
-
"private-instance-method",
|
|
387
|
-
"public-abstract-method",
|
|
388
|
-
"protected-abstract-method",
|
|
389
|
-
"public-method",
|
|
390
|
-
"protected-method",
|
|
391
|
-
"private-method",
|
|
392
|
-
"static-method",
|
|
393
|
-
"instance-method",
|
|
394
|
-
"abstract-method",
|
|
395
|
-
"decorated-method",
|
|
396
|
-
"method"
|
|
397
|
-
],
|
|
398
|
-
order: "alphabetically"
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
],
|
|
402
|
-
"@typescript-eslint/no-unused-vars": [
|
|
403
|
-
"warn",
|
|
404
|
-
{
|
|
405
|
-
argsIgnorePattern: "^_",
|
|
406
|
-
varsIgnorePattern: "^_",
|
|
407
|
-
ignoreRestSiblings: true
|
|
408
|
-
}
|
|
409
|
-
],
|
|
410
|
-
"@typescript-eslint/require-await": "off",
|
|
411
|
-
"@typescript-eslint/strict-boolean-expressions": ["off"],
|
|
412
|
-
"quotes": ["off"],
|
|
413
|
-
"require-await": "off",
|
|
414
|
-
"semi": ["warn", "never"]
|
|
709
|
+
"@typescript-eslint/member-ordering": memberOrderingRule
|
|
415
710
|
}
|
|
416
711
|
};
|
|
417
712
|
}
|
|
418
|
-
var
|
|
713
|
+
var typescriptDelegationConfig = {
|
|
714
|
+
files: scriptFiles,
|
|
715
|
+
rules: {
|
|
716
|
+
// Owned by unicorn/prefer-spread — stylistic presets may re-enable the core rule
|
|
717
|
+
"prefer-spread": "off",
|
|
718
|
+
// Owned by @stylistic/semi
|
|
719
|
+
"semi": "off",
|
|
720
|
+
// Owned by @stylistic/quotes
|
|
721
|
+
"quotes": "off"
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
var typescriptCorrectnessConfig = [
|
|
419
725
|
...scopeConfigs(flatConfigs["flat/recommended"], { files: scriptFiles, languageOptions: scriptLanguageOptions }),
|
|
726
|
+
createCorrectnessOverride(scriptLanguageOptions)
|
|
727
|
+
];
|
|
728
|
+
var typescriptConsistencyConfig = [
|
|
420
729
|
...scopeConfigs(flatConfigs["flat/stylistic"], { files: scriptFiles, languageOptions: scriptLanguageOptions }),
|
|
421
|
-
|
|
730
|
+
createConsistencyOverride(scriptLanguageOptions)
|
|
422
731
|
];
|
|
423
|
-
var
|
|
732
|
+
var typescriptTypeCheckedCorrectnessConfig = [
|
|
424
733
|
...scopeConfigs(flatConfigs["flat/recommended-type-checked"], { files: scriptFiles, languageOptions: typeCheckedLanguageOptions }),
|
|
425
|
-
|
|
426
|
-
createTypeScriptOverride(typeCheckedLanguageOptions),
|
|
734
|
+
createCorrectnessOverride(typeCheckedLanguageOptions),
|
|
427
735
|
{
|
|
428
736
|
files: scriptFiles,
|
|
429
737
|
languageOptions: typeCheckedLanguageOptions,
|
|
430
738
|
rules: { "@typescript-eslint/no-deprecated": "warn" }
|
|
431
739
|
}
|
|
432
740
|
];
|
|
741
|
+
var typescriptTypeCheckedConsistencyConfig = [
|
|
742
|
+
...scopeConfigs(flatConfigs["flat/stylistic-type-checked"], { files: scriptFiles, languageOptions: typeCheckedLanguageOptions }),
|
|
743
|
+
createConsistencyOverride(typeCheckedLanguageOptions)
|
|
744
|
+
];
|
|
745
|
+
var typescriptConfig = [
|
|
746
|
+
...typescriptCorrectnessConfig,
|
|
747
|
+
...typescriptConsistencyConfig,
|
|
748
|
+
typescriptDelegationConfig
|
|
749
|
+
];
|
|
750
|
+
var typescriptTypeCheckedConfig = [
|
|
751
|
+
...typescriptTypeCheckedCorrectnessConfig,
|
|
752
|
+
...typescriptTypeCheckedConsistencyConfig,
|
|
753
|
+
typescriptDelegationConfig
|
|
754
|
+
];
|
|
433
755
|
|
|
434
|
-
// src/
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
plugins: { sonarjs },
|
|
438
|
-
ignores,
|
|
756
|
+
// src/tiers/opinionated.ts
|
|
757
|
+
var opinionatedLayerConfig = {
|
|
758
|
+
files: scriptFiles,
|
|
439
759
|
rules: {
|
|
440
|
-
"
|
|
441
|
-
"
|
|
442
|
-
"
|
|
443
|
-
"
|
|
444
|
-
"
|
|
445
|
-
"
|
|
446
|
-
"sonarjs/no-nested-functions": ["off"],
|
|
447
|
-
"sonarjs/function-return-type": ["off"],
|
|
448
|
-
"sonarjs/pseudo-random": ["off"],
|
|
449
|
-
"sonarjs/public-static-readonly": ["warn"],
|
|
450
|
-
"sonarjs/post-message": ["off"],
|
|
451
|
-
"sonarjs/different-types-comparison": ["off"],
|
|
452
|
-
"sonarjs/no-alphabetical-sort": ["warn"],
|
|
453
|
-
"sonarjs/no-identical-functions": ["warn"],
|
|
454
|
-
"sonarjs/no-empty-test-file": ["off"],
|
|
455
|
-
"sonarjs/no-dead-store": ["warn"],
|
|
456
|
-
"sonarjs/no-redundant-jump": ["warn"],
|
|
457
|
-
"sonarjs/void-use": ["off"],
|
|
458
|
-
// handled by eslint
|
|
459
|
-
"sonarjs/cognitive-complexity": ["off"],
|
|
460
|
-
"sonarjs/unused-import": ["off"],
|
|
461
|
-
// handled by typescript-eslint
|
|
462
|
-
"sonarjs/no-unused-vars": ["off"],
|
|
463
|
-
"sonarjs/no-commented-code": ["off"],
|
|
464
|
-
"sonarjs/prefer-single-boolean-return": ["off"],
|
|
465
|
-
"sonarjs/redundant-type-aliases": ["off"]
|
|
760
|
+
"@typescript-eslint/strict-boolean-expressions": "warn",
|
|
761
|
+
"unicorn/filename-case": ["warn", { case: "kebabCase" }],
|
|
762
|
+
"unicorn/no-await-expression-member": "warn",
|
|
763
|
+
"unicorn/number-literal-case": "warn",
|
|
764
|
+
"workspaces/no-relative-imports": "warn",
|
|
765
|
+
"workspaces/require-dependency": "warn"
|
|
466
766
|
}
|
|
467
767
|
};
|
|
768
|
+
var strictPromotionRules = {
|
|
769
|
+
"@stylistic/eol-last": "error",
|
|
770
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
771
|
+
"@typescript-eslint/no-deprecated": "error",
|
|
772
|
+
"array-element-newline": "error",
|
|
773
|
+
"import-x/no-absolute-path": "error",
|
|
774
|
+
"import-x/no-cycle": "error",
|
|
775
|
+
"import-x/no-restricted-paths": "error",
|
|
776
|
+
"import-x/no-self-import": "error",
|
|
777
|
+
"import-x/no-useless-path-segments": "error",
|
|
778
|
+
"no-restricted-syntax": "error",
|
|
779
|
+
"simple-import-sort/exports": "error",
|
|
780
|
+
"simple-import-sort/imports": "error",
|
|
781
|
+
"sonarjs/deprecation": "error",
|
|
782
|
+
"sonarjs/no-dead-store": "error",
|
|
783
|
+
"sonarjs/no-identical-functions": "error",
|
|
784
|
+
"sonarjs/no-redundant-jump": "error",
|
|
785
|
+
"sonarjs/public-static-readonly": "error",
|
|
786
|
+
"unicorn/no-useless-undefined": "error",
|
|
787
|
+
...Object.fromEntries(unicornV66MigrationQueue.map((rule) => [rule, "error"])),
|
|
788
|
+
...Object.fromEntries([
|
|
789
|
+
"@typescript-eslint/consistent-type-imports",
|
|
790
|
+
"@typescript-eslint/explicit-member-accessibility",
|
|
791
|
+
"@typescript-eslint/member-ordering",
|
|
792
|
+
"@stylistic/brace-style",
|
|
793
|
+
"@stylistic/function-call-argument-newline",
|
|
794
|
+
"@stylistic/function-paren-newline",
|
|
795
|
+
"@stylistic/object-curly-newline",
|
|
796
|
+
"@stylistic/object-property-newline",
|
|
797
|
+
"@stylistic/quotes",
|
|
798
|
+
"@stylistic/max-len",
|
|
799
|
+
"unicorn/filename-case",
|
|
800
|
+
"unicorn/no-await-expression-member",
|
|
801
|
+
"unicorn/number-literal-case",
|
|
802
|
+
"workspaces/no-relative-imports",
|
|
803
|
+
"workspaces/require-dependency",
|
|
804
|
+
"@typescript-eslint/strict-boolean-expressions"
|
|
805
|
+
].map((rule) => [rule, "error"]))
|
|
806
|
+
};
|
|
807
|
+
var strictLayerConfig = {
|
|
808
|
+
files: scriptFiles,
|
|
809
|
+
rules: strictPromotionRules
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
// src/tiers/index.ts
|
|
813
|
+
function mergeTierConfigs(...parts) {
|
|
814
|
+
return parts.flat();
|
|
815
|
+
}
|
|
816
|
+
var correctnessConfig = mergeTierConfigs(
|
|
817
|
+
markdownConfig,
|
|
818
|
+
correctnessCoreConfig,
|
|
819
|
+
typescriptCorrectnessConfig
|
|
820
|
+
);
|
|
821
|
+
var correctnessTypeCheckedConfig = mergeTierConfigs(
|
|
822
|
+
markdownConfig,
|
|
823
|
+
correctnessCoreConfig,
|
|
824
|
+
typescriptTypeCheckedCorrectnessConfig
|
|
825
|
+
);
|
|
826
|
+
var consistencyConfig = mergeTierConfigs(
|
|
827
|
+
correctnessConfig,
|
|
828
|
+
[consistencyRulesConfig],
|
|
829
|
+
typescriptConsistencyConfig,
|
|
830
|
+
[typescriptDelegationConfig]
|
|
831
|
+
);
|
|
832
|
+
var consistencyTypeCheckedConfig = mergeTierConfigs(
|
|
833
|
+
correctnessTypeCheckedConfig,
|
|
834
|
+
[consistencyRulesConfig],
|
|
835
|
+
typescriptTypeCheckedConsistencyConfig,
|
|
836
|
+
[typescriptDelegationConfig]
|
|
837
|
+
);
|
|
838
|
+
var bestPracticesConfig = mergeTierConfigs(
|
|
839
|
+
consistencyConfig,
|
|
840
|
+
bestPracticesCoreConfig,
|
|
841
|
+
importConfig
|
|
842
|
+
);
|
|
843
|
+
var bestPracticesTypeCheckedConfig = mergeTierConfigs(
|
|
844
|
+
consistencyTypeCheckedConfig,
|
|
845
|
+
bestPracticesCoreConfig,
|
|
846
|
+
importConfig
|
|
847
|
+
);
|
|
848
|
+
var opinionatedConfig = mergeTierConfigs(
|
|
849
|
+
bestPracticesConfig,
|
|
850
|
+
[opinionatedLayerConfig]
|
|
851
|
+
);
|
|
852
|
+
var opinionatedTypeCheckedConfig = mergeTierConfigs(
|
|
853
|
+
bestPracticesTypeCheckedConfig,
|
|
854
|
+
[opinionatedLayerConfig]
|
|
855
|
+
);
|
|
856
|
+
var strictConfig = mergeTierConfigs(
|
|
857
|
+
opinionatedConfig,
|
|
858
|
+
[sonarConfig, strictLayerConfig]
|
|
859
|
+
);
|
|
860
|
+
var strictTypeCheckedConfig = mergeTierConfigs(
|
|
861
|
+
opinionatedTypeCheckedConfig,
|
|
862
|
+
[sonarConfig, strictLayerConfig]
|
|
863
|
+
);
|
|
864
|
+
var recommendedConfig = bestPracticesConfig;
|
|
865
|
+
var recommendedTypeCheckedConfig = bestPracticesTypeCheckedConfig;
|
|
866
|
+
var config = bestPracticesTypeCheckedConfig;
|
|
867
|
+
|
|
868
|
+
// src/tiers/plugin-rules.ts
|
|
869
|
+
import js2 from "@eslint/js";
|
|
870
|
+
import json2 from "@eslint/json";
|
|
871
|
+
import markdown2 from "@eslint/markdown";
|
|
872
|
+
import esStylistic2 from "@stylistic/eslint-plugin";
|
|
873
|
+
import tsPlugin2 from "@typescript-eslint/eslint-plugin";
|
|
874
|
+
import importPlugin2 from "eslint-plugin-import-x";
|
|
875
|
+
import simpleImportSort2 from "eslint-plugin-simple-import-sort";
|
|
876
|
+
import sonarjs2 from "eslint-plugin-sonarjs";
|
|
877
|
+
import unicornPlugin2 from "eslint-plugin-unicorn";
|
|
878
|
+
import workspacesPlugin2 from "eslint-plugin-workspaces";
|
|
879
|
+
var compareStrings = (left, right) => left.localeCompare(right);
|
|
880
|
+
function sortedRuleNames(rules) {
|
|
881
|
+
if (!rules) {
|
|
882
|
+
return [];
|
|
883
|
+
}
|
|
884
|
+
return Object.keys(rules).toSorted(compareStrings);
|
|
885
|
+
}
|
|
886
|
+
function sortedRuleNamesFromConfigs(configs) {
|
|
887
|
+
if (!configs) {
|
|
888
|
+
return [];
|
|
889
|
+
}
|
|
890
|
+
const merged = {};
|
|
891
|
+
for (const entry of configs) {
|
|
892
|
+
if (entry.rules) {
|
|
893
|
+
Object.assign(merged, entry.rules);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return sortedRuleNames(merged);
|
|
897
|
+
}
|
|
898
|
+
function pluginRuleNames(plugin) {
|
|
899
|
+
if (!plugin.rules) {
|
|
900
|
+
return [];
|
|
901
|
+
}
|
|
902
|
+
const prefix = typeof plugin.meta?.name === "string" ? plugin.meta.name.replace(/^eslint-plugin-/, "").replace(/^@eslint\//, "") : "unknown";
|
|
903
|
+
return Object.keys(plugin.rules).toSorted(compareStrings).map((ruleName) => `${prefix}/${ruleName}`);
|
|
904
|
+
}
|
|
905
|
+
function collectPluginRuleSnapshots() {
|
|
906
|
+
const unicornRecommended = unicornPlugin2.configs["flat/recommended"];
|
|
907
|
+
const importRecommended = importPlugin2.flatConfigs.recommended;
|
|
908
|
+
const flatConfigs2 = tsPlugin2.configs;
|
|
909
|
+
const workspacesRecommended = workspacesPlugin2.configs.recommended;
|
|
910
|
+
return [
|
|
911
|
+
{
|
|
912
|
+
plugin: "@eslint/js",
|
|
913
|
+
rules: sortedRuleNames(js2.configs.recommended.rules),
|
|
914
|
+
source: "configs.recommended"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
plugin: "@eslint/json",
|
|
918
|
+
rules: pluginRuleNames(json2),
|
|
919
|
+
source: "plugin.rules"
|
|
920
|
+
},
|
|
921
|
+
{
|
|
922
|
+
plugin: "@eslint/markdown",
|
|
923
|
+
rules: sortedRuleNames(
|
|
924
|
+
markdown2.configs.recommended[0]?.rules
|
|
925
|
+
),
|
|
926
|
+
source: "configs.recommended"
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
plugin: "@stylistic/eslint-plugin",
|
|
930
|
+
rules: sortedRuleNames(esStylistic2.configs.recommended.rules),
|
|
931
|
+
source: "configs.recommended"
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
plugin: "@typescript-eslint/eslint-plugin",
|
|
935
|
+
rules: sortedRuleNamesFromConfigs(flatConfigs2["flat/recommended-type-checked"]),
|
|
936
|
+
source: "configs.flat/recommended-type-checked"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
plugin: "@typescript-eslint/eslint-plugin",
|
|
940
|
+
rules: sortedRuleNamesFromConfigs(flatConfigs2["flat/stylistic-type-checked"]),
|
|
941
|
+
source: "configs.flat/stylistic-type-checked"
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
plugin: "eslint-plugin-import-x",
|
|
945
|
+
rules: sortedRuleNames(importRecommended.rules),
|
|
946
|
+
source: "flatConfigs.recommended"
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
plugin: "eslint-plugin-import-x",
|
|
950
|
+
rules: sortedRuleNames(importPlugin2.flatConfigs.typescript.rules),
|
|
951
|
+
source: "flatConfigs.typescript"
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
plugin: "eslint-plugin-simple-import-sort",
|
|
955
|
+
rules: pluginRuleNames(simpleImportSort2),
|
|
956
|
+
source: "plugin.rules"
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
plugin: "eslint-plugin-sonarjs",
|
|
960
|
+
rules: pluginRuleNames(sonarjs2),
|
|
961
|
+
source: "plugin.rules"
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
plugin: "eslint-plugin-unicorn",
|
|
965
|
+
rules: sortedRuleNames(unicornRecommended?.rules),
|
|
966
|
+
source: "configs.flat/recommended"
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
plugin: "eslint-plugin-workspaces",
|
|
970
|
+
rules: sortedRuleNames(workspacesRecommended.rules),
|
|
971
|
+
source: "configs.recommended"
|
|
972
|
+
}
|
|
973
|
+
];
|
|
974
|
+
}
|
|
975
|
+
function serializePluginRuleSnapshots(snapshots) {
|
|
976
|
+
return `${JSON.stringify(snapshots, null, 2)}
|
|
977
|
+
`;
|
|
978
|
+
}
|
|
468
979
|
|
|
469
980
|
// src/index.ts
|
|
470
|
-
var recommendedConfig = [
|
|
471
|
-
...markdownConfig,
|
|
472
|
-
...coreConfig,
|
|
473
|
-
...typescriptConfig,
|
|
474
|
-
...importConfig
|
|
475
|
-
];
|
|
476
|
-
var recommendedTypeCheckedConfig = [
|
|
477
|
-
...markdownConfig,
|
|
478
|
-
...coreConfig,
|
|
479
|
-
...typescriptTypeCheckedConfig,
|
|
480
|
-
...importConfig
|
|
481
|
-
];
|
|
482
981
|
var docsConfig = [
|
|
483
982
|
...markdownConfig,
|
|
484
983
|
jsonConfig,
|
|
485
984
|
jsoncConfig,
|
|
486
985
|
json5Config
|
|
487
986
|
];
|
|
488
|
-
var config = recommendedTypeCheckedConfig;
|
|
489
987
|
export {
|
|
988
|
+
RULE_OWNERSHIP_GROUPS,
|
|
989
|
+
assertNoRuleOwnershipConflicts,
|
|
990
|
+
bestPracticesConfig,
|
|
991
|
+
bestPracticesCoreConfig,
|
|
992
|
+
bestPracticesTypeCheckedConfig,
|
|
993
|
+
collectPluginRuleSnapshots,
|
|
490
994
|
config,
|
|
995
|
+
consistencyConfig,
|
|
996
|
+
consistencyRulesConfig,
|
|
997
|
+
consistencyTypeCheckedConfig,
|
|
491
998
|
coreConfig,
|
|
999
|
+
correctnessConfig,
|
|
1000
|
+
correctnessCoreConfig,
|
|
1001
|
+
correctnessRulesConfig,
|
|
1002
|
+
correctnessTypeCheckedConfig,
|
|
492
1003
|
docsConfig,
|
|
1004
|
+
findRuleOwnershipConflicts,
|
|
493
1005
|
ignores,
|
|
494
1006
|
importConfig,
|
|
495
1007
|
json5Config,
|
|
496
1008
|
jsonConfig,
|
|
497
1009
|
jsoncConfig,
|
|
498
1010
|
markdownConfig,
|
|
1011
|
+
mergeConfigRules,
|
|
1012
|
+
opinionatedConfig,
|
|
1013
|
+
opinionatedLayerConfig,
|
|
1014
|
+
opinionatedTypeCheckedConfig,
|
|
499
1015
|
recommendedConfig,
|
|
500
1016
|
recommendedTypeCheckedConfig,
|
|
501
1017
|
rulesConfig,
|
|
1018
|
+
serializePluginRuleSnapshots,
|
|
502
1019
|
sonarConfig,
|
|
503
1020
|
srcImportsConfig,
|
|
1021
|
+
strictConfig,
|
|
1022
|
+
strictLayerConfig,
|
|
1023
|
+
strictPromotionRules,
|
|
1024
|
+
strictTypeCheckedConfig,
|
|
504
1025
|
typescriptConfig,
|
|
1026
|
+
typescriptConsistencyConfig,
|
|
1027
|
+
typescriptCorrectnessConfig,
|
|
1028
|
+
typescriptDelegationConfig,
|
|
505
1029
|
typescriptTypeCheckedConfig,
|
|
1030
|
+
typescriptTypeCheckedConsistencyConfig,
|
|
1031
|
+
typescriptTypeCheckedCorrectnessConfig,
|
|
506
1032
|
unicornConfig,
|
|
1033
|
+
unicornV66MigrationQueue,
|
|
1034
|
+
unicornV66NewRules,
|
|
507
1035
|
workspacesConfig
|
|
508
1036
|
};
|
|
509
1037
|
//# sourceMappingURL=index.mjs.map
|