@oxlint/migrate 1.59.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",
|
|
@@ -600,10 +610,12 @@ const styleRules = [
|
|
|
600
610
|
"jest/prefer-called-with",
|
|
601
611
|
"jest/prefer-comparison-matcher",
|
|
602
612
|
"jest/prefer-each",
|
|
613
|
+
"jest/prefer-ending-with-an-expect",
|
|
603
614
|
"jest/prefer-equality-matcher",
|
|
604
615
|
"jest/prefer-expect-resolves",
|
|
605
616
|
"jest/prefer-hooks-in-order",
|
|
606
617
|
"jest/prefer-hooks-on-top",
|
|
618
|
+
"jest/prefer-importing-jest-globals",
|
|
607
619
|
"jest/prefer-jest-mocked",
|
|
608
620
|
"jest/prefer-lowercase-title",
|
|
609
621
|
"jest/prefer-mock-promise-shorthand",
|
|
@@ -653,6 +665,7 @@ const styleRules = [
|
|
|
653
665
|
"typescript/dot-notation",
|
|
654
666
|
"typescript/no-empty-interface",
|
|
655
667
|
"typescript/no-inferrable-types",
|
|
668
|
+
"typescript/no-unnecessary-qualifier",
|
|
656
669
|
"typescript/parameter-properties",
|
|
657
670
|
"typescript/prefer-find",
|
|
658
671
|
"typescript/prefer-for-of",
|
|
@@ -666,6 +679,7 @@ const styleRules = [
|
|
|
666
679
|
"unicorn/catch-error-name",
|
|
667
680
|
"unicorn/consistent-date-clone",
|
|
668
681
|
"unicorn/consistent-existence-index-check",
|
|
682
|
+
"unicorn/consistent-template-literal-escape",
|
|
669
683
|
"unicorn/custom-error-definition",
|
|
670
684
|
"unicorn/empty-brace-spaces",
|
|
671
685
|
"unicorn/error-message",
|
|
@@ -803,6 +817,7 @@ const suspiciousRules = [
|
|
|
803
817
|
"typescript/no-unnecessary-type-assertion",
|
|
804
818
|
"typescript/no-unnecessary-type-constraint",
|
|
805
819
|
"typescript/no-unnecessary-type-conversion",
|
|
820
|
+
"typescript/no-unnecessary-type-parameters",
|
|
806
821
|
"typescript/no-unsafe-enum-comparison",
|
|
807
822
|
"typescript/no-unsafe-type-assertion",
|
|
808
823
|
"unicorn/consistent-function-scoping",
|
|
@@ -978,6 +993,7 @@ const correctnessRules = [
|
|
|
978
993
|
"jest/require-to-throw-message",
|
|
979
994
|
"jest/valid-describe-callback",
|
|
980
995
|
"jest/valid-expect",
|
|
996
|
+
"jest/valid-expect-in-promise",
|
|
981
997
|
"jest/valid-title",
|
|
982
998
|
"jsdoc/check-property-names",
|
|
983
999
|
"jsdoc/check-tag-names",
|
|
@@ -1078,6 +1094,7 @@ const correctnessRules = [
|
|
|
1078
1094
|
"typescript/no-unnecessary-parameter-property-assignment",
|
|
1079
1095
|
"typescript/no-unsafe-declaration-merging",
|
|
1080
1096
|
"typescript/no-unsafe-unary-minus",
|
|
1097
|
+
"typescript/no-useless-default-assignment",
|
|
1081
1098
|
"typescript/no-useless-empty-export",
|
|
1082
1099
|
"typescript/no-wrapper-object-types",
|
|
1083
1100
|
"typescript/prefer-as-const",
|
|
@@ -1127,6 +1144,7 @@ const correctnessRules = [
|
|
|
1127
1144
|
"vitest/require-to-throw-message",
|
|
1128
1145
|
"vitest/valid-describe-callback",
|
|
1129
1146
|
"vitest/valid-expect",
|
|
1147
|
+
"vitest/valid-expect-in-promise",
|
|
1130
1148
|
"vitest/valid-title"
|
|
1131
1149
|
];
|
|
1132
1150
|
const nurseryRules = [
|
|
@@ -1140,12 +1158,7 @@ const nurseryRules = [
|
|
|
1140
1158
|
"promise/no-return-in-finally",
|
|
1141
1159
|
"react/require-render-return",
|
|
1142
1160
|
"typescript/no-unnecessary-condition",
|
|
1143
|
-
"typescript/no-unnecessary-qualifier",
|
|
1144
|
-
"typescript/no-unnecessary-type-parameters",
|
|
1145
|
-
"typescript/no-useless-default-assignment",
|
|
1146
1161
|
"typescript/prefer-optional-chain",
|
|
1147
|
-
"typescript/prefer-readonly-parameter-types",
|
|
1148
|
-
"typescript/strict-void-return",
|
|
1149
1162
|
"unicorn/no-useless-iterator-to-array"
|
|
1150
1163
|
];
|
|
1151
1164
|
const perfRules = [
|
|
@@ -1259,6 +1272,7 @@ var unsupportedRules = {
|
|
|
1259
1272
|
"n/prefer-node-protocol": "No need to implement, already implemented by `unicorn/prefer-node-protocol`.",
|
|
1260
1273
|
"n/no-process-exit": "No need to implement, already implemented by `unicorn/no-process-exit`.",
|
|
1261
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.",
|
|
1262
1276
|
"import/enforce-node-protocol-usage": "No need to implement, already implemented by `unicorn/prefer-node-protocol`.",
|
|
1263
1277
|
"import/no-deprecated": "No need to implement, already implemented by `typescript/no-deprecated` via tsgolint.",
|
|
1264
1278
|
"n/no-restricted-import": "No need to implement, already implemented by `no-restricted-imports` rule.",
|
|
@@ -1270,6 +1284,7 @@ var unsupportedRules = {
|
|
|
1270
1284
|
"jest/no-unnecessary-assertion": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1271
1285
|
"jest/unbound-method": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1272
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.",
|
|
1273
1288
|
"vitest/unbound-method": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1274
1289
|
"vitest/prefer-vi-mocked": "Requires type information. Not currently possible to implement in oxlint.",
|
|
1275
1290
|
"eslint/no-process-env": "Deprecated, replaced by `node/no-process-env`, which we already support.",
|
|
@@ -2266,6 +2281,7 @@ const buildConfig = (configs, oxlintConfig, options) => {
|
|
|
2266
2281
|
detectNeededRulesPlugins(oxlintConfig);
|
|
2267
2282
|
detectEnvironmentByGlobals(oxlintConfig);
|
|
2268
2283
|
cleanUpOxlintConfig(oxlintConfig);
|
|
2284
|
+
warnAboutLargeRootGlobals(configs, oxlintConfig, options);
|
|
2269
2285
|
if (options?.typeAware) {
|
|
2270
2286
|
if ([...Object.keys(oxlintConfig.rules ?? {}), ...(oxlintConfig.overrides ?? []).flatMap((o) => Object.keys(o.rules ?? {}))].some((rule) => typeAwareRules.includes(rule))) oxlintConfig.options = {
|
|
2271
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",
|
|
@@ -45,10 +45,10 @@
|
|
|
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
54
|
"@oxc-node/core": "^0.1.0",
|
|
@@ -77,15 +77,15 @@
|
|
|
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
87
|
"oxfmt": "^0.43.0",
|
|
88
|
-
"oxlint": "^1.
|
|
88
|
+
"oxlint": "^1.60.0",
|
|
89
89
|
"oxlint-tsgolint": "^0.19.0",
|
|
90
90
|
"tsdown": "^0.21.0",
|
|
91
91
|
"typescript": "^6.0.0",
|