@bastidood/eslint-config 0.4.0 → 0.6.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.
@@ -1,478 +1,4 @@
1
- // ../oxlint/src/core.ts
2
- /** ESLint core, `import`, `oxc`, and type-aware `typescript` rules. Rules that the TypeScript compiler already reports are off. */
3
- const CORE = {
4
- config: {
5
- plugins: [
6
- "import",
7
- "oxc",
8
- "typescript"
9
- ],
10
- jsPlugins: [{
11
- name: "eslint-js",
12
- specifier: "oxlint-plugin-eslint"
13
- }, {
14
- name: "slopstopper",
15
- specifier: "@bastidood/eslint-plugin-slopstopper"
16
- }],
17
- categories: {
18
- correctness: "error",
19
- perf: "error",
20
- suspicious: "error"
21
- },
22
- options: {
23
- denyWarnings: true,
24
- typeAware: true
25
- },
26
- overrides: [{
27
- files: [
28
- "**/*.js",
29
- "**/*.mjs",
30
- "**/*.cjs"
31
- ],
32
- rules: { "no-unused-vars": ["error", {
33
- argsIgnorePattern: "^_",
34
- varsIgnorePattern: "^_"
35
- }] }
36
- }],
37
- rules: {
38
- "accessor-pairs": ["error", { enforceForTSTypes: true }],
39
- "array-callback-return": ["error", { checkForEach: true }],
40
- "arrow-body-style": "error",
41
- "block-scoped-var": "error",
42
- "capitalized-comments": [
43
- "error",
44
- "always",
45
- { ignoreConsecutiveComments: true }
46
- ],
47
- "class-methods-use-this": "error",
48
- complexity: "off",
49
- "constructor-super": "off",
50
- curly: [
51
- "error",
52
- "multi-line",
53
- "consistent"
54
- ],
55
- "default-case-last": "error",
56
- "default-param-last": "error",
57
- eqeqeq: "error",
58
- "eslint-js/no-octal-escape": "error",
59
- "eslint-js/no-undef-init": "error",
60
- "eslint-js/require-atomic-updates": "error",
61
- "for-direction": "error",
62
- "func-name-matching": "off",
63
- "func-names": ["error", "as-needed"],
64
- "func-style": ["error", "declaration"],
65
- "getter-return": "off",
66
- "grouped-accessor-pairs": ["error", "getBeforeSet"],
67
- "guard-for-in": "error",
68
- "id-denylist": "off",
69
- "id-length": "off",
70
- "id-match": "off",
71
- "import/consistent-type-specifier-style": ["error", "prefer-top-level-if-only-type-imports"],
72
- "import/default": "off",
73
- "import/exports-last": "off",
74
- "import/first": "error",
75
- "import/group-exports": "off",
76
- "import/max-dependencies": "off",
77
- "import/namespace": "off",
78
- "import/newline-after-import": "error",
79
- "import/no-absolute-path": "error",
80
- "import/no-amd": "error",
81
- "import/no-anonymous-default-export": "error",
82
- "import/no-commonjs": "error",
83
- "import/no-cycle": "error",
84
- "import/no-default-export": "off",
85
- "import/no-dynamic-require": "error",
86
- "import/no-empty-named-blocks": "error",
87
- "import/no-mutable-exports": "error",
88
- "import/no-named-as-default": "error",
89
- "import/no-named-as-default-member": "error",
90
- "import/no-named-default": "error",
91
- "import/no-named-export": "off",
92
- "import/no-namespace": "off",
93
- "import/no-nodejs-modules": "off",
94
- "import/no-self-import": "error",
95
- "import/no-unassigned-import": "off",
96
- "import/no-webpack-loader-syntax": "error",
97
- "import/prefer-default-export": "off",
98
- "init-declarations": "off",
99
- "logical-assignment-operators": "error",
100
- "max-classes-per-file": "off",
101
- "max-lines": "off",
102
- "max-lines-per-function": "off",
103
- "max-nested-callbacks": "off",
104
- "max-params": "off",
105
- "max-statements": "off",
106
- "new-cap": "error",
107
- "no-alert": "error",
108
- "no-array-constructor": "error",
109
- "no-async-promise-executor": "error",
110
- "no-await-in-loop": "error",
111
- "no-bitwise": "error",
112
- "no-caller": "error",
113
- "no-case-declarations": "error",
114
- "no-class-assign": "off",
115
- "no-compare-neg-zero": "error",
116
- "no-cond-assign": "error",
117
- "no-console": "error",
118
- "no-const-assign": "off",
119
- "no-constant-binary-expression": "error",
120
- "no-constant-condition": ["error", { checkLoops: "allExceptWhileTrue" }],
121
- "no-constructor-return": "error",
122
- "no-continue": "off",
123
- "no-control-regex": "error",
124
- "no-debugger": "error",
125
- "no-delete-var": "off",
126
- "no-div-regex": "error",
127
- "no-dupe-class-members": "off",
128
- "no-dupe-else-if": "error",
129
- "no-dupe-keys": "off",
130
- "no-duplicate-case": "error",
131
- "no-duplicate-imports": "error",
132
- "no-else-return": "error",
133
- "no-empty": "error",
134
- "no-empty-character-class": "error",
135
- "no-empty-function": "error",
136
- "no-empty-pattern": "error",
137
- "no-empty-static-block": "error",
138
- "no-eq-null": "error",
139
- "no-eval": "error",
140
- "no-ex-assign": "error",
141
- "no-extend-native": "error",
142
- "no-extra-bind": "error",
143
- "no-extra-boolean-cast": "error",
144
- "no-extra-label": "error",
145
- "no-fallthrough": "error",
146
- "no-func-assign": "off",
147
- "no-global-assign": "error",
148
- "no-implicit-coercion": "error",
149
- "no-implicit-globals": "error",
150
- "no-implied-eval": "off",
151
- "no-import-assign": "off",
152
- "no-inline-comments": "off",
153
- "no-inner-declarations": "off",
154
- "no-invalid-regexp": "error",
155
- "no-irregular-whitespace": "error",
156
- "no-iterator": "error",
157
- "no-label-var": "error",
158
- "no-labels": "error",
159
- "no-lone-blocks": "error",
160
- "no-lonely-if": "error",
161
- "no-loop-func": "error",
162
- "no-loss-of-precision": "error",
163
- "no-magic-numbers": "off",
164
- "no-misleading-character-class": "error",
165
- "no-multi-assign": "error",
166
- "no-multi-str": "error",
167
- "no-negated-condition": "error",
168
- "no-nested-ternary": "error",
169
- "no-new": "error",
170
- "no-new-func": "error",
171
- "no-new-native-nonconstructor": "off",
172
- "no-new-wrappers": "error",
173
- "no-nonoctal-decimal-escape": "error",
174
- "no-obj-calls": "off",
175
- "no-object-constructor": "error",
176
- "no-param-reassign": "error",
177
- "no-plusplus": "off",
178
- "no-promise-executor-return": "error",
179
- "no-proto": "error",
180
- "no-prototype-builtins": "error",
181
- "no-regex-spaces": "error",
182
- "no-restricted-exports": "off",
183
- "no-return-assign": "error",
184
- "no-script-url": "error",
185
- "no-self-assign": "error",
186
- "no-self-compare": "error",
187
- "no-sequences": "error",
188
- "no-setter-return": "off",
189
- "no-shadow": "off",
190
- "no-shadow-restricted-names": "error",
191
- "no-sparse-arrays": "error",
192
- "no-template-curly-in-string": "error",
193
- "no-ternary": "off",
194
- "no-this-before-super": "off",
195
- "no-unassigned-vars": "error",
196
- "no-underscore-dangle": ["error", {
197
- enforceInMethodNames: true,
198
- enforceInClassFields: true
199
- }],
200
- "no-unexpected-multiline": "error",
201
- "no-unmodified-loop-condition": "error",
202
- "no-unneeded-ternary": "error",
203
- "no-unreachable": "off",
204
- "no-unreachable-loop": "error",
205
- "no-unsafe-finally": "error",
206
- "no-unsafe-negation": "off",
207
- "no-unsafe-optional-chaining": "off",
208
- "no-unused-expressions": "error",
209
- "no-unused-labels": "off",
210
- "no-unused-private-class-members": "off",
211
- "no-unused-vars": "off",
212
- "no-use-before-define": "off",
213
- "no-useless-assignment": "error",
214
- "no-useless-backreference": "error",
215
- "no-useless-call": "error",
216
- "no-useless-catch": "error",
217
- "no-useless-computed-key": "error",
218
- "no-useless-concat": "error",
219
- "no-useless-constructor": "error",
220
- "no-useless-escape": "error",
221
- "no-useless-rename": "error",
222
- "no-useless-return": "error",
223
- "no-var": "error",
224
- "no-void": "off",
225
- "no-warning-comments": "off",
226
- "no-with": "off",
227
- "object-shorthand": [
228
- "error",
229
- "always",
230
- { avoidExplicitReturnArrows: true }
231
- ],
232
- "one-var": ["error", "never"],
233
- "operator-assignment": "error",
234
- "oxc/approx-constant": "error",
235
- "oxc/bad-array-method-on-arguments": "error",
236
- "oxc/bad-bitwise-operator": "error",
237
- "oxc/bad-char-at-comparison": "error",
238
- "oxc/bad-comparison-sequence": "error",
239
- "oxc/bad-match-all-arg": "error",
240
- "oxc/bad-min-max-func": "error",
241
- "oxc/bad-object-literal-comparison": "error",
242
- "oxc/bad-replace-all-arg": "error",
243
- "oxc/branches-sharing-code": "error",
244
- "oxc/const-comparisons": "error",
245
- "oxc/double-comparisons": "error",
246
- "oxc/erasing-op": "error",
247
- "oxc/misrefactored-assign-op": "error",
248
- "oxc/missing-throw": "error",
249
- "oxc/no-accumulating-spread": "error",
250
- "oxc/no-async-endpoint-handlers": "off",
251
- "oxc/no-barrel-file": ["error", { threshold: 0 }],
252
- "oxc/no-const-enum": "error",
253
- "oxc/no-map-spread": ["error", {
254
- ignoreArgs: false,
255
- ignoreRereads: false
256
- }],
257
- "oxc/no-this-in-exported-function": "off",
258
- "oxc/number-arg-out-of-range": "error",
259
- "oxc/only-used-in-recursion": "error",
260
- "oxc/uninvoked-array-callback": "error",
261
- "prefer-arrow-callback": "error",
262
- "prefer-const": "error",
263
- "prefer-destructuring": "error",
264
- "prefer-exponentiation-operator": "error",
265
- "prefer-named-capture-group": "error",
266
- "prefer-numeric-literals": "error",
267
- "prefer-object-has-own": "error",
268
- "prefer-object-spread": "error",
269
- "prefer-regex-literals": "error",
270
- "prefer-rest-params": "error",
271
- "prefer-spread": "error",
272
- "prefer-template": "error",
273
- "preserve-caught-error": "error",
274
- radix: "error",
275
- "require-unicode-regexp": "error",
276
- "require-yield": "error",
277
- "slopstopper/destructure-on-sight": "error",
278
- "slopstopper/handle-or-rethrow": "error",
279
- "slopstopper/merge-exclusive-branches": "error",
280
- "slopstopper/needless-type-intersection": "error",
281
- "slopstopper/no-alias-object-type": "error",
282
- "slopstopper/no-array-filter-map": "error",
283
- "slopstopper/no-conditional-empty-object-spread": "error",
284
- "slopstopper/no-equality-chain": "error",
285
- "slopstopper/no-inferrable-return-type": "error",
286
- "slopstopper/no-known-value-widening": "error",
287
- "slopstopper/no-multiple-optional-parameters": "error",
288
- "slopstopper/no-negated-group": "error",
289
- "slopstopper/no-negated-quantifier-callback": "error",
290
- "slopstopper/no-plain-template-literal": "error",
291
- "slopstopper/no-positional-scalars": "error",
292
- "slopstopper/no-private-modifier": "error",
293
- "slopstopper/no-reduce-accumulator-copy": "error",
294
- "slopstopper/no-temporary-access": "error",
295
- "slopstopper/no-type-predicates": "error",
296
- "slopstopper/no-unknown-returns": "error",
297
- "slopstopper/no-unknown-type-aliases": "error",
298
- "slopstopper/no-unsafe-dictionary-type": "error",
299
- "slopstopper/no-untyped-empty-initializer": "error",
300
- "slopstopper/prefer-class-over-factory": "error",
301
- "slopstopper/prefer-de-morgan": "error",
302
- "slopstopper/prefer-prefix-increment": "error",
303
- "slopstopper/prefer-switch": "error",
304
- "slopstopper/prefer-typeof-undefined": "error",
305
- "slopstopper/prefer-while-true": "error",
306
- "slopstopper/stepdown-order": "error",
307
- "sort-keys": "off",
308
- "symbol-description": "error",
309
- "typescript/adjacent-overload-signatures": "error",
310
- "typescript/array-type": "error",
311
- "typescript/await-thenable": "error",
312
- "typescript/ban-ts-comment": ["error", { minimumDescriptionLength: 10 }],
313
- "typescript/ban-tslint-comment": "error",
314
- "typescript/class-literal-property-style": "error",
315
- "typescript/consistent-generic-constructors": "error",
316
- "typescript/consistent-indexed-object-style": "error",
317
- "typescript/consistent-return": "off",
318
- "typescript/consistent-type-assertions": "error",
319
- "typescript/consistent-type-definitions": ["error", "interface"],
320
- "typescript/dot-notation": "error",
321
- "typescript/explicit-member-accessibility": ["error", { accessibility: "no-public" }],
322
- "typescript/init-declarations": "off",
323
- "typescript/method-signature-style": "error",
324
- "typescript/no-array-delete": "error",
325
- "typescript/no-base-to-string": ["error", {
326
- checkUnknown: true,
327
- ignoredTypeNames: []
328
- }],
329
- "typescript/no-confusing-non-null-assertion": "error",
330
- "typescript/no-confusing-void-expression": "off",
331
- "typescript/no-deprecated": "error",
332
- "typescript/no-duplicate-enum-values": "error",
333
- "typescript/no-duplicate-type-constituents": "error",
334
- "typescript/no-dynamic-delete": "error",
335
- "typescript/no-empty-object-type": "error",
336
- "typescript/no-explicit-any": "error",
337
- "typescript/no-extra-non-null-assertion": "error",
338
- "typescript/no-extraneous-class": "error",
339
- "typescript/no-floating-promises": ["error", { ignoreVoid: false }],
340
- "typescript/no-for-in-array": "error",
341
- "typescript/no-generated-empty-object-type": "error",
342
- "typescript/no-implied-eval": "error",
343
- "typescript/no-import-type-side-effects": "error",
344
- "typescript/no-inferrable-types": "error",
345
- "typescript/no-invalid-void-type": "error",
346
- "typescript/no-meaningless-void-operator": "error",
347
- "typescript/no-misused-new": "error",
348
- "typescript/no-misused-promises": "error",
349
- "typescript/no-misused-spread": "error",
350
- "typescript/no-mixed-enums": "error",
351
- "typescript/no-namespace": "error",
352
- "typescript/no-non-null-asserted-nullish-coalescing": "error",
353
- "typescript/no-non-null-asserted-optional-chain": "error",
354
- "typescript/no-non-null-assertion": "error",
355
- "typescript/no-redundant-type-constituents": "error",
356
- "typescript/no-require-imports": "error",
357
- "typescript/no-restricted-types": ["error", { types: {
358
- object: "Use a precise `interface` contract instead of `object`; accept `unknown` only at an untrusted boundary and parse it into a trusted type there.",
359
- "Record<string, unknown>": "Do not use `Record<string, unknown>`: it is a variant of `any`. Declare a precise `interface`, or accept `unknown` only at an untrusted boundary and parse it into a trusted type there."
360
- } }],
361
- "typescript/no-this-alias": "error",
362
- "typescript/no-unnecessary-boolean-literal-compare": "error",
363
- "typescript/no-unnecessary-condition": ["error", { allowConstantLoopConditions: true }],
364
- "typescript/no-unnecessary-parameter-property-assignment": "off",
365
- "typescript/no-unnecessary-template-expression": "error",
366
- "typescript/no-unnecessary-type-arguments": "error",
367
- "typescript/no-unnecessary-type-assertion": "error",
368
- "typescript/no-unnecessary-type-constraint": "error",
369
- "typescript/no-unnecessary-type-conversion": "error",
370
- "typescript/no-unnecessary-type-parameters": "error",
371
- "typescript/no-unsafe-argument": "error",
372
- "typescript/no-unsafe-assignment": "error",
373
- "typescript/no-unsafe-call": "error",
374
- "typescript/no-unsafe-declaration-merging": "error",
375
- "typescript/no-unsafe-enum-assignment": "error",
376
- "typescript/no-unsafe-enum-comparison": "error",
377
- "typescript/no-unsafe-function-type": "error",
378
- "typescript/no-unsafe-member-access": "error",
379
- "typescript/no-unsafe-return": "error",
380
- "typescript/no-unsafe-type-assertion": "error",
381
- "typescript/no-unsafe-unary-minus": "error",
382
- "typescript/no-useless-default-assignment": "error",
383
- "typescript/no-useless-empty-export": "error",
384
- "typescript/no-wrapper-object-types": "error",
385
- "typescript/non-nullable-type-assertion-style": "error",
386
- "typescript/only-throw-error": "error",
387
- "typescript/parameter-properties": ["error", { prefer: "class-property" }],
388
- "typescript/prefer-as-const": "error",
389
- "typescript/prefer-enum-initializers": "off",
390
- "typescript/prefer-find": "error",
391
- "typescript/prefer-for-of": "error",
392
- "typescript/prefer-function-type": "error",
393
- "typescript/prefer-includes": "error",
394
- "typescript/prefer-literal-enum-member": "error",
395
- "typescript/prefer-namespace-keyword": "error",
396
- "typescript/prefer-nullish-coalescing": ["error", { ignorePrimitives: { string: true } }],
397
- "typescript/prefer-optional-chain": "error",
398
- "typescript/prefer-promise-reject-errors": "error",
399
- "typescript/prefer-readonly": "error",
400
- "typescript/prefer-reduce-type-parameter": "error",
401
- "typescript/prefer-regexp-exec": "error",
402
- "typescript/prefer-return-this-type": "error",
403
- "typescript/prefer-string-starts-ends-with": "error",
404
- "typescript/promise-function-async": "error",
405
- "typescript/related-getter-setter-pairs": "error",
406
- "typescript/require-array-sort-compare": "error",
407
- "typescript/require-await": "error",
408
- "typescript/restrict-plus-operands": ["error", {
409
- allowAny: false,
410
- allowBoolean: false,
411
- allowNullish: false,
412
- allowNumberAndString: false,
413
- allowRegExp: false
414
- }],
415
- "typescript/restrict-template-expressions": ["error", {
416
- allow: [],
417
- allowAny: false,
418
- allowBoolean: true,
419
- allowNever: false,
420
- allowNullish: false,
421
- allowNumber: true,
422
- allowRegExp: false
423
- }],
424
- "typescript/return-await": ["error", "always"],
425
- "typescript/strict-boolean-expressions": ["error", {
426
- allowNullableObject: false,
427
- allowNullableNumber: false,
428
- allowNullableString: false,
429
- allowNumber: false,
430
- allowString: false
431
- }],
432
- "typescript/strict-void-return": "error",
433
- "typescript/switch-exhaustiveness-check": ["error", {
434
- allowDefaultCaseForExhaustiveSwitch: false,
435
- considerDefaultExhaustiveForUnions: false,
436
- requireDefaultForNonUnion: false
437
- }],
438
- "typescript/triple-slash-reference": "error",
439
- "typescript/unbound-method": "error",
440
- "typescript/unified-signatures": "error",
441
- "typescript/use-unknown-in-catch-callback-variable": "error",
442
- "unicode-bom": "off",
443
- "use-isnan": "off",
444
- "valid-typeof": "off",
445
- yoda: [
446
- "error",
447
- "never",
448
- { exceptRange: true }
449
- ]
450
- }
451
- },
452
- restrictions: {
453
- importPatterns: [{
454
- regex: String.raw`(^|/)\.\.(?:/|$)`,
455
- message: "Import through a path alias or package subpath import instead of a parent-relative path (`../`)."
456
- }],
457
- globals: [{
458
- name: "Reflect",
459
- message: "Call typed functions and read typed properties directly instead of through `Reflect`, and parse dynamic input into a domain type first. Suppress this diagnostic with a reason only where a typed access is impossible."
460
- }, {
461
- name: "undefined",
462
- message: "Omit absent values instead of writing `undefined`: add the property in an `if` after declaring the object (as `exactOptionalPropertyTypes` requires) or leave out the argument, and use a `typeof` check to test for absence. Pass `void 0` only to a parameter that cannot be omitted and is explicitly typed to accept `undefined`."
463
- }],
464
- properties: [{
465
- object: "process",
466
- property: "env",
467
- message: "Read environment variables only in the entry point: validate them there and pass the values as explicit parameters. Opt the entry point out with a file-level disable comment."
468
- }],
469
- syntax: [{
470
- selector: "UnaryExpression[operator=\"void\"][argument.type=\"Literal\"]:not(:matches(CallExpression, NewExpression) > UnaryExpression.arguments)",
471
- message: "Do not write `void 0` to produce `undefined`: omit the absent value by conditionally inserting the property (as `exactOptionalPropertyTypes` requires). `void 0` is allowed only as an argument to a parameter that cannot be omitted and is explicitly typed to accept `undefined`."
472
- }]
473
- }
474
- };
475
- // ../../node_modules/.pnpm/eslint-plugin-oxlint@1.90.0_oxlint@1.90.0_oxlint-tsgolint@7.0.2005_/node_modules/eslint-plugin-oxlint/dist/generated/rules-by-category.mjs
1
+ // ../../node_modules/.pnpm/eslint-plugin-oxlint@1.92.0_oxlint@1.92.0_oxlint-tsgolint@7.0.2006_/node_modules/eslint-plugin-oxlint/dist/rules-by-category-BNcZTGK2.mjs
476
2
  const pedanticRules = {
477
3
  "accessor-pairs": "off",
478
4
  "array-callback-return": "off",
@@ -910,6 +436,7 @@ const suspiciousRules = {
910
436
  "react/style-prop-object": "off",
911
437
  "@typescript-eslint/no-confusing-non-null-assertion": "off",
912
438
  "@typescript-eslint/no-extraneous-class": "off",
439
+ "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "off",
913
440
  "@typescript-eslint/no-unnecessary-type-constraint": "off",
914
441
  "unicorn/consistent-function-scoping": "off",
915
442
  "unicorn/no-accessor-recursion": "off",
@@ -918,6 +445,7 @@ const suspiciousRules = {
918
445
  "unicorn/no-array-sort": "off",
919
446
  "unicorn/no-confusing-array-with": "off",
920
447
  "unicorn/no-instanceof-builtins": "off",
448
+ "unicorn/no-useless-error-capture-stack-trace": "off",
921
449
  "unicorn/prefer-add-event-listener": "off",
922
450
  "unicorn/require-module-specifiers": "off",
923
451
  "unicorn/require-post-message-target-origin": "off",
@@ -1004,7 +532,6 @@ const restrictionRules = {
1004
532
  "@typescript-eslint/no-import-type-side-effects": "off",
1005
533
  "@typescript-eslint/no-invalid-void-type": "off",
1006
534
  "@typescript-eslint/no-namespace": "off",
1007
- "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "off",
1008
535
  "@typescript-eslint/no-non-null-assertion": "off",
1009
536
  "@typescript-eslint/no-require-imports": "off",
1010
537
  "@typescript-eslint/no-restricted-types": "off",
@@ -1019,7 +546,6 @@ const restrictionRules = {
1019
546
  "unicorn/no-length-as-slice-end": "off",
1020
547
  "unicorn/no-magic-array-flat-depth": "off",
1021
548
  "unicorn/no-process-exit": "off",
1022
- "unicorn/no-useless-error-capture-stack-trace": "off",
1023
549
  "unicorn/prefer-modern-math-apis": "off",
1024
550
  "unicorn/prefer-module": "off",
1025
551
  "unicorn/prefer-node-protocol": "off",
@@ -1395,7 +921,7 @@ const restrictionTypeAwareRules = {
1395
921
  "@typescript-eslint/promise-function-async": "off",
1396
922
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "off"
1397
923
  };
1398
- // ../../node_modules/.pnpm/eslint-plugin-oxlint@1.90.0_oxlint@1.90.0_oxlint-tsgolint@7.0.2005_/node_modules/eslint-plugin-oxlint/dist/generated/rules-by-scope.mjs
924
+ // ../../node_modules/.pnpm/eslint-plugin-oxlint@1.92.0_oxlint@1.92.0_oxlint-tsgolint@7.0.2006_/node_modules/eslint-plugin-oxlint/dist/rules-by-scope-DGVQzOOx.mjs
1399
925
  const reactHooksRules = {
1400
926
  "react-hooks/capitalized-calls": "off",
1401
927
  "react-hooks/error-boundaries": "off",
@@ -1450,7 +976,6 @@ function writeEslintRules(target, rules) {
1450
976
  if (isSupportedInEslint(eslintName)) target[eslintName] = toEslintRuleEntry(rule);
1451
977
  }
1452
978
  }
1453
- /** Translate an Oxlint rule name into the name of the same rule in ESLint and its plugins. */
1454
979
  function toEslintRuleName(name) {
1455
980
  const separator = name.indexOf("/");
1456
981
  if (separator === -1) return name;
@@ -1470,32 +995,24 @@ function toEslintRuleName(name) {
1470
995
  function toEslintRuleEntry(rule) {
1471
996
  return Array.isArray(rule) ? [toEslintSeverity(rule[0]), ...rule.values().drop(1)] : toEslintSeverity(rule);
1472
997
  }
1473
- const CATEGORY_INDEX = indexCategories();
1474
- /** Index the published category lists once: category, then ESLint namespace, then rule names. */
1475
- function indexCategories() {
1476
- const sources = [
1477
- ["correctness", [correctnessRules, correctnessTypeAwareRules]],
1478
- ["nursery", [nurseryRules, nurseryTypeAwareRules]],
1479
- ["pedantic", [pedanticRules, pedanticTypeAwareRules]],
1480
- ["perf", [perfRules]],
1481
- ["restriction", [restrictionRules, restrictionTypeAwareRules]],
1482
- ["style", [styleRules, styleTypeAwareRules]],
1483
- ["suspicious", [suspiciousRules, suspiciousTypeAwareRules]]
1484
- ];
1485
- const index = /* @__PURE__ */ new Map();
1486
- for (const [category, ruleSets] of sources) {
1487
- const byNamespace = /* @__PURE__ */ new Map();
1488
- for (const ruleSet of ruleSets) for (const name in ruleSet) {
1489
- if (!Object.hasOwn(ruleSet, name) || !isSupportedInEslint(name)) continue;
1490
- const namespace = namespaceOf(name);
1491
- const eslintName = renamedInEslint(name);
1492
- const names = byNamespace.get(namespace);
1493
- if (typeof names === "undefined") byNamespace.set(namespace, [eslintName]);
1494
- else names.push(eslintName);
1495
- }
1496
- index.set(category, byNamespace);
998
+ const CORRECTNESS = indexByNamespace(correctnessRules, correctnessTypeAwareRules);
999
+ const NURSERY = indexByNamespace(nurseryRules, nurseryTypeAwareRules);
1000
+ const PEDANTIC = indexByNamespace(pedanticRules, pedanticTypeAwareRules);
1001
+ const PERF = indexByNamespace(perfRules);
1002
+ const RESTRICTION = indexByNamespace(restrictionRules, restrictionTypeAwareRules);
1003
+ const STYLE = indexByNamespace(styleRules, styleTypeAwareRules);
1004
+ const SUSPICIOUS = indexByNamespace(suspiciousRules, suspiciousTypeAwareRules);
1005
+ function indexByNamespace(...ruleSets) {
1006
+ const byNamespace = /* @__PURE__ */ new Map();
1007
+ for (const ruleSet of ruleSets) for (const name in ruleSet) {
1008
+ if (!Object.hasOwn(ruleSet, name) || !isSupportedInEslint(name)) continue;
1009
+ const namespace = namespaceOf(name);
1010
+ const eslintName = renamedInEslint(name);
1011
+ const names = byNamespace.get(namespace);
1012
+ if (typeof names === "undefined") byNamespace.set(namespace, [eslintName]);
1013
+ else names.push(eslintName);
1497
1014
  }
1498
- return index;
1015
+ return byNamespace;
1499
1016
  }
1500
1017
  /**
1501
1018
  * Whether ESLint can run a rule, given its ESLint name. The conversion prunes unsupported rules: Oxlint-only rules,
@@ -1541,12 +1058,18 @@ function writeExtensionRules(target, rules, extensions) {
1541
1058
  }
1542
1059
  }
1543
1060
  /** Write the ESLint rules that the configured Oxlint categories enable for the given Oxlint plugins. */
1544
- function writeCategoryRules(target, categories, plugins) {
1545
- for (const [category, byNamespace] of CATEGORY_INDEX) {
1546
- const severity = categories[category];
1547
- if (typeof severity === "undefined") continue;
1548
- writeNamespaceRules(target, byNamespace, plugins, toEslintSeverity(severity));
1549
- }
1061
+ function writeCategoryRules(target, { correctness, nursery, pedantic, perf, restriction, style, suspicious }, plugins) {
1062
+ writeCategory(target, CORRECTNESS, correctness, plugins);
1063
+ writeCategory(target, NURSERY, nursery, plugins);
1064
+ writeCategory(target, PEDANTIC, pedantic, plugins);
1065
+ writeCategory(target, PERF, perf, plugins);
1066
+ writeCategory(target, RESTRICTION, restriction, plugins);
1067
+ writeCategory(target, STYLE, style, plugins);
1068
+ writeCategory(target, SUSPICIOUS, suspicious, plugins);
1069
+ }
1070
+ function writeCategory(target, byNamespace, severity, plugins) {
1071
+ if (typeof severity === "undefined") return;
1072
+ writeNamespaceRules(target, byNamespace, plugins, toEslintSeverity(severity));
1550
1073
  }
1551
1074
  function writeNamespaceRules(target, byNamespace, plugins, severity) {
1552
1075
  for (const plugin of plugins) {
@@ -1591,4 +1114,4 @@ function toEslintSeverity(severity) {
1591
1114
  }
1592
1115
  }
1593
1116
  }
1594
- export { CORE as i, writeEslintRules as n, writeExtensionRules as r, writeCategoryRules as t };
1117
+ export { writeEslintRules as n, writeExtensionRules as r, writeCategoryRules as t };