@oxlint/migrate 1.41.0 → 1.43.0
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 +74 -10
- package/dist/bin/oxlint-migrate.mjs +135 -23
- package/dist/src/index.d.mts +2670 -6
- package/dist/src/index.mjs +1 -1
- package/dist/{src-BNblTDrB.mjs → src-BMWXAQvA.mjs} +187 -146
- package/package.json +11 -9
|
@@ -102,7 +102,7 @@ const detectEnvironmentByGlobals = (config) => {
|
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
const transformEnvAndGlobals = (eslintConfig, targetConfig, options) => {
|
|
105
|
-
if (eslintConfig.languageOptions?.parser !== void 0 && eslintConfig.languageOptions?.parser !== null && typeof eslintConfig.languageOptions.parser === "object" && "meta" in eslintConfig.languageOptions.parser && !SUPPORTED_ESLINT_PARSERS.includes(eslintConfig.languageOptions.parser.meta?.name)) options?.reporter?.
|
|
105
|
+
if (eslintConfig.languageOptions?.parser !== void 0 && eslintConfig.languageOptions?.parser !== null && typeof eslintConfig.languageOptions.parser === "object" && "meta" in eslintConfig.languageOptions.parser && !SUPPORTED_ESLINT_PARSERS.includes(eslintConfig.languageOptions.parser.meta?.name)) options?.reporter?.addWarning("special parser detected: " + eslintConfig.languageOptions.parser.meta?.name);
|
|
106
106
|
if (eslintConfig.languageOptions?.globals !== void 0 && eslintConfig.languageOptions?.globals !== null) {
|
|
107
107
|
if (targetConfig.globals === void 0) targetConfig.globals = {};
|
|
108
108
|
if (options?.merge) {
|
|
@@ -176,7 +176,8 @@ var rules_exports = /* @__PURE__ */ __exportAll({
|
|
|
176
176
|
perfRules: () => perfRules,
|
|
177
177
|
restrictionRules: () => restrictionRules,
|
|
178
178
|
styleRules: () => styleRules,
|
|
179
|
-
suspiciousRules: () => suspiciousRules
|
|
179
|
+
suspiciousRules: () => suspiciousRules,
|
|
180
|
+
typeAwareRules: () => typeAwareRules
|
|
180
181
|
});
|
|
181
182
|
const pedanticRules = [
|
|
182
183
|
"accessor-pairs",
|
|
@@ -184,21 +185,21 @@ const pedanticRules = [
|
|
|
184
185
|
"eqeqeq",
|
|
185
186
|
"max-classes-per-file",
|
|
186
187
|
"max-depth",
|
|
187
|
-
"max-lines-per-function",
|
|
188
188
|
"max-lines",
|
|
189
|
+
"max-lines-per-function",
|
|
189
190
|
"max-nested-callbacks",
|
|
190
|
-
"no-inline-comments",
|
|
191
|
-
"no-loop-func",
|
|
192
191
|
"no-array-constructor",
|
|
193
192
|
"no-case-declarations",
|
|
194
|
-
"no-lonely-if",
|
|
195
|
-
"no-object-constructor",
|
|
196
193
|
"no-constructor-return",
|
|
197
194
|
"no-else-return",
|
|
198
195
|
"no-fallthrough",
|
|
196
|
+
"no-inline-comments",
|
|
199
197
|
"no-inner-declarations",
|
|
198
|
+
"no-lonely-if",
|
|
199
|
+
"no-loop-func",
|
|
200
200
|
"no-negated-condition",
|
|
201
201
|
"no-new-wrappers",
|
|
202
|
+
"no-object-constructor",
|
|
202
203
|
"no-promise-executor-return",
|
|
203
204
|
"no-prototype-builtins",
|
|
204
205
|
"no-redeclare",
|
|
@@ -220,15 +221,16 @@ const pedanticRules = [
|
|
|
220
221
|
"jsdoc/require-returns-description",
|
|
221
222
|
"jsdoc/require-returns-type",
|
|
222
223
|
"react/checked-requires-onchange-or-readonly",
|
|
224
|
+
"react/display-name",
|
|
223
225
|
"react/jsx-no-target-blank",
|
|
224
226
|
"react/jsx-no-useless-fragment",
|
|
225
227
|
"react/no-unescaped-entities",
|
|
226
228
|
"react-hooks/rules-of-hooks",
|
|
227
229
|
"@typescript-eslint/ban-ts-comment",
|
|
228
230
|
"@typescript-eslint/ban-types",
|
|
229
|
-
"@typescript-eslint/no-misused-promises",
|
|
230
231
|
"@typescript-eslint/no-confusing-void-expression",
|
|
231
232
|
"@typescript-eslint/no-deprecated",
|
|
233
|
+
"@typescript-eslint/no-misused-promises",
|
|
232
234
|
"@typescript-eslint/no-mixed-enums",
|
|
233
235
|
"@typescript-eslint/no-unsafe-argument",
|
|
234
236
|
"@typescript-eslint/no-unsafe-assignment",
|
|
@@ -253,12 +255,9 @@ const pedanticRules = [
|
|
|
253
255
|
"unicorn/escape-case",
|
|
254
256
|
"unicorn/explicit-length-check",
|
|
255
257
|
"unicorn/new-for-builtins",
|
|
256
|
-
"unicorn/no-immediate-mutation",
|
|
257
|
-
"unicorn/no-unnecessary-array-splice-count",
|
|
258
258
|
"unicorn/no-array-callback-reference",
|
|
259
|
-
"unicorn/no-unnecessary-array-flat-depth",
|
|
260
|
-
"unicorn/no-unnecessary-slice-end",
|
|
261
259
|
"unicorn/no-hex-escape",
|
|
260
|
+
"unicorn/no-immediate-mutation",
|
|
262
261
|
"unicorn/no-instanceof-array",
|
|
263
262
|
"unicorn/no-lonely-if",
|
|
264
263
|
"unicorn/no-negation-in-equality-check",
|
|
@@ -267,14 +266,16 @@ const pedanticRules = [
|
|
|
267
266
|
"unicorn/no-static-only-class",
|
|
268
267
|
"unicorn/no-this-assignment",
|
|
269
268
|
"unicorn/no-typeof-undefined",
|
|
269
|
+
"unicorn/no-unnecessary-array-flat-depth",
|
|
270
|
+
"unicorn/no-unnecessary-array-splice-count",
|
|
271
|
+
"unicorn/no-unnecessary-slice-end",
|
|
270
272
|
"unicorn/no-unreadable-iife",
|
|
271
273
|
"unicorn/no-useless-promise-resolve-reject",
|
|
272
274
|
"unicorn/no-useless-switch-case",
|
|
273
275
|
"unicorn/no-useless-undefined",
|
|
274
|
-
"unicorn/prefer-top-level-await",
|
|
275
|
-
"unicorn/prefer-at",
|
|
276
276
|
"unicorn/prefer-array-flat",
|
|
277
277
|
"unicorn/prefer-array-some",
|
|
278
|
+
"unicorn/prefer-at",
|
|
278
279
|
"unicorn/prefer-blob-reading-methods",
|
|
279
280
|
"unicorn/prefer-code-point",
|
|
280
281
|
"unicorn/prefer-date-now",
|
|
@@ -290,10 +291,11 @@ const pedanticRules = [
|
|
|
290
291
|
"unicorn/prefer-regexp-test",
|
|
291
292
|
"unicorn/prefer-string-replace-all",
|
|
292
293
|
"unicorn/prefer-string-slice",
|
|
294
|
+
"unicorn/prefer-top-level-await",
|
|
293
295
|
"unicorn/prefer-type-error",
|
|
294
296
|
"unicorn/require-number-to-fixed-digits-argument",
|
|
295
|
-
"@typescript-eslint/no-loop-func",
|
|
296
297
|
"@typescript-eslint/no-array-constructor",
|
|
298
|
+
"@typescript-eslint/no-loop-func",
|
|
297
299
|
"unicorn/no-negated-condition",
|
|
298
300
|
"@typescript-eslint/no-redeclare",
|
|
299
301
|
"import-x/max-dependencies",
|
|
@@ -305,8 +307,8 @@ const styleRules = [
|
|
|
305
307
|
"curly",
|
|
306
308
|
"default-case-last",
|
|
307
309
|
"default-param-last",
|
|
308
|
-
"func-style",
|
|
309
310
|
"func-names",
|
|
311
|
+
"func-style",
|
|
310
312
|
"grouped-accessor-pairs",
|
|
311
313
|
"guard-for-in",
|
|
312
314
|
"id-length",
|
|
@@ -314,33 +316,34 @@ const styleRules = [
|
|
|
314
316
|
"max-params",
|
|
315
317
|
"max-statements",
|
|
316
318
|
"new-cap",
|
|
317
|
-
"no-
|
|
318
|
-
"no-useless-computed-key",
|
|
319
|
+
"no-continue",
|
|
319
320
|
"no-duplicate-imports",
|
|
320
321
|
"no-extra-label",
|
|
322
|
+
"no-implicit-coercion",
|
|
323
|
+
"no-label-var",
|
|
321
324
|
"no-labels",
|
|
322
325
|
"no-lone-blocks",
|
|
323
|
-
"no-multi-assign",
|
|
324
|
-
"no-nested-ternary",
|
|
325
|
-
"no-continue",
|
|
326
|
-
"no-label-var",
|
|
327
326
|
"no-magic-numbers",
|
|
327
|
+
"no-multi-assign",
|
|
328
328
|
"no-multi-str",
|
|
329
|
+
"no-nested-ternary",
|
|
329
330
|
"no-new-func",
|
|
330
331
|
"no-return-assign",
|
|
331
332
|
"no-script-url",
|
|
332
333
|
"no-template-curly-in-string",
|
|
333
334
|
"no-ternary",
|
|
335
|
+
"no-useless-computed-key",
|
|
334
336
|
"operator-assignment",
|
|
335
|
-
"prefer-
|
|
337
|
+
"prefer-const",
|
|
336
338
|
"prefer-destructuring",
|
|
337
|
-
"prefer-promise-reject-errors",
|
|
338
339
|
"prefer-exponentiation-operator",
|
|
339
340
|
"prefer-numeric-literals",
|
|
340
341
|
"prefer-object-has-own",
|
|
341
342
|
"prefer-object-spread",
|
|
343
|
+
"prefer-promise-reject-errors",
|
|
342
344
|
"prefer-rest-params",
|
|
343
345
|
"prefer-spread",
|
|
346
|
+
"prefer-template",
|
|
344
347
|
"sort-imports",
|
|
345
348
|
"sort-keys",
|
|
346
349
|
"vars-on-top",
|
|
@@ -349,12 +352,13 @@ const styleRules = [
|
|
|
349
352
|
"import/exports-last",
|
|
350
353
|
"import/first",
|
|
351
354
|
"import/group-exports",
|
|
352
|
-
"import/no-named-export",
|
|
353
355
|
"import/no-anonymous-default-export",
|
|
356
|
+
"import/no-duplicates",
|
|
354
357
|
"import/no-mutable-exports",
|
|
355
358
|
"import/no-named-default",
|
|
359
|
+
"import/no-named-export",
|
|
356
360
|
"import/no-namespace",
|
|
357
|
-
"import/no-
|
|
361
|
+
"import/no-nodejs-modules",
|
|
358
362
|
"import/prefer-default-export",
|
|
359
363
|
"jest/consistent-test-it",
|
|
360
364
|
"jest/max-expects",
|
|
@@ -374,11 +378,12 @@ const styleRules = [
|
|
|
374
378
|
"jest/no-restricted-matchers",
|
|
375
379
|
"jest/no-test-prefixes",
|
|
376
380
|
"jest/no-test-return-statement",
|
|
381
|
+
"jest/no-unneeded-async-expect-function",
|
|
377
382
|
"jest/no-untyped-mock-factory",
|
|
378
383
|
"jest/padding-around-test-blocks",
|
|
379
|
-
"jest/prefer-each",
|
|
380
384
|
"jest/prefer-called-with",
|
|
381
385
|
"jest/prefer-comparison-matcher",
|
|
386
|
+
"jest/prefer-each",
|
|
382
387
|
"jest/prefer-equality-matcher",
|
|
383
388
|
"jest/prefer-expect-resolves",
|
|
384
389
|
"jest/prefer-hooks-in-order",
|
|
@@ -399,18 +404,18 @@ const styleRules = [
|
|
|
399
404
|
"node/global-require",
|
|
400
405
|
"node/no-exports-assign",
|
|
401
406
|
"promise/avoid-new",
|
|
402
|
-
"promise/no-return-wrap",
|
|
403
407
|
"promise/no-nesting",
|
|
408
|
+
"promise/no-return-wrap",
|
|
404
409
|
"promise/param-names",
|
|
405
|
-
"promise/prefer-catch",
|
|
406
410
|
"promise/prefer-await-to-callbacks",
|
|
407
411
|
"promise/prefer-await-to-then",
|
|
408
|
-
"
|
|
409
|
-
"react/jsx-fragments",
|
|
412
|
+
"promise/prefer-catch",
|
|
410
413
|
"react/jsx-boolean-value",
|
|
411
414
|
"react/jsx-curly-brace-presence",
|
|
415
|
+
"react/jsx-fragments",
|
|
412
416
|
"react/jsx-handler-names",
|
|
413
417
|
"react/jsx-max-depth",
|
|
418
|
+
"react/jsx-pascal-case",
|
|
414
419
|
"react/jsx-props-no-spreading",
|
|
415
420
|
"react/no-redundant-should-component-update",
|
|
416
421
|
"react/no-set-state",
|
|
@@ -424,11 +429,10 @@ const styleRules = [
|
|
|
424
429
|
"@typescript-eslint/consistent-indexed-object-style",
|
|
425
430
|
"@typescript-eslint/consistent-type-definitions",
|
|
426
431
|
"@typescript-eslint/consistent-type-imports",
|
|
427
|
-
"@typescript-eslint/no-inferrable-types",
|
|
428
432
|
"@typescript-eslint/no-empty-interface",
|
|
433
|
+
"@typescript-eslint/no-inferrable-types",
|
|
429
434
|
"@typescript-eslint/prefer-for-of",
|
|
430
435
|
"@typescript-eslint/prefer-function-type",
|
|
431
|
-
"@typescript-eslint/prefer-namespace-keyword",
|
|
432
436
|
"@typescript-eslint/prefer-reduce-type-parameter",
|
|
433
437
|
"@typescript-eslint/prefer-return-this-type",
|
|
434
438
|
"unicorn/catch-error-name",
|
|
@@ -437,45 +441,44 @@ const styleRules = [
|
|
|
437
441
|
"unicorn/empty-brace-spaces",
|
|
438
442
|
"unicorn/error-message",
|
|
439
443
|
"unicorn/filename-case",
|
|
440
|
-
"unicorn/no-useless-collection-argument",
|
|
441
444
|
"unicorn/no-array-method-this-argument",
|
|
442
445
|
"unicorn/no-await-expression-member",
|
|
443
446
|
"unicorn/no-console-spaces",
|
|
444
447
|
"unicorn/no-nested-ternary",
|
|
445
448
|
"unicorn/no-null",
|
|
446
449
|
"unicorn/no-unreadable-array-destructuring",
|
|
450
|
+
"unicorn/no-useless-collection-argument",
|
|
447
451
|
"unicorn/no-zero-fractions",
|
|
448
452
|
"unicorn/number-literal-case",
|
|
449
453
|
"unicorn/numeric-separators-style",
|
|
450
|
-
"unicorn/prefer-
|
|
451
|
-
"unicorn/prefer-class-fields",
|
|
454
|
+
"unicorn/prefer-array-index-of",
|
|
452
455
|
"unicorn/prefer-bigint-literals",
|
|
456
|
+
"unicorn/prefer-class-fields",
|
|
457
|
+
"unicorn/prefer-classlist-toggle",
|
|
453
458
|
"unicorn/prefer-default-parameters",
|
|
454
|
-
"unicorn/prefer-response-static-json",
|
|
455
|
-
"unicorn/prefer-global-this",
|
|
456
|
-
"unicorn/prefer-keyboard-event-key",
|
|
457
|
-
"unicorn/prefer-object-from-entries",
|
|
458
|
-
"unicorn/prefer-array-index-of",
|
|
459
|
-
"unicorn/prefer-spread",
|
|
460
459
|
"unicorn/prefer-dom-node-text-content",
|
|
460
|
+
"unicorn/prefer-global-this",
|
|
461
461
|
"unicorn/prefer-includes",
|
|
462
|
+
"unicorn/prefer-keyboard-event-key",
|
|
462
463
|
"unicorn/prefer-logical-operator-over-ternary",
|
|
463
464
|
"unicorn/prefer-modern-dom-apis",
|
|
464
465
|
"unicorn/prefer-negative-index",
|
|
466
|
+
"unicorn/prefer-object-from-entries",
|
|
465
467
|
"unicorn/prefer-optional-catch-binding",
|
|
466
468
|
"unicorn/prefer-reflect-apply",
|
|
469
|
+
"unicorn/prefer-response-static-json",
|
|
470
|
+
"unicorn/prefer-spread",
|
|
467
471
|
"unicorn/prefer-string-raw",
|
|
468
472
|
"unicorn/prefer-string-trim-start-end",
|
|
469
473
|
"unicorn/prefer-structured-clone",
|
|
470
|
-
"unicorn/require-module-attributes",
|
|
471
474
|
"unicorn/require-array-join-separator",
|
|
475
|
+
"unicorn/require-module-attributes",
|
|
472
476
|
"unicorn/switch-case-braces",
|
|
473
477
|
"unicorn/text-encoding-identifier-case",
|
|
474
478
|
"unicorn/throw-new-error",
|
|
475
479
|
"vitest/consistent-test-filename",
|
|
476
480
|
"vitest/consistent-vitest-vi",
|
|
477
481
|
"vitest/no-import-node-test",
|
|
478
|
-
"vitest/no-unneeded-async-expect-function",
|
|
479
482
|
"vitest/prefer-called-once",
|
|
480
483
|
"vitest/prefer-called-times",
|
|
481
484
|
"vitest/prefer-describe-function-title",
|
|
@@ -494,12 +497,13 @@ const styleRules = [
|
|
|
494
497
|
"import-x/exports-last",
|
|
495
498
|
"import-x/first",
|
|
496
499
|
"import-x/group-exports",
|
|
497
|
-
"import-x/no-named-export",
|
|
498
500
|
"import-x/no-anonymous-default-export",
|
|
501
|
+
"import-x/no-duplicates",
|
|
499
502
|
"import-x/no-mutable-exports",
|
|
500
503
|
"import-x/no-named-default",
|
|
504
|
+
"import-x/no-named-export",
|
|
501
505
|
"import-x/no-namespace",
|
|
502
|
-
"import-x/no-
|
|
506
|
+
"import-x/no-nodejs-modules",
|
|
503
507
|
"import-x/prefer-default-export",
|
|
504
508
|
"vitest/consistent-test-it",
|
|
505
509
|
"vitest/max-expects",
|
|
@@ -515,9 +519,10 @@ const styleRules = [
|
|
|
515
519
|
"vitest/no-restricted-matchers",
|
|
516
520
|
"vitest/no-test-prefixes",
|
|
517
521
|
"vitest/no-test-return-statement",
|
|
518
|
-
"vitest/
|
|
522
|
+
"vitest/no-unneeded-async-expect-function",
|
|
519
523
|
"vitest/prefer-called-with",
|
|
520
524
|
"vitest/prefer-comparison-matcher",
|
|
525
|
+
"vitest/prefer-each",
|
|
521
526
|
"vitest/prefer-equality-matcher",
|
|
522
527
|
"vitest/prefer-expect-resolves",
|
|
523
528
|
"vitest/prefer-hooks-in-order",
|
|
@@ -531,28 +536,30 @@ const styleRules = [
|
|
|
531
536
|
"vitest/prefer-to-have-length",
|
|
532
537
|
"vitest/prefer-todo",
|
|
533
538
|
"vitest/require-hook",
|
|
534
|
-
"vitest/require-top-level-describe"
|
|
539
|
+
"vitest/require-top-level-describe",
|
|
540
|
+
"n/global-require",
|
|
541
|
+
"n/no-exports-assign"
|
|
535
542
|
];
|
|
536
543
|
const suspiciousRules = [
|
|
537
544
|
"block-scoped-var",
|
|
538
|
-
"no-extra-bind",
|
|
539
|
-
"no-unneeded-ternary",
|
|
540
545
|
"no-extend-native",
|
|
546
|
+
"no-extra-bind",
|
|
541
547
|
"no-new",
|
|
542
548
|
"no-unexpected-multiline",
|
|
549
|
+
"no-unneeded-ternary",
|
|
543
550
|
"no-useless-concat",
|
|
544
551
|
"no-useless-constructor",
|
|
545
552
|
"preserve-caught-error",
|
|
546
|
-
"import/no-unassigned-import",
|
|
547
|
-
"import/no-empty-named-blocks",
|
|
548
553
|
"import/no-absolute-path",
|
|
554
|
+
"import/no-empty-named-blocks",
|
|
549
555
|
"import/no-named-as-default",
|
|
550
556
|
"import/no-named-as-default-member",
|
|
551
557
|
"import/no-self-import",
|
|
558
|
+
"import/no-unassigned-import",
|
|
552
559
|
"jest/no-commented-out-tests",
|
|
553
560
|
"promise/always-return",
|
|
554
|
-
"promise/no-promise-in-callback",
|
|
555
561
|
"promise/no-multiple-resolved",
|
|
562
|
+
"promise/no-promise-in-callback",
|
|
556
563
|
"react/iframe-missing-sandbox",
|
|
557
564
|
"react/jsx-no-comment-textnodes",
|
|
558
565
|
"react/jsx-no-script-url",
|
|
@@ -569,22 +576,22 @@ const suspiciousRules = [
|
|
|
569
576
|
"@typescript-eslint/no-unsafe-enum-comparison",
|
|
570
577
|
"@typescript-eslint/no-unsafe-type-assertion",
|
|
571
578
|
"unicorn/consistent-function-scoping",
|
|
572
|
-
"unicorn/no-
|
|
579
|
+
"unicorn/no-accessor-recursion",
|
|
573
580
|
"unicorn/no-array-reverse",
|
|
581
|
+
"unicorn/no-array-sort",
|
|
574
582
|
"unicorn/no-instanceof-builtins",
|
|
575
|
-
"unicorn/no-accessor-recursion",
|
|
576
583
|
"unicorn/prefer-add-event-listener",
|
|
577
584
|
"unicorn/require-module-specifiers",
|
|
578
585
|
"unicorn/require-post-message-target-origin",
|
|
579
586
|
"vue/no-required-prop-with-default",
|
|
580
587
|
"vue/require-default-export",
|
|
581
588
|
"@typescript-eslint/no-useless-constructor",
|
|
582
|
-
"import-x/no-unassigned-import",
|
|
583
|
-
"import-x/no-empty-named-blocks",
|
|
584
589
|
"import-x/no-absolute-path",
|
|
590
|
+
"import-x/no-empty-named-blocks",
|
|
585
591
|
"import-x/no-named-as-default",
|
|
586
592
|
"import-x/no-named-as-default-member",
|
|
587
593
|
"import-x/no-self-import",
|
|
594
|
+
"import-x/no-unassigned-import",
|
|
588
595
|
"vitest/no-commented-out-tests"
|
|
589
596
|
];
|
|
590
597
|
const restrictionRules = [
|
|
@@ -593,18 +600,18 @@ const restrictionRules = [
|
|
|
593
600
|
"default-case",
|
|
594
601
|
"no-alert",
|
|
595
602
|
"no-bitwise",
|
|
596
|
-
"no-param-reassign",
|
|
597
|
-
"no-restricted-imports",
|
|
598
603
|
"no-console",
|
|
599
604
|
"no-div-regex",
|
|
600
|
-
"no-empty-function",
|
|
601
605
|
"no-empty",
|
|
606
|
+
"no-empty-function",
|
|
602
607
|
"no-eq-null",
|
|
603
608
|
"no-iterator",
|
|
609
|
+
"no-param-reassign",
|
|
604
610
|
"no-plusplus",
|
|
605
611
|
"no-proto",
|
|
606
612
|
"no-regex-spaces",
|
|
607
613
|
"no-restricted-globals",
|
|
614
|
+
"no-restricted-imports",
|
|
608
615
|
"no-sequences",
|
|
609
616
|
"no-undefined",
|
|
610
617
|
"no-var",
|
|
@@ -616,13 +623,14 @@ const restrictionRules = [
|
|
|
616
623
|
"import/no-cycle",
|
|
617
624
|
"import/no-default-export",
|
|
618
625
|
"import/no-dynamic-require",
|
|
626
|
+
"import/no-relative-parent-imports",
|
|
619
627
|
"import/no-webpack-loader-syntax",
|
|
620
628
|
"import/unambiguous",
|
|
621
629
|
"jsdoc/check-access",
|
|
622
630
|
"jsdoc/empty-tags",
|
|
623
631
|
"jsx-a11y/anchor-ambiguous-text",
|
|
624
|
-
"node/no-process-env",
|
|
625
632
|
"node/no-new-require",
|
|
633
|
+
"node/no-process-env",
|
|
626
634
|
"promise/catch-or-return",
|
|
627
635
|
"promise/spec-only",
|
|
628
636
|
"react/button-has-type",
|
|
@@ -630,10 +638,11 @@ const restrictionRules = [
|
|
|
630
638
|
"react/forbid-elements",
|
|
631
639
|
"react/jsx-filename-extension",
|
|
632
640
|
"react/no-danger",
|
|
641
|
+
"react/no-multi-comp",
|
|
633
642
|
"react/no-unknown-property",
|
|
634
643
|
"react/only-export-components",
|
|
635
|
-
"@typescript-eslint/explicit-module-boundary-types",
|
|
636
644
|
"@typescript-eslint/explicit-function-return-type",
|
|
645
|
+
"@typescript-eslint/explicit-module-boundary-types",
|
|
637
646
|
"@typescript-eslint/no-dynamic-delete",
|
|
638
647
|
"@typescript-eslint/no-empty-object-type",
|
|
639
648
|
"@typescript-eslint/no-explicit-any",
|
|
@@ -648,7 +657,6 @@ const restrictionRules = [
|
|
|
648
657
|
"@typescript-eslint/prefer-literal-enum-member",
|
|
649
658
|
"@typescript-eslint/promise-function-async",
|
|
650
659
|
"@typescript-eslint/use-unknown-in-catch-callback-variable",
|
|
651
|
-
"unicorn/no-useless-error-capture-stack-trace",
|
|
652
660
|
"unicorn/no-abusive-eslint-disable",
|
|
653
661
|
"unicorn/no-anonymous-default-export",
|
|
654
662
|
"unicorn/no-array-for-each",
|
|
@@ -657,6 +665,7 @@ const restrictionRules = [
|
|
|
657
665
|
"unicorn/no-length-as-slice-end",
|
|
658
666
|
"unicorn/no-magic-array-flat-depth",
|
|
659
667
|
"unicorn/no-process-exit",
|
|
668
|
+
"unicorn/no-useless-error-capture-stack-trace",
|
|
660
669
|
"unicorn/prefer-modern-math-apis",
|
|
661
670
|
"unicorn/prefer-node-protocol",
|
|
662
671
|
"unicorn/prefer-number-properties",
|
|
@@ -664,25 +673,27 @@ const restrictionRules = [
|
|
|
664
673
|
"vue/no-import-compiler-macros",
|
|
665
674
|
"vue/no-multiple-slot-args",
|
|
666
675
|
"@typescript-eslint/class-methods-use-this",
|
|
667
|
-
"@typescript-eslint/no-restricted-imports",
|
|
668
676
|
"@typescript-eslint/no-empty-function",
|
|
677
|
+
"@typescript-eslint/no-restricted-imports",
|
|
669
678
|
"import-x/extensions",
|
|
670
679
|
"import-x/no-amd",
|
|
671
680
|
"import-x/no-commonjs",
|
|
672
681
|
"import-x/no-cycle",
|
|
673
682
|
"import-x/no-default-export",
|
|
674
683
|
"import-x/no-dynamic-require",
|
|
684
|
+
"import-x/no-relative-parent-imports",
|
|
675
685
|
"import-x/no-webpack-loader-syntax",
|
|
676
|
-
"import-x/unambiguous"
|
|
686
|
+
"import-x/unambiguous",
|
|
687
|
+
"n/no-new-require",
|
|
688
|
+
"n/no-process-env",
|
|
689
|
+
"react-refresh/only-export-components"
|
|
677
690
|
];
|
|
678
691
|
const correctnessRules = [
|
|
679
692
|
"constructor-super",
|
|
680
693
|
"for-direction",
|
|
681
|
-
"no-unassigned-vars",
|
|
682
694
|
"no-async-promise-executor",
|
|
683
695
|
"no-caller",
|
|
684
696
|
"no-class-assign",
|
|
685
|
-
"no-useless-backreference",
|
|
686
697
|
"no-compare-neg-zero",
|
|
687
698
|
"no-cond-assign",
|
|
688
699
|
"no-const-assign",
|
|
@@ -715,6 +726,7 @@ const correctnessRules = [
|
|
|
715
726
|
"no-shadow-restricted-names",
|
|
716
727
|
"no-sparse-arrays",
|
|
717
728
|
"no-this-before-super",
|
|
729
|
+
"no-unassigned-vars",
|
|
718
730
|
"no-unsafe-finally",
|
|
719
731
|
"no-unsafe-negation",
|
|
720
732
|
"no-unsafe-optional-chaining",
|
|
@@ -722,6 +734,7 @@ const correctnessRules = [
|
|
|
722
734
|
"no-unused-labels",
|
|
723
735
|
"no-unused-private-class-members",
|
|
724
736
|
"no-unused-vars",
|
|
737
|
+
"no-useless-backreference",
|
|
725
738
|
"no-useless-catch",
|
|
726
739
|
"no-useless-escape",
|
|
727
740
|
"no-useless-rename",
|
|
@@ -768,11 +781,11 @@ const correctnessRules = [
|
|
|
768
781
|
"jsx-a11y/lang",
|
|
769
782
|
"jsx-a11y/media-has-caption",
|
|
770
783
|
"jsx-a11y/mouse-events-have-key-events",
|
|
771
|
-
"jsx-a11y/no-noninteractive-tabindex",
|
|
772
784
|
"jsx-a11y/no-access-key",
|
|
773
785
|
"jsx-a11y/no-aria-hidden-on-focusable",
|
|
774
786
|
"jsx-a11y/no-autofocus",
|
|
775
787
|
"jsx-a11y/no-distracting-elements",
|
|
788
|
+
"jsx-a11y/no-noninteractive-tabindex",
|
|
776
789
|
"jsx-a11y/no-redundant-roles",
|
|
777
790
|
"jsx-a11y/prefer-tag-over-role",
|
|
778
791
|
"jsx-a11y/role-has-required-aria-props",
|
|
@@ -791,6 +804,7 @@ const correctnessRules = [
|
|
|
791
804
|
"@next/next/no-duplicate-head",
|
|
792
805
|
"@next/next/no-head-element",
|
|
793
806
|
"@next/next/no-head-import-in-document",
|
|
807
|
+
"@next/next/no-html-link-for-pages",
|
|
794
808
|
"@next/next/no-img-element",
|
|
795
809
|
"@next/next/no-page-custom-font",
|
|
796
810
|
"@next/next/no-script-component-in-head",
|
|
@@ -799,7 +813,6 @@ const correctnessRules = [
|
|
|
799
813
|
"@next/next/no-title-in-document-head",
|
|
800
814
|
"@next/next/no-typos",
|
|
801
815
|
"@next/next/no-unwanted-polyfillio",
|
|
802
|
-
"@next/next/no-html-link-for-pages",
|
|
803
816
|
"promise/no-callback-in-promise",
|
|
804
817
|
"promise/no-new-statics",
|
|
805
818
|
"promise/valid-params",
|
|
@@ -809,9 +822,9 @@ const correctnessRules = [
|
|
|
809
822
|
"react/jsx-no-duplicate-props",
|
|
810
823
|
"react/jsx-no-undef",
|
|
811
824
|
"react/jsx-props-no-spread-multi",
|
|
812
|
-
"react/no-did-mount-set-state",
|
|
813
825
|
"react/no-children-prop",
|
|
814
826
|
"react/no-danger-with-children",
|
|
827
|
+
"react/no-did-mount-set-state",
|
|
815
828
|
"react/no-direct-mutation-state",
|
|
816
829
|
"react/no-find-dom-node",
|
|
817
830
|
"react/no-is-mounted",
|
|
@@ -822,12 +835,12 @@ const correctnessRules = [
|
|
|
822
835
|
"react/no-will-update-set-state",
|
|
823
836
|
"react/void-dom-elements-no-children",
|
|
824
837
|
"@typescript-eslint/await-thenable",
|
|
825
|
-
"@typescript-eslint/no-floating-promises",
|
|
826
838
|
"@typescript-eslint/no-array-delete",
|
|
827
839
|
"@typescript-eslint/no-base-to-string",
|
|
828
840
|
"@typescript-eslint/no-duplicate-enum-values",
|
|
829
841
|
"@typescript-eslint/no-duplicate-type-constituents",
|
|
830
842
|
"@typescript-eslint/no-extra-non-null-assertion",
|
|
843
|
+
"@typescript-eslint/no-floating-promises",
|
|
831
844
|
"@typescript-eslint/no-for-in-array",
|
|
832
845
|
"@typescript-eslint/no-implied-eval",
|
|
833
846
|
"@typescript-eslint/no-meaningless-void-operator",
|
|
@@ -842,13 +855,14 @@ const correctnessRules = [
|
|
|
842
855
|
"@typescript-eslint/no-useless-empty-export",
|
|
843
856
|
"@typescript-eslint/no-wrapper-object-types",
|
|
844
857
|
"@typescript-eslint/prefer-as-const",
|
|
858
|
+
"@typescript-eslint/prefer-namespace-keyword",
|
|
845
859
|
"@typescript-eslint/require-array-sort-compare",
|
|
846
860
|
"@typescript-eslint/restrict-template-expressions",
|
|
847
861
|
"@typescript-eslint/triple-slash-reference",
|
|
848
862
|
"@typescript-eslint/unbound-method",
|
|
849
|
-
"unicorn/no-invalid-fetch-options",
|
|
850
863
|
"unicorn/no-await-in-promise-methods",
|
|
851
864
|
"unicorn/no-empty-file",
|
|
865
|
+
"unicorn/no-invalid-fetch-options",
|
|
852
866
|
"unicorn/no-invalid-remove-event-listener",
|
|
853
867
|
"unicorn/no-new-array",
|
|
854
868
|
"unicorn/no-single-promise-in-promise-methods",
|
|
@@ -913,53 +927,8 @@ const perfRules = [
|
|
|
913
927
|
"unicorn/prefer-array-flat-map",
|
|
914
928
|
"unicorn/prefer-set-has"
|
|
915
929
|
];
|
|
916
|
-
|
|
917
|
-
//#endregion
|
|
918
|
-
//#region src/constants.ts
|
|
919
|
-
const rulesPrefixesForPlugins = {
|
|
920
|
-
import: "import",
|
|
921
|
-
"import-x": "import",
|
|
922
|
-
jest: "jest",
|
|
923
|
-
jsdoc: "jsdoc",
|
|
924
|
-
"jsx-a11y": "jsx-a11y",
|
|
925
|
-
"@next/next": "nextjs",
|
|
926
|
-
node: "node",
|
|
927
|
-
n: "node",
|
|
928
|
-
promise: "promise",
|
|
929
|
-
react: "react",
|
|
930
|
-
"react-perf": "react-perf",
|
|
931
|
-
"react-hooks": "react",
|
|
932
|
-
"@typescript-eslint": "typescript",
|
|
933
|
-
unicorn: "unicorn",
|
|
934
|
-
vitest: "vitest",
|
|
935
|
-
vue: "vue"
|
|
936
|
-
};
|
|
937
|
-
const typescriptRulesExtendEslintRules = [
|
|
938
|
-
"class-methods-use-this",
|
|
939
|
-
"default-param-last",
|
|
940
|
-
"init-declarations",
|
|
941
|
-
"max-params",
|
|
942
|
-
"no-array-constructor",
|
|
943
|
-
"no-dupe-class-members",
|
|
944
|
-
"no-empty-function",
|
|
945
|
-
"no-invalid-this",
|
|
946
|
-
"no-loop-func",
|
|
947
|
-
"no-loss-of-precision",
|
|
948
|
-
"no-magic-numbers",
|
|
949
|
-
"no-redeclare",
|
|
950
|
-
"no-restricted-imports",
|
|
951
|
-
"no-shadow",
|
|
952
|
-
"no-unused-expressions",
|
|
953
|
-
"no-unused-vars",
|
|
954
|
-
"no-use-before-define",
|
|
955
|
-
"no-useless-constructor"
|
|
956
|
-
];
|
|
957
|
-
const typescriptTypeAwareRules = [
|
|
930
|
+
const typeAwareRules = [
|
|
958
931
|
"@typescript-eslint/await-thenable",
|
|
959
|
-
"@typescript-eslint/consistent-return",
|
|
960
|
-
"@typescript-eslint/consistent-type-exports",
|
|
961
|
-
"@typescript-eslint/dot-notation",
|
|
962
|
-
"@typescript-eslint/naming-convention",
|
|
963
932
|
"@typescript-eslint/no-array-delete",
|
|
964
933
|
"@typescript-eslint/no-base-to-string",
|
|
965
934
|
"@typescript-eslint/no-confusing-void-expression",
|
|
@@ -974,13 +943,9 @@ const typescriptTypeAwareRules = [
|
|
|
974
943
|
"@typescript-eslint/no-mixed-enums",
|
|
975
944
|
"@typescript-eslint/no-redundant-type-constituents",
|
|
976
945
|
"@typescript-eslint/no-unnecessary-boolean-literal-compare",
|
|
977
|
-
"@typescript-eslint/no-unnecessary-condition",
|
|
978
|
-
"@typescript-eslint/no-unnecessary-qualifier",
|
|
979
946
|
"@typescript-eslint/no-unnecessary-template-expression",
|
|
980
947
|
"@typescript-eslint/no-unnecessary-type-arguments",
|
|
981
948
|
"@typescript-eslint/no-unnecessary-type-assertion",
|
|
982
|
-
"@typescript-eslint/no-unnecessary-type-conversion",
|
|
983
|
-
"@typescript-eslint/no-unnecessary-type-parameters",
|
|
984
949
|
"@typescript-eslint/no-unsafe-argument",
|
|
985
950
|
"@typescript-eslint/no-unsafe-assignment",
|
|
986
951
|
"@typescript-eslint/no-unsafe-call",
|
|
@@ -991,18 +956,12 @@ const typescriptTypeAwareRules = [
|
|
|
991
956
|
"@typescript-eslint/no-unsafe-unary-minus",
|
|
992
957
|
"@typescript-eslint/non-nullable-type-assertion-style",
|
|
993
958
|
"@typescript-eslint/only-throw-error",
|
|
994
|
-
"@typescript-eslint/prefer-destructuring",
|
|
995
|
-
"@typescript-eslint/prefer-find",
|
|
996
959
|
"@typescript-eslint/prefer-includes",
|
|
997
960
|
"@typescript-eslint/prefer-nullish-coalescing",
|
|
998
961
|
"@typescript-eslint/prefer-optional-chain",
|
|
999
962
|
"@typescript-eslint/prefer-promise-reject-errors",
|
|
1000
|
-
"@typescript-eslint/prefer-readonly",
|
|
1001
|
-
"@typescript-eslint/prefer-readonly-parameter-types",
|
|
1002
963
|
"@typescript-eslint/prefer-reduce-type-parameter",
|
|
1003
|
-
"@typescript-eslint/prefer-regexp-exec",
|
|
1004
964
|
"@typescript-eslint/prefer-return-this-type",
|
|
1005
|
-
"@typescript-eslint/prefer-string-starts-ends-with",
|
|
1006
965
|
"@typescript-eslint/promise-function-async",
|
|
1007
966
|
"@typescript-eslint/related-getter-setter-pairs",
|
|
1008
967
|
"@typescript-eslint/require-array-sort-compare",
|
|
@@ -1016,6 +975,48 @@ const typescriptTypeAwareRules = [
|
|
|
1016
975
|
"@typescript-eslint/use-unknown-in-catch-callback-variable"
|
|
1017
976
|
];
|
|
1018
977
|
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/constants.ts
|
|
980
|
+
const rulesPrefixesForPlugins = {
|
|
981
|
+
import: "import",
|
|
982
|
+
"import-x": "import",
|
|
983
|
+
jest: "jest",
|
|
984
|
+
jsdoc: "jsdoc",
|
|
985
|
+
"jsx-a11y": "jsx-a11y",
|
|
986
|
+
"@next/next": "nextjs",
|
|
987
|
+
node: "node",
|
|
988
|
+
n: "node",
|
|
989
|
+
promise: "promise",
|
|
990
|
+
react: "react",
|
|
991
|
+
"react-perf": "react-perf",
|
|
992
|
+
"react-hooks": "react",
|
|
993
|
+
"react-refresh": "react",
|
|
994
|
+
"@typescript-eslint": "typescript",
|
|
995
|
+
unicorn: "unicorn",
|
|
996
|
+
vitest: "vitest",
|
|
997
|
+
vue: "vue"
|
|
998
|
+
};
|
|
999
|
+
const typescriptRulesExtendEslintRules = [
|
|
1000
|
+
"class-methods-use-this",
|
|
1001
|
+
"default-param-last",
|
|
1002
|
+
"init-declarations",
|
|
1003
|
+
"max-params",
|
|
1004
|
+
"no-array-constructor",
|
|
1005
|
+
"no-dupe-class-members",
|
|
1006
|
+
"no-empty-function",
|
|
1007
|
+
"no-invalid-this",
|
|
1008
|
+
"no-loop-func",
|
|
1009
|
+
"no-loss-of-precision",
|
|
1010
|
+
"no-magic-numbers",
|
|
1011
|
+
"no-redeclare",
|
|
1012
|
+
"no-restricted-imports",
|
|
1013
|
+
"no-shadow",
|
|
1014
|
+
"no-unused-expressions",
|
|
1015
|
+
"no-unused-vars",
|
|
1016
|
+
"no-use-before-define",
|
|
1017
|
+
"no-useless-constructor"
|
|
1018
|
+
];
|
|
1019
|
+
|
|
1019
1020
|
//#endregion
|
|
1020
1021
|
//#region src/jsPlugins.ts
|
|
1021
1022
|
const ignorePlugins = new Set([
|
|
@@ -1099,48 +1100,74 @@ const normalizeSeverityValue = (value) => {
|
|
|
1099
1100
|
return "off";
|
|
1100
1101
|
}
|
|
1101
1102
|
};
|
|
1102
|
-
|
|
1103
|
+
/**
|
|
1104
|
+
* Merges a new rule configuration with an existing one, preserving options when
|
|
1105
|
+
* the new config only specifies a severity level.
|
|
1106
|
+
*
|
|
1107
|
+
* ESLint flat config behavior: When a rule is redefined with only a severity
|
|
1108
|
+
* (e.g., 'error'), the existing options should be preserved. Only when new
|
|
1109
|
+
* options are explicitly provided should they override the existing ones.
|
|
1110
|
+
*
|
|
1111
|
+
* Special case: When severity is 'off', options are not preserved since the
|
|
1112
|
+
* rule is disabled and options don't matter.
|
|
1113
|
+
*
|
|
1114
|
+
* @param existingConfig - The current rule configuration
|
|
1115
|
+
* @param newConfig - The new rule configuration to merge
|
|
1116
|
+
* @returns The merged rule configuration
|
|
1117
|
+
*/
|
|
1118
|
+
const mergeRuleConfig = (existingConfig, newConfig) => {
|
|
1119
|
+
if (newConfig === void 0) return existingConfig;
|
|
1120
|
+
if (existingConfig === void 0) return newConfig;
|
|
1121
|
+
if (isOffValue(newConfig)) return newConfig;
|
|
1122
|
+
const newIsSimple = !Array.isArray(newConfig);
|
|
1123
|
+
const existingIsArray = Array.isArray(existingConfig);
|
|
1124
|
+
if (newIsSimple && existingIsArray && existingConfig.length > 1) return [newConfig, ...existingConfig.slice(1)];
|
|
1125
|
+
if (Array.isArray(newConfig) && newConfig.length === 1 && existingIsArray && existingConfig.length > 1) return [newConfig[0], ...existingConfig.slice(1)];
|
|
1126
|
+
return newConfig;
|
|
1127
|
+
};
|
|
1128
|
+
const transformRuleEntry = (eslintConfig, targetConfig, baseConfig, options) => {
|
|
1103
1129
|
if (eslintConfig.rules === void 0) return;
|
|
1104
1130
|
if (targetConfig.rules === void 0) targetConfig.rules = {};
|
|
1105
1131
|
for (const [rule, config] of Object.entries(eslintConfig.rules)) {
|
|
1106
1132
|
const normalizedConfig = normalizeSeverityValue(config);
|
|
1107
|
-
const unsupportedRuleMessage = `unsupported rule: ${rule}`;
|
|
1108
1133
|
if (allRules.includes(rule)) {
|
|
1109
1134
|
if (!options?.withNursery && nurseryRules.includes(rule)) {
|
|
1110
|
-
options?.reporter?.report(`unsupported rule, but available as a nursery rule: ${rule}`);
|
|
1111
1135
|
options?.reporter?.markSkipped(rule, "nursery");
|
|
1112
1136
|
continue;
|
|
1113
1137
|
}
|
|
1114
|
-
if (!options?.typeAware &&
|
|
1115
|
-
options?.reporter?.report(`type-aware rule detected, but \`--type-aware\` is not enabled: ${rule}`);
|
|
1138
|
+
if (!options?.typeAware && typeAwareRules.includes(rule)) {
|
|
1116
1139
|
options?.reporter?.markSkipped(rule, "type-aware");
|
|
1117
1140
|
continue;
|
|
1118
1141
|
}
|
|
1119
1142
|
if (options?.merge) {
|
|
1120
1143
|
if (!(rule in targetConfig.rules)) targetConfig.rules[rule] = normalizedConfig;
|
|
1121
|
-
} else
|
|
1144
|
+
} else {
|
|
1145
|
+
const existingConfig = rule in targetConfig.rules ? targetConfig.rules[rule] : baseConfig?.rules?.[rule];
|
|
1146
|
+
targetConfig.rules[rule] = mergeRuleConfig(existingConfig, normalizedConfig);
|
|
1147
|
+
}
|
|
1122
1148
|
} else {
|
|
1123
1149
|
if (options?.jsPlugins) {
|
|
1124
1150
|
if (isOffValue(normalizedConfig)) {
|
|
1125
1151
|
if (eslintConfig.files === void 0) delete targetConfig.rules[rule];
|
|
1126
1152
|
else if (!isIgnoredPluginRule(rule)) targetConfig.rules[rule] = normalizedConfig;
|
|
1127
1153
|
if (eslintConfig.files === void 0) {
|
|
1128
|
-
options
|
|
1154
|
+
options?.reporter?.removeSkipped(rule, "js-plugins");
|
|
1129
1155
|
options?.reporter?.removeSkipped(rule, "unsupported");
|
|
1130
1156
|
}
|
|
1131
1157
|
continue;
|
|
1132
1158
|
}
|
|
1133
|
-
if (enableJsPluginRule(targetConfig, rule, normalizedConfig))
|
|
1159
|
+
if (!enableJsPluginRule(targetConfig, rule, normalizedConfig)) options?.reporter?.markSkipped(rule, "unsupported");
|
|
1160
|
+
continue;
|
|
1134
1161
|
}
|
|
1135
1162
|
if (!isActiveValue(normalizedConfig)) {
|
|
1136
1163
|
if (isOffValue(normalizedConfig)) delete targetConfig.rules[rule];
|
|
1137
|
-
if (eslintConfig.files === void 0)
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1164
|
+
if (eslintConfig.files === void 0) options?.reporter?.removeSkipped(rule, "unsupported");
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
if (!options?.jsPlugins && !isIgnoredPluginRule(rule)) {
|
|
1168
|
+
options?.reporter?.markSkipped(rule, "js-plugins");
|
|
1141
1169
|
continue;
|
|
1142
1170
|
}
|
|
1143
|
-
options?.reporter?.report(unsupportedRuleMessage);
|
|
1144
1171
|
options?.reporter?.markSkipped(rule, "unsupported");
|
|
1145
1172
|
}
|
|
1146
1173
|
}
|
|
@@ -1223,7 +1250,7 @@ const replaceTypescriptAliasRules = (config) => {
|
|
|
1223
1250
|
if (Object.keys(config.rules).length === 0) delete config.rules;
|
|
1224
1251
|
};
|
|
1225
1252
|
/**
|
|
1226
|
-
* Oxlint
|
|
1253
|
+
* Oxlint supports eslint-plugin-n rules only under the `node` plugin name
|
|
1227
1254
|
*/
|
|
1228
1255
|
const replaceNodePluginName = (config) => {
|
|
1229
1256
|
if (config.rules === void 0) return;
|
|
@@ -1234,6 +1261,19 @@ const replaceNodePluginName = (config) => {
|
|
|
1234
1261
|
delete config.rules[rule];
|
|
1235
1262
|
}
|
|
1236
1263
|
};
|
|
1264
|
+
/**
|
|
1265
|
+
* Oxlint supports the eslint-plugin-react-refresh/only-export-components rule
|
|
1266
|
+
* under the `react` plugin name.
|
|
1267
|
+
*/
|
|
1268
|
+
const replaceReactRefreshPluginName = (config) => {
|
|
1269
|
+
if (config.rules === void 0) return;
|
|
1270
|
+
for (const rule of Object.keys(config.rules)) {
|
|
1271
|
+
if (!rule.startsWith("react-refresh/")) continue;
|
|
1272
|
+
const reactRefreshRule = `react/${rule.slice(14)}`;
|
|
1273
|
+
config.rules[reactRefreshRule] = config.rules[rule];
|
|
1274
|
+
delete config.rules[rule];
|
|
1275
|
+
}
|
|
1276
|
+
};
|
|
1237
1277
|
|
|
1238
1278
|
//#endregion
|
|
1239
1279
|
//#region src/utilities.ts
|
|
@@ -1294,6 +1334,7 @@ const cleanUpOxlintConfig = (config) => {
|
|
|
1294
1334
|
transformBoolGlobalToString(config);
|
|
1295
1335
|
replaceTypescriptAliasRules(config);
|
|
1296
1336
|
replaceNodePluginName(config);
|
|
1337
|
+
replaceReactRefreshPluginName(config);
|
|
1297
1338
|
cleanUpRulesWhichAreCoveredByCategory(config);
|
|
1298
1339
|
if (config.globals !== void 0 && Object.keys(config.globals).length === 0) delete config.globals;
|
|
1299
1340
|
if (config.env !== void 0) {
|
|
@@ -1418,7 +1459,7 @@ function mergeConsecutiveOverridesWithDifferingFiles(config) {
|
|
|
1418
1459
|
const transformIgnorePatterns = (eslintConfig, targetConfig, options) => {
|
|
1419
1460
|
if (eslintConfig.ignores === void 0) return;
|
|
1420
1461
|
if ("files" in targetConfig) {
|
|
1421
|
-
options?.reporter?.
|
|
1462
|
+
options?.reporter?.addWarning("ignore list inside overrides is not supported");
|
|
1422
1463
|
return;
|
|
1423
1464
|
}
|
|
1424
1465
|
if (targetConfig.ignorePatterns === void 0) targetConfig.ignorePatterns = [];
|
|
@@ -1486,7 +1527,7 @@ const preFixForJsPlugins = () => {
|
|
|
1486
1527
|
function processConfigFiles(files, reporter) {
|
|
1487
1528
|
const filesArray = Array.isArray(files) ? files : [files];
|
|
1488
1529
|
const simpleFiles = [];
|
|
1489
|
-
for (const file of filesArray) if (Array.isArray(file)) reporter?.
|
|
1530
|
+
for (const file of filesArray) if (Array.isArray(file)) reporter?.addWarning(`ESLint AND glob patterns (nested arrays in files) are not supported in oxlint: ${JSON.stringify(file)}`);
|
|
1490
1531
|
else simpleFiles.push(file);
|
|
1491
1532
|
return simpleFiles;
|
|
1492
1533
|
}
|
|
@@ -1526,7 +1567,7 @@ const buildConfig = (configs, oxlintConfig, options) => {
|
|
|
1526
1567
|
if (push) overrides.push(result);
|
|
1527
1568
|
}
|
|
1528
1569
|
transformIgnorePatterns(config, targetConfig, options);
|
|
1529
|
-
transformRuleEntry(config, targetConfig, options);
|
|
1570
|
+
transformRuleEntry(config, targetConfig, config.files !== void 0 ? oxlintConfig : void 0, options);
|
|
1530
1571
|
transformEnvAndGlobals(config, targetConfig, options);
|
|
1531
1572
|
if ("files" in targetConfig) {
|
|
1532
1573
|
detectNeededRulesPlugins(targetConfig);
|
|
@@ -1547,4 +1588,4 @@ const main = async (configs, oxlintConfig, options) => {
|
|
|
1547
1588
|
var src_default = main;
|
|
1548
1589
|
|
|
1549
1590
|
//#endregion
|
|
1550
|
-
export { rules_exports as i, preFixForJsPlugins as n,
|
|
1591
|
+
export { rules_exports as a, nurseryRules as i, preFixForJsPlugins as n, isOffValue as r, src_default as t };
|