@oxlint/migrate 1.14.0 → 1.16.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.
@@ -8,6 +8,7 @@ import packageJson from "../package.json.mjs";
8
8
  import { walkAndReplaceProjectFiles } from "../src/walker/index.mjs";
9
9
  import { getAllProjectFiles } from "./project-loader.mjs";
10
10
  import { writeFile } from "node:fs/promises";
11
+ import { preFixForJsPlugins } from "../src/js_plugin_fixes.mjs";
11
12
  const cwd = process.cwd();
12
13
  const getFileContent = (absoluteFilePath) => {
13
14
  try {
@@ -60,7 +61,9 @@ program.name("oxlint-migrate").version(packageJson.version).argument("[eslint-co
60
61
  if (filePath === void 0) {
61
62
  program.error(`could not autodetect eslint config file`);
62
63
  }
64
+ const resetPreFix = await preFixForJsPlugins();
63
65
  const eslintConfigs = await loadESLintConfig(filePath);
66
+ resetPreFix();
64
67
  let config;
65
68
  if (options.merge && existsSync(oxlintFilePath)) {
66
69
  config = JSON.parse(
@@ -1,4 +1,4 @@
1
- const version = "1.14.0";
1
+ const version = "1.16.0";
2
2
  const packageJson = {
3
3
  version
4
4
  };
@@ -25,14 +25,11 @@ const cleanUpDefaultTypeScriptOverridesForEslint = (config) => {
25
25
  if (config.overrides === void 0) {
26
26
  return;
27
27
  }
28
- const indexesToDelete = [];
29
- for (const index in config.overrides) {
30
- const override = config.overrides[index];
28
+ for (const [index, override] of config.overrides.entries()) {
31
29
  if (isEqualDeep(override, TS_ESLINT_DEFAULT_OVERRIDE)) {
32
- indexesToDelete.push(index);
30
+ delete config.overrides[index];
33
31
  }
34
32
  }
35
- indexesToDelete.forEach((index) => delete config.overrides[index]);
36
33
  config.overrides = config.overrides.filter(
37
34
  (overrides) => Object.keys(overrides).length > 0
38
35
  );
@@ -48,8 +45,8 @@ const cleanUpUselessOverridesEntries = (config) => {
48
45
  if (config.overrides === void 0) {
49
46
  return;
50
47
  }
51
- for (const overrideIndex in config.overrides) {
52
- if (Object.keys(config.overrides[overrideIndex]).length === 1) {
48
+ for (const [overrideIndex, override] of config.overrides.entries()) {
49
+ if (Object.keys(override).length === 1) {
53
50
  delete config.overrides[overrideIndex];
54
51
  }
55
52
  }
@@ -13,7 +13,8 @@ const rulesPrefixesForPlugins = {
13
13
  "react-hooks": "react",
14
14
  "@typescript-eslint": "typescript",
15
15
  unicorn: "unicorn",
16
- vitest: "vitest"
16
+ vitest: "vitest",
17
+ vue: "vue"
17
18
  };
18
19
  const typescriptRulesExtendEslintRules = [
19
20
  "class-methods-use-this",
@@ -40,6 +40,7 @@ const pedanticRules = [
40
40
  "@typescript-eslint/ban-ts-comment",
41
41
  "@typescript-eslint/ban-types",
42
42
  "@typescript-eslint/no-misused-promises",
43
+ "@typescript-eslint/no-confusing-void-expression",
43
44
  "@typescript-eslint/no-mixed-enums",
44
45
  "@typescript-eslint/no-unsafe-argument",
45
46
  "@typescript-eslint/no-unsafe-assignment",
@@ -114,6 +115,7 @@ const styleRules = [
114
115
  "init-declarations",
115
116
  "max-params",
116
117
  "new-cap",
118
+ "no-useless-computed-key",
117
119
  "no-duplicate-imports",
118
120
  "no-extra-label",
119
121
  "no-labels",
@@ -257,6 +259,8 @@ const styleRules = [
257
259
  "vitest/prefer-to-be-falsy",
258
260
  "vitest/prefer-to-be-object",
259
261
  "vitest/prefer-to-be-truthy",
262
+ "vue/define-emits-declaration",
263
+ "vue/define-props-declaration",
260
264
  "@typescript-eslint/default-param-last",
261
265
  "@typescript-eslint/init-declarations",
262
266
  "@typescript-eslint/max-params",
@@ -305,6 +309,7 @@ const suspiciousRules = [
305
309
  "no-unexpected-multiline",
306
310
  "no-useless-concat",
307
311
  "no-useless-constructor",
312
+ "preserve-caught-error",
308
313
  "import/no-unassigned-import",
309
314
  "import/no-empty-named-blocks",
310
315
  "import/no-absolute-path",
@@ -330,6 +335,7 @@ const suspiciousRules = [
330
335
  "@typescript-eslint/no-unsafe-enum-comparison",
331
336
  "@typescript-eslint/no-unsafe-type-assertion",
332
337
  "unicorn/consistent-function-scoping",
338
+ "unicorn/no-array-reverse",
333
339
  "unicorn/no-instanceof-builtins",
334
340
  "unicorn/no-accessor-recursion",
335
341
  "unicorn/prefer-add-event-listener",
@@ -344,6 +350,7 @@ const suspiciousRules = [
344
350
  "vitest/no-commented-out-tests"
345
351
  ];
346
352
  const restrictionRules = [
353
+ "class-methods-use-this",
347
354
  "default-case",
348
355
  "no-alert",
349
356
  "no-bitwise",
@@ -408,6 +415,8 @@ const restrictionRules = [
408
415
  "unicorn/prefer-modern-math-apis",
409
416
  "unicorn/prefer-node-protocol",
410
417
  "unicorn/prefer-number-properties",
418
+ "vue/no-multiple-slot-args",
419
+ "@typescript-eslint/class-methods-use-this",
411
420
  "@typescript-eslint/no-restricted-imports",
412
421
  "@typescript-eslint/no-empty-function",
413
422
  "@typescript-eslint/no-unused-expressions",
@@ -564,7 +573,6 @@ const correctnessRules = [
564
573
  "@typescript-eslint/no-floating-promises",
565
574
  "@typescript-eslint/no-array-delete",
566
575
  "@typescript-eslint/no-base-to-string",
567
- "@typescript-eslint/no-confusing-void-expression",
568
576
  "@typescript-eslint/no-duplicate-enum-values",
569
577
  "@typescript-eslint/no-duplicate-type-constituents",
570
578
  "@typescript-eslint/no-extra-non-null-assertion",
@@ -602,6 +610,7 @@ const correctnessRules = [
602
610
  "vitest/no-conditional-tests",
603
611
  "vitest/require-local-test-context-for-concurrent-snapshots",
604
612
  "vue/valid-define-emits",
613
+ "vue/valid-define-props",
605
614
  "@typescript-eslint/no-dupe-class-members",
606
615
  "@typescript-eslint/no-loss-of-precision",
607
616
  "@typescript-eslint/no-unused-vars",
@@ -14,11 +14,6 @@ const transformIgnorePatterns = (eslintConfig, targetConfig, options) => {
14
14
  targetConfig.ignorePatterns.push(ignores);
15
15
  }
16
16
  }
17
- eslintConfig.ignores.filter((ignore) => ignore.startsWith("!")).forEach(
18
- (ignore) => options?.reporter !== void 0 && options.reporter(
19
- `ignore allow list is currently not supported: ${ignore}`
20
- )
21
- );
22
17
  };
23
18
  export {
24
19
  transformIgnorePatterns
@@ -1,4 +1,5 @@
1
1
  import { Linter } from 'eslint';
2
2
  type PossibleConfigs = Linter.Config | Linter.Config[] | Promise<Linter.Config> | Promise<Linter.Config[]>;
3
3
  export default function fixForJsPlugins(configs: PossibleConfigs): PossibleConfigs;
4
+ export declare const preFixForJsPlugins: () => Promise<() => void>;
4
5
  export {};
@@ -8,9 +8,31 @@ const fixForAntfuEslintConfig = (config) => {
8
8
  }
9
9
  return config;
10
10
  };
11
+ const fixForNextEslintConfig = async () => {
12
+ if ("Deno" in globalThis || "Bun" in globalThis) {
13
+ return () => {
14
+ };
15
+ }
16
+ const Module = await import("module");
17
+ const mod = Module.default || Module;
18
+ const originalLoad = mod._load;
19
+ mod._load = function(request, ...args) {
20
+ if (request && request.includes("@rushstack/eslint-patch")) {
21
+ return {};
22
+ }
23
+ return originalLoad.apply(mod, [request, ...args]);
24
+ };
25
+ return () => {
26
+ mod._load = originalLoad;
27
+ };
28
+ };
11
29
  function fixForJsPlugins(configs) {
12
30
  return fixForAntfuEslintConfig(configs);
13
31
  }
32
+ const preFixForJsPlugins = () => {
33
+ return fixForNextEslintConfig();
34
+ };
14
35
  export {
15
- fixForJsPlugins as default
36
+ fixForJsPlugins as default,
37
+ preFixForJsPlugins
16
38
  };
@@ -13,20 +13,20 @@ const normalizeSeverityValue = (value) => {
13
13
  }
14
14
  if (isWarnValue(value)) {
15
15
  if (Array.isArray(value)) {
16
- value[0] == "warn";
16
+ value[0] = "warn";
17
17
  return value;
18
18
  }
19
19
  return "warn";
20
20
  } else if (isErrorValue(value)) {
21
21
  if (Array.isArray(value)) {
22
- value[0] == "error";
22
+ value[0] = "error";
23
23
  return value;
24
24
  }
25
25
  return "error";
26
26
  }
27
27
  if (isOffValue(value)) {
28
28
  if (Array.isArray(value)) {
29
- value[0] == "off";
29
+ value[0] = "off";
30
30
  return value;
31
31
  }
32
32
  return "off";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  "generate": "node --import @oxc-node/core/register ./scripts/generate.ts",
20
20
  "format": "npx prettier --write .",
21
21
  "type-check": "tsc --noEmit",
22
- "lint": "oxlint",
22
+ "lint": "oxlint --type-aware",
23
23
  "test": "vitest",
24
24
  "build": "vite build",
25
25
  "manual-test": "pnpm build; chmod +x dist/bin/oxlint-migrate.mjs; npx ."
@@ -50,22 +50,25 @@
50
50
  "@typescript-eslint/parser": "^8.35.0",
51
51
  "@vitest/coverage-v8": "^3.2.4",
52
52
  "eslint": "^9.29.0",
53
+ "eslint-config-next": "^15.5.0",
53
54
  "eslint-config-prettier": "^10.1.5",
54
55
  "eslint-plugin-header": "^3.1.1",
55
56
  "eslint-plugin-import": "^2.32.0",
56
57
  "eslint-plugin-import-x": "^4.16.0",
57
- "eslint-plugin-jsdoc": "^54.0.0",
58
+ "eslint-plugin-jsdoc": "^57.0.0",
58
59
  "eslint-plugin-local": "^6.0.0",
59
60
  "eslint-plugin-oxlint": "^1.3.0",
60
61
  "eslint-plugin-react": "^7.37.5",
61
62
  "eslint-plugin-react-hooks": "^5.2.0",
62
63
  "eslint-plugin-react-perf": "^3.3.3",
63
64
  "eslint-plugin-regexp": "^2.9.0",
64
- "eslint-plugin-unicorn": "^60.0.0",
65
+ "eslint-plugin-unicorn": "^61.0.0",
65
66
  "husky": "^9.1.7",
66
67
  "jiti": "^2.4.2",
67
68
  "lint-staged": "^16.1.2",
68
- "oxlint": "^1.14.0",
69
+ "next": "^15.5.0",
70
+ "oxlint": "^1.16.0",
71
+ "oxlint-tsgolint": "^0.2.0",
69
72
  "prettier": "^3.6.1",
70
73
  "typescript": "^5.8.3",
71
74
  "typescript-eslint": "^8.35.0",
@@ -78,12 +81,12 @@
78
81
  },
79
82
  "dependencies": {
80
83
  "commander": "^14.0.0",
81
- "oxc-parser": "^0.82.0",
84
+ "globals": "^16.3.0",
85
+ "oxc-parser": "^0.89.0",
82
86
  "tinyglobby": "^0.2.14"
83
87
  },
84
88
  "peerDependencies": {
85
- "globals": "^14.0.0 || ^15.0.0 || ^16.0.0",
86
89
  "jiti": "*"
87
90
  },
88
- "packageManager": "pnpm@10.15.0"
91
+ "packageManager": "pnpm@10.16.1"
89
92
  }