@oxlint/migrate 1.58.0 → 1.60.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as nurseryRules, i as buildUnsupportedRuleExplanations, n as preFixForJsPlugins, o as rules_exports, r as isOffValue, s as normalizeRuleToCanonical, t as main } from "../src-
|
|
2
|
+
import { a as nurseryRules, i as buildUnsupportedRuleExplanations, n as preFixForJsPlugins, o as rules_exports, r as isOffValue, s as normalizeRuleToCanonical, t as main } from "../src-CZcyZXzR.mjs";
|
|
3
3
|
import { program } from "commander";
|
|
4
4
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -30,7 +30,7 @@ const loadESLintConfig = async (filePath) => {
|
|
|
30
30
|
};
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region package.json
|
|
33
|
-
var version = "1.
|
|
33
|
+
var version = "1.60.0";
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/walker/comments/replaceRuleDirectiveComment.ts
|
|
36
36
|
const allRulesSet = new Set(Object.values(rules_exports).flat());
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/oxlint@1.
|
|
1
|
+
//#region node_modules/.pnpm/oxlint@1.60.0_oxlint-tsgolint@0.19.0/node_modules/oxlint/dist/index.d.ts
|
|
2
2
|
//#region src-js/package/config.generated.d.ts
|
|
3
3
|
type AllowWarnDeny = ("allow" | "off" | "warn" | "error" | "deny") | number;
|
|
4
4
|
type GlobalValue = "readonly" | "writable" | "off";
|
package/dist/src/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as main } from "../src-
|
|
1
|
+
import { t as main } from "../src-CZcyZXzR.mjs";
|
|
2
2
|
export { main as default };
|
|
@@ -58,6 +58,7 @@ const OTHER_SUPPORTED_ENVS = [
|
|
|
58
58
|
"vue"
|
|
59
59
|
];
|
|
60
60
|
const SUPPORTED_ESLINT_PARSERS = ["typescript-eslint/parser"];
|
|
61
|
+
const ROOT_GLOBALS_WARNING_THRESHOLD = 10;
|
|
61
62
|
const normalizeGlobValue = (value) => {
|
|
62
63
|
if (value === "readable" || value === "readonly" || value === false) return false;
|
|
63
64
|
if (value === "off") return;
|
|
@@ -119,6 +120,13 @@ const transformEnvAndGlobals = (eslintConfig, targetConfig, options) => {
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
};
|
|
123
|
+
const warnAboutLargeRootGlobals = (configs, oxlintConfig, options) => {
|
|
124
|
+
const sourceRootGlobals = /* @__PURE__ */ new Set();
|
|
125
|
+
for (const config of configs) if (config.files === void 0 && config.languageOptions?.globals) for (const global of Object.keys(config.languageOptions.globals)) sourceRootGlobals.add(global);
|
|
126
|
+
const finalRootGlobals = Object.keys(oxlintConfig.globals ?? {});
|
|
127
|
+
if (sourceRootGlobals.size <= ROOT_GLOBALS_WARNING_THRESHOLD || finalRootGlobals.length <= ROOT_GLOBALS_WARNING_THRESHOLD) return;
|
|
128
|
+
options?.reporter?.addWarning(`Added ${finalRootGlobals.length} globals to the root config. This may happen when your ESLint config uses a different version of the \`globals\` package than @oxlint/migrate. Try updating \`globals\` and rerun the migration to get a simpler config.`);
|
|
129
|
+
};
|
|
122
130
|
const cleanUpUselessOverridesEnv = (config) => {
|
|
123
131
|
if (config.env === void 0 || config.env === null || config.overrides === void 0 || config.overrides === null) return;
|
|
124
132
|
for (const override of config.overrides) {
|
|
@@ -457,12 +465,14 @@ const pedanticRules = [
|
|
|
457
465
|
"typescript/prefer-includes",
|
|
458
466
|
"typescript/prefer-nullish-coalescing",
|
|
459
467
|
"typescript/prefer-promise-reject-errors",
|
|
468
|
+
"typescript/prefer-readonly-parameter-types",
|
|
460
469
|
"typescript/prefer-ts-expect-error",
|
|
461
470
|
"typescript/related-getter-setter-pairs",
|
|
462
471
|
"typescript/require-await",
|
|
463
472
|
"typescript/restrict-plus-operands",
|
|
464
473
|
"typescript/return-await",
|
|
465
474
|
"typescript/strict-boolean-expressions",
|
|
475
|
+
"typescript/strict-void-return",
|
|
466
476
|
"typescript/switch-exhaustiveness-check",
|
|
467
477
|
"unicorn/consistent-assert",
|
|
468
478
|
"unicorn/consistent-empty-array-spread",
|
|
@@ -497,6 +507,7 @@ const pedanticRules = [
|
|
|
497
507
|
"unicorn/prefer-dom-node-dataset",
|
|
498
508
|
"unicorn/prefer-dom-node-remove",
|
|
499
509
|
"unicorn/prefer-event-target",
|
|
510
|
+
"unicorn/prefer-import-meta-properties",
|
|
500
511
|
"unicorn/prefer-math-min-max",
|
|
501
512
|
"unicorn/prefer-math-trunc",
|
|
502
513
|
"unicorn/prefer-native-coercion-functions",
|
|
@@ -546,6 +557,7 @@ const styleRules = [
|
|
|
546
557
|
"no-template-curly-in-string",
|
|
547
558
|
"no-ternary",
|
|
548
559
|
"no-useless-computed-key",
|
|
560
|
+
"object-shorthand",
|
|
549
561
|
"operator-assignment",
|
|
550
562
|
"prefer-const",
|
|
551
563
|
"prefer-destructuring",
|
|
@@ -593,14 +605,17 @@ const styleRules = [
|
|
|
593
605
|
"jest/no-test-return-statement",
|
|
594
606
|
"jest/no-unneeded-async-expect-function",
|
|
595
607
|
"jest/no-untyped-mock-factory",
|
|
608
|
+
"jest/padding-around-after-all-blocks",
|
|
596
609
|
"jest/padding-around-test-blocks",
|
|
597
610
|
"jest/prefer-called-with",
|
|
598
611
|
"jest/prefer-comparison-matcher",
|
|
599
612
|
"jest/prefer-each",
|
|
613
|
+
"jest/prefer-ending-with-an-expect",
|
|
600
614
|
"jest/prefer-equality-matcher",
|
|
601
615
|
"jest/prefer-expect-resolves",
|
|
602
616
|
"jest/prefer-hooks-in-order",
|
|
603
617
|
"jest/prefer-hooks-on-top",
|
|
618
|
+
"jest/prefer-importing-jest-globals",
|
|
604
619
|
"jest/prefer-jest-mocked",
|
|
605
620
|
"jest/prefer-lowercase-title",
|
|
606
621
|
"jest/prefer-mock-promise-shorthand",
|
|
@@ -624,6 +639,7 @@ const styleRules = [
|
|
|
624
639
|
"promise/prefer-await-to-callbacks",
|
|
625
640
|
"promise/prefer-await-to-then",
|
|
626
641
|
"promise/prefer-catch",
|
|
642
|
+
"react/hook-use-state",
|
|
627
643
|
"react/jsx-boolean-value",
|
|
628
644
|
"react/jsx-curly-brace-presence",
|
|
629
645
|
"react/jsx-fragments",
|
|
@@ -644,9 +660,12 @@ const styleRules = [
|
|
|
644
660
|
"typescript/consistent-indexed-object-style",
|
|
645
661
|
"typescript/consistent-type-assertions",
|
|
646
662
|
"typescript/consistent-type-definitions",
|
|
663
|
+
"typescript/consistent-type-exports",
|
|
647
664
|
"typescript/consistent-type-imports",
|
|
665
|
+
"typescript/dot-notation",
|
|
648
666
|
"typescript/no-empty-interface",
|
|
649
667
|
"typescript/no-inferrable-types",
|
|
668
|
+
"typescript/no-unnecessary-qualifier",
|
|
650
669
|
"typescript/parameter-properties",
|
|
651
670
|
"typescript/prefer-find",
|
|
652
671
|
"typescript/prefer-for-of",
|
|
@@ -660,6 +679,7 @@ const styleRules = [
|
|
|
660
679
|
"unicorn/catch-error-name",
|
|
661
680
|
"unicorn/consistent-date-clone",
|
|
662
681
|
"unicorn/consistent-existence-index-check",
|
|
682
|
+
"unicorn/consistent-template-literal-escape",
|
|
663
683
|
"unicorn/custom-error-definition",
|
|
664
684
|
"unicorn/empty-brace-spaces",
|
|
665
685
|
"unicorn/error-message",
|
|
@@ -699,6 +719,7 @@ const styleRules = [
|
|
|
699
719
|
"unicorn/require-array-join-separator",
|
|
700
720
|
"unicorn/require-module-attributes",
|
|
701
721
|
"unicorn/switch-case-braces",
|
|
722
|
+
"unicorn/switch-case-break-position",
|
|
702
723
|
"unicorn/text-encoding-identifier-case",
|
|
703
724
|
"unicorn/throw-new-error",
|
|
704
725
|
"vitest/consistent-test-filename",
|
|
@@ -711,6 +732,7 @@ const styleRules = [
|
|
|
711
732
|
"vitest/prefer-describe-function-title",
|
|
712
733
|
"vitest/prefer-expect-type-of",
|
|
713
734
|
"vitest/prefer-import-in-mock",
|
|
735
|
+
"vitest/prefer-importing-vitest-globals",
|
|
714
736
|
"vitest/prefer-strict-boolean-matchers",
|
|
715
737
|
"vitest/prefer-to-be-falsy",
|
|
716
738
|
"vitest/prefer-to-be-object",
|
|
@@ -786,6 +808,7 @@ const suspiciousRules = [
|
|
|
786
808
|
"react/no-namespace",
|
|
787
809
|
"react/react-in-jsx-scope",
|
|
788
810
|
"react/style-prop-object",
|
|
811
|
+
"typescript/consistent-return",
|
|
789
812
|
"typescript/no-confusing-non-null-assertion",
|
|
790
813
|
"typescript/no-extraneous-class",
|
|
791
814
|
"typescript/no-unnecessary-boolean-literal-compare",
|
|
@@ -793,6 +816,8 @@ const suspiciousRules = [
|
|
|
793
816
|
"typescript/no-unnecessary-type-arguments",
|
|
794
817
|
"typescript/no-unnecessary-type-assertion",
|
|
795
818
|
"typescript/no-unnecessary-type-constraint",
|
|
819
|
+
"typescript/no-unnecessary-type-conversion",
|
|
820
|
+
"typescript/no-unnecessary-type-parameters",
|
|
796
821
|
"typescript/no-unsafe-enum-comparison",
|
|
797
822
|
"typescript/no-unsafe-type-assertion",
|
|
798
823
|
"unicorn/consistent-function-scoping",
|
|
@@ -860,6 +885,7 @@ const restrictionRules = [
|
|
|
860
885
|
"react/no-react-children",
|
|
861
886
|
"react/no-unknown-property",
|
|
862
887
|
"react/only-export-components",
|
|
888
|
+
"react/prefer-function-component",
|
|
863
889
|
"typescript/explicit-function-return-type",
|
|
864
890
|
"typescript/explicit-module-boundary-types",
|
|
865
891
|
"typescript/no-dynamic-delete",
|
|
@@ -963,9 +989,11 @@ const correctnessRules = [
|
|
|
963
989
|
"jest/no-export",
|
|
964
990
|
"jest/no-focused-tests",
|
|
965
991
|
"jest/no-standalone-expect",
|
|
992
|
+
"jest/prefer-snapshot-hint",
|
|
966
993
|
"jest/require-to-throw-message",
|
|
967
994
|
"jest/valid-describe-callback",
|
|
968
995
|
"jest/valid-expect",
|
|
996
|
+
"jest/valid-expect-in-promise",
|
|
969
997
|
"jest/valid-title",
|
|
970
998
|
"jsdoc/check-property-names",
|
|
971
999
|
"jsdoc/check-tag-names",
|
|
@@ -1066,6 +1094,7 @@ const correctnessRules = [
|
|
|
1066
1094
|
"typescript/no-unnecessary-parameter-property-assignment",
|
|
1067
1095
|
"typescript/no-unsafe-declaration-merging",
|
|
1068
1096
|
"typescript/no-unsafe-unary-minus",
|
|
1097
|
+
"typescript/no-useless-default-assignment",
|
|
1069
1098
|
"typescript/no-useless-empty-export",
|
|
1070
1099
|
"typescript/no-wrapper-object-types",
|
|
1071
1100
|
"typescript/prefer-as-const",
|
|
@@ -1111,30 +1140,26 @@ const correctnessRules = [
|
|
|
1111
1140
|
"vitest/no-disabled-tests",
|
|
1112
1141
|
"vitest/no-focused-tests",
|
|
1113
1142
|
"vitest/no-standalone-expect",
|
|
1143
|
+
"vitest/prefer-snapshot-hint",
|
|
1114
1144
|
"vitest/require-to-throw-message",
|
|
1115
1145
|
"vitest/valid-describe-callback",
|
|
1116
1146
|
"vitest/valid-expect",
|
|
1147
|
+
"vitest/valid-expect-in-promise",
|
|
1117
1148
|
"vitest/valid-title"
|
|
1118
1149
|
];
|
|
1119
1150
|
const nurseryRules = [
|
|
1120
1151
|
"getter-return",
|
|
1152
|
+
"no-restricted-exports",
|
|
1121
1153
|
"no-undef",
|
|
1122
1154
|
"no-unreachable",
|
|
1155
|
+
"no-useless-assignment",
|
|
1123
1156
|
"import/export",
|
|
1124
1157
|
"import/named",
|
|
1125
1158
|
"promise/no-return-in-finally",
|
|
1126
1159
|
"react/require-render-return",
|
|
1127
|
-
"typescript/consistent-return",
|
|
1128
|
-
"typescript/consistent-type-exports",
|
|
1129
|
-
"typescript/dot-notation",
|
|
1130
1160
|
"typescript/no-unnecessary-condition",
|
|
1131
|
-
"typescript/no-unnecessary-qualifier",
|
|
1132
|
-
"typescript/no-unnecessary-type-conversion",
|
|
1133
|
-
"typescript/no-unnecessary-type-parameters",
|
|
1134
|
-
"typescript/no-useless-default-assignment",
|
|
1135
1161
|
"typescript/prefer-optional-chain",
|
|
1136
|
-
"
|
|
1137
|
-
"typescript/strict-void-return"
|
|
1162
|
+
"unicorn/no-useless-iterator-to-array"
|
|
1138
1163
|
];
|
|
1139
1164
|
const perfRules = [
|
|
1140
1165
|
"no-await-in-loop",
|
|
@@ -1247,6 +1272,7 @@ var unsupportedRules = {
|
|
|
1247
1272
|
"n/prefer-node-protocol": "No need to implement, already implemented by `unicorn/prefer-node-protocol`.",
|
|
1248
1273
|
"n/no-process-exit": "No need to implement, already implemented by `unicorn/no-process-exit`.",
|
|
1249
1274
|
"n/file-extension-in-import": "No need to implement, already implemented by `import/extensions`.",
|
|
1275
|
+
"n/no-callback-literal": "Use type-aware linting with `--type-aware --type-check` (or enable `options.typeAware` in config) and TypeScript callback typing (`err: Error | null | undefined`) to catch non-Error literals in error-first callbacks.",
|
|
1250
1276
|
"import/enforce-node-protocol-usage": "No need to implement, already implemented by `unicorn/prefer-node-protocol`.",
|
|
1251
1277
|
"import/no-deprecated": "No need to implement, already implemented by `typescript/no-deprecated` via tsgolint.",
|
|
1252
1278
|
"n/no-restricted-import": "No need to implement, already implemented by `no-restricted-imports` rule.",
|
|
@@ -1258,6 +1284,7 @@ var unsupportedRules = {
|
|
|
1258
1284
|
"jest/no-unnecessary-assertion": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1259
1285
|
"jest/unbound-method": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1260
1286
|
"jest/no-error-equal": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1287
|
+
"jest/valid-expect-with-promise": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1261
1288
|
"vitest/unbound-method": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1262
1289
|
"vitest/prefer-vi-mocked": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1263
1290
|
"eslint/no-process-env": "Deprecated, replaced by `node/no-process-env`, which we already support.",
|
|
@@ -2254,6 +2281,7 @@ const buildConfig = (configs, oxlintConfig, options) => {
|
|
|
2254
2281
|
detectNeededRulesPlugins(oxlintConfig);
|
|
2255
2282
|
detectEnvironmentByGlobals(oxlintConfig);
|
|
2256
2283
|
cleanUpOxlintConfig(oxlintConfig);
|
|
2284
|
+
warnAboutLargeRootGlobals(configs, oxlintConfig, options);
|
|
2257
2285
|
if (options?.typeAware) {
|
|
2258
2286
|
if ([...Object.keys(oxlintConfig.rules ?? {}), ...(oxlintConfig.overrides ?? []).flatMap((o) => Object.keys(o.rules ?? {}))].some((rule) => typeAwareRules.includes(rule))) oxlintConfig.options = {
|
|
2259
2287
|
...oxlintConfig.options,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.0",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"commander": "^14.0.0",
|
|
43
43
|
"globals": "^17.0.0",
|
|
44
|
-
"oxc-parser": "^0.
|
|
44
|
+
"oxc-parser": "^0.123.0",
|
|
45
45
|
"tinyglobby": "^0.2.14"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@antfu/eslint-config": "^
|
|
48
|
+
"@antfu/eslint-config": "^8.0.0",
|
|
49
49
|
"@babel/eslint-plugin": "^7.27.1",
|
|
50
50
|
"@e18e/eslint-plugin": "^0.3.0",
|
|
51
|
-
"@eslint-react/eslint-plugin": "^
|
|
51
|
+
"@eslint-react/eslint-plugin": "^4.0.0",
|
|
52
52
|
"@eslint/js": "^10.0.0",
|
|
53
53
|
"@logux/eslint-config": "^57.0.0",
|
|
54
|
-
"@oxc-node/core": "^0.0
|
|
54
|
+
"@oxc-node/core": "^0.1.0",
|
|
55
55
|
"@stylistic/eslint-plugin": "^5.0.0",
|
|
56
56
|
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
|
57
57
|
"@tanstack/eslint-plugin-query": "^5.91.4",
|
|
@@ -77,16 +77,16 @@
|
|
|
77
77
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
78
78
|
"eslint-plugin-react-perf": "^3.3.3",
|
|
79
79
|
"eslint-plugin-react-refresh": "^0.5.0",
|
|
80
|
-
"eslint-plugin-react-web-api": "^
|
|
80
|
+
"eslint-plugin-react-web-api": "^4.0.0",
|
|
81
81
|
"eslint-plugin-regexp": "^3.0.0",
|
|
82
82
|
"eslint-plugin-tsdoc": "^0.5.0",
|
|
83
|
-
"eslint-plugin-unicorn": "^
|
|
83
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
84
84
|
"husky": "^9.1.7",
|
|
85
85
|
"lint-staged": "^16.1.2",
|
|
86
86
|
"next": "^16.0.0",
|
|
87
|
-
"oxfmt": "^0.
|
|
88
|
-
"oxlint": "^1.
|
|
89
|
-
"oxlint-tsgolint": "^0.
|
|
87
|
+
"oxfmt": "^0.43.0",
|
|
88
|
+
"oxlint": "^1.60.0",
|
|
89
|
+
"oxlint-tsgolint": "^0.19.0",
|
|
90
90
|
"tsdown": "^0.21.0",
|
|
91
91
|
"typescript": "^6.0.0",
|
|
92
92
|
"typescript-eslint": "^8.35.0",
|