@oxlint/migrate 0.0.5 → 0.15.12

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,4 +1,4 @@
1
- const version = "0.0.5";
1
+ const version = "0.15.12";
2
2
  const packageJson = {
3
3
  version
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import { removeGlobalsWithAreCoveredByEnv, transformBoolGlobalToString, ES_VERSIONS, cleanUpUselessOverridesEnv } from "./env_globals.mjs";
2
- import { cleanUpUselessOverridesRules, cleanUpUselessOverridesPlugins } from "./plugins_rules.mjs";
2
+ import { replaceTypescriptAliasRules, cleanUpUselessOverridesRules, cleanUpUselessOverridesPlugins } from "./plugins_rules.mjs";
3
3
  const isEqualDeep = (a, b) => {
4
4
  if (a === b) {
5
5
  return true;
@@ -50,6 +50,7 @@ const cleanUpDefaultTypeScriptOverridesForEslint = (config) => {
50
50
  }
51
51
  };
52
52
  const cleanUpUselessOverridesEntries = (config) => {
53
+ cleanUpDefaultTypeScriptOverridesForEslint(config);
53
54
  cleanUpUselessOverridesRules(config);
54
55
  cleanUpUselessOverridesPlugins(config);
55
56
  cleanUpUselessOverridesEnv(config);
@@ -71,6 +72,7 @@ const cleanUpUselessOverridesEntries = (config) => {
71
72
  const cleanUpOxlintConfig = (config) => {
72
73
  removeGlobalsWithAreCoveredByEnv(config);
73
74
  transformBoolGlobalToString(config);
75
+ replaceTypescriptAliasRules(config);
74
76
  if (config.globals !== void 0 && Object.keys(config.globals).length === 0) {
75
77
  delete config.globals;
76
78
  }
@@ -88,7 +90,6 @@ const cleanUpOxlintConfig = (config) => {
88
90
  }
89
91
  }
90
92
  if (!("files" in config)) {
91
- cleanUpDefaultTypeScriptOverridesForEslint(config);
92
93
  cleanUpUselessOverridesEntries(config);
93
94
  }
94
95
  };
@@ -1 +1,2 @@
1
1
  export declare const rulesPrefixesForPlugins: Record<string, string>;
2
+ export declare const typescriptRulesExtendEslintRules: string[];
@@ -1,10 +1,12 @@
1
1
  const rulesPrefixesForPlugins = {
2
2
  import: "import",
3
+ "import-x": "import",
3
4
  jest: "jest",
4
5
  jsdoc: "jsdoc",
5
6
  "jsx-a11y": "jsx-a11y",
6
7
  "@next/next": "nextjs",
7
8
  node: "node",
9
+ n: "node",
8
10
  promise: "promise",
9
11
  react: "react",
10
12
  "react-perf": "react",
@@ -12,6 +14,27 @@ const rulesPrefixesForPlugins = {
12
14
  unicorn: "unicorn",
13
15
  vitest: "vitest"
14
16
  };
17
+ const typescriptRulesExtendEslintRules = [
18
+ "class-methods-use-this",
19
+ "default-param-last",
20
+ "init-declarations",
21
+ "max-params",
22
+ "no-array-constructor",
23
+ "no-dupe-class-members",
24
+ "no-empty-function",
25
+ "no-invalid-this",
26
+ "no-loop-func",
27
+ "no-loss-of-precision",
28
+ "no-magic-numbers",
29
+ "no-redeclare",
30
+ "no-restricted-imports",
31
+ "no-shadow",
32
+ "no-unused-expressions",
33
+ "no-unused-vars",
34
+ "no-use-before-define",
35
+ "no-useless-constructor"
36
+ ];
15
37
  export {
16
- rulesPrefixesForPlugins
38
+ rulesPrefixesForPlugins,
39
+ typescriptRulesExtendEslintRules
17
40
  };
@@ -61,6 +61,9 @@ const removeGlobalsWithAreCoveredByEnv = (config) => {
61
61
  }
62
62
  }
63
63
  }
64
+ if (Object.keys(config.globals).length === 0) {
65
+ delete config.globals;
66
+ }
64
67
  };
65
68
  const transformBoolGlobalToString = (config) => {
66
69
  if (config.globals === void 0) {
@@ -9,13 +9,18 @@ const rules = [
9
9
  "func-style",
10
10
  "func-names",
11
11
  "getter-return",
12
+ "grouped-accessor-pairs",
12
13
  "guard-for-in",
13
14
  "init-declarations",
15
+ "max-nested-callbacks",
16
+ "max-lines-per-function",
14
17
  "max-classes-per-file",
18
+ "max-depth",
15
19
  "max-lines",
16
20
  "max-params",
17
21
  "new-cap",
18
22
  "no-useless-call",
23
+ "no-unneeded-ternary",
19
24
  "no-extra-label",
20
25
  "no-multi-assign",
21
26
  "no-nested-ternary",
@@ -393,6 +398,7 @@ const rules = [
393
398
  "unicorn/explicit-length-check",
394
399
  "unicorn/filename-case",
395
400
  "unicorn/new-for-builtins",
401
+ "unicorn/no-invalid-fetch-options",
396
402
  "unicorn/no-abusive-eslint-disable",
397
403
  "unicorn/no-anonymous-default-export",
398
404
  "unicorn/no-array-for-each",
@@ -494,6 +500,25 @@ const rules = [
494
500
  "@typescript-eslint/no-unused-expressions",
495
501
  "@typescript-eslint/no-unused-vars",
496
502
  "@typescript-eslint/no-useless-constructor",
503
+ "import-x/default",
504
+ "import-x/export",
505
+ "import-x/first",
506
+ "import-x/no-named-default",
507
+ "import-x/no-namespace",
508
+ "import-x/max-dependencies",
509
+ "import-x/named",
510
+ "import-x/namespace",
511
+ "import-x/no-amd",
512
+ "import-x/no-commonjs",
513
+ "import-x/no-cycle",
514
+ "import-x/no-default-export",
515
+ "import-x/no-duplicates",
516
+ "import-x/no-dynamic-require",
517
+ "import-x/no-named-as-default",
518
+ "import-x/no-named-as-default-member",
519
+ "import-x/no-self-import",
520
+ "import-x/no-webpack-loader-syntax",
521
+ "import-x/unambiguous",
497
522
  "vitest/consistent-test-it",
498
523
  "vitest/expect-expect",
499
524
  "vitest/max-expects",
@@ -542,7 +567,9 @@ const nurseryRules = [
542
567
  "react-hooks/exhaustive-deps",
543
568
  "react/require-render-return",
544
569
  "@typescript-eslint/consistent-type-imports",
545
- "@typescript-eslint/no-restricted-imports"
570
+ "@typescript-eslint/no-restricted-imports",
571
+ "import-x/export",
572
+ "import-x/named"
546
573
  ];
547
574
  export {
548
575
  rules as default,
@@ -4,3 +4,4 @@ export declare const transformRuleEntry: (eslintConfig: Linter.Config, targetCon
4
4
  export declare const detectNeededRulesPlugins: (targetConfig: OxlintConfigOrOverride, reporter?: Reporter) => void;
5
5
  export declare const cleanUpUselessOverridesPlugins: (config: OxlintConfig) => void;
6
6
  export declare const cleanUpUselessOverridesRules: (config: OxlintConfig) => void;
7
+ export declare const replaceTypescriptAliasRules: (config: OxlintConfigOrOverride) => void;
@@ -1,5 +1,5 @@
1
1
  import rules, { nurseryRules } from "./generated/rules.mjs";
2
- import { rulesPrefixesForPlugins } from "./constants.mjs";
2
+ import { rulesPrefixesForPlugins, typescriptRulesExtendEslintRules } from "./constants.mjs";
3
3
  const isValueInSet = (value, validSet) => validSet.includes(value) || Array.isArray(value) && validSet.includes(value[0]);
4
4
  const isActiveValue = (value) => isValueInSet(value, ["error", "warn", 1, 2]);
5
5
  const transformRuleEntry = (eslintConfig, targetConfig, reporter) => {
@@ -84,9 +84,30 @@ const cleanUpUselessOverridesRules = (config) => {
84
84
  }
85
85
  }
86
86
  };
87
+ const replaceTypescriptAliasRules = (config) => {
88
+ if (config.rules === void 0) {
89
+ return;
90
+ }
91
+ for (const rule of Object.keys(config.rules)) {
92
+ const prefix = "@typescript-eslint/";
93
+ if (!rule.startsWith(prefix)) {
94
+ continue;
95
+ }
96
+ const eslintRule = rule.slice(prefix.length);
97
+ if (!typescriptRulesExtendEslintRules.includes(eslintRule)) {
98
+ continue;
99
+ }
100
+ config.rules[eslintRule] = config.rules[rule];
101
+ delete config.rules[rule];
102
+ }
103
+ if (Object.keys(config.rules).length === 0) {
104
+ delete config.rules;
105
+ }
106
+ };
87
107
  export {
88
108
  cleanUpUselessOverridesPlugins,
89
109
  cleanUpUselessOverridesRules,
90
110
  detectNeededRulesPlugins,
111
+ replaceTypescriptAliasRules,
91
112
  transformRuleEntry
92
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "0.0.5",
3
+ "version": "0.15.12",
4
4
  "description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,7 +34,7 @@
34
34
  "devDependencies": {
35
35
  "@antfu/eslint-config": "^4.2.0",
36
36
  "@eslint/js": "^9.20.0",
37
- "@logux/eslint-config": "^54.0.0",
37
+ "@logux/eslint-config": "^55.0.0",
38
38
  "@oxc-node/core": "^0.0.19",
39
39
  "@stylistic/eslint-plugin-ts": "^4.0.0",
40
40
  "@types/eslint-config-prettier": "^6.11.3",
@@ -43,6 +43,7 @@
43
43
  "eslint": "^9.20.1",
44
44
  "eslint-config-prettier": "^10.0.1",
45
45
  "eslint-plugin-header": "^3.1.1",
46
+ "eslint-plugin-import-x": "^4.6.1",
46
47
  "eslint-plugin-jsdoc": "^50.6.3",
47
48
  "eslint-plugin-local": "^6.0.0",
48
49
  "eslint-plugin-oxlint": "^0.15.10",
@@ -50,7 +51,7 @@
50
51
  "eslint-plugin-unicorn": "^57.0.0",
51
52
  "husky": "^9.1.7",
52
53
  "lint-staged": "^15.4.3",
53
- "oxlint": "^0.15.11",
54
+ "oxlint": "^0.15.12",
54
55
  "prettier": "^3.5.1",
55
56
  "typescript": "^5.7.3",
56
57
  "typescript-eslint": "^8.24.0",
@@ -63,7 +64,7 @@
63
64
  },
64
65
  "dependencies": {
65
66
  "commander": "^13.1.0",
66
- "globals": "^15.15.0"
67
+ "globals": "^16.0.0"
67
68
  },
68
69
  "packageManager": "pnpm@10.4.1"
69
70
  }