@oxlint/migrate 1.10.0 → 1.11.1

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 CHANGED
@@ -19,6 +19,7 @@ When no config file provided, the script searches for the default eslint config
19
19
  | Options | Description |
20
20
  | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
21
21
  | `--merge` | \* merge eslint configuration with an existing .oxlintrc.json configuration |
22
+ | `--type-aware` | Include type aware rules, which are supported with `oxlint --type-aware` |
22
23
  | `--with-nursery` | Include oxlint rules which are currently under development |
23
24
  | `--output-file <file>` | The oxlint configuration file where to eslint v9 rules will be written to, default: `.oxlintrc.json` |
24
25
  | `--replace-eslint-comments` | Search in the project files for eslint comments and replaces them with oxlint. Some eslint comments are not supported and will be reported. |
@@ -31,13 +31,17 @@ program.name("oxlint-migrate").version(packageJson.version).argument("[eslint-co
31
31
  ).option(
32
32
  "--replace-eslint-comments",
33
33
  "Search in the project files for eslint comments and replaces them with oxlint. Some eslint comments are not supported and will be reported."
34
+ ).option(
35
+ "--type-aware",
36
+ "Includes supported type-aware rules. Needs the same flag in `oxlint` to enable it."
34
37
  ).action(async (filePath) => {
35
38
  const cliOptions = program.opts();
36
39
  const oxlintFilePath = path.join(cwd, cliOptions.outputFile);
37
40
  const options = {
38
41
  reporter: console.warn,
39
42
  merge: !!cliOptions.merge,
40
- withNursery: !!cliOptions.withNursery
43
+ withNursery: !!cliOptions.withNursery,
44
+ typeAware: !!cliOptions.typeAware
41
45
  };
42
46
  if (cliOptions.replaceEslintComments) {
43
47
  await walkAndReplaceProjectFiles(
@@ -1,4 +1,4 @@
1
- const version = "1.10.0";
1
+ const version = "1.11.1";
2
2
  const packageJson = {
3
3
  version
4
4
  };
@@ -1,2 +1,3 @@
1
1
  export declare const rulesPrefixesForPlugins: Record<string, string>;
2
2
  export declare const typescriptRulesExtendEslintRules: string[];
3
+ export declare const typescriptTypeAwareRules: string[];
@@ -35,7 +35,69 @@ const typescriptRulesExtendEslintRules = [
35
35
  "no-use-before-define",
36
36
  "no-useless-constructor"
37
37
  ];
38
+ const typescriptTypeAwareRules = [
39
+ "@typescript-eslint/await-thenable",
40
+ "@typescript-eslint/consistent-return",
41
+ "@typescript-eslint/consistent-type-exports",
42
+ "@typescript-eslint/dot-notation",
43
+ "@typescript-eslint/naming-convention",
44
+ "@typescript-eslint/no-array-delete",
45
+ "@typescript-eslint/no-base-to-string",
46
+ "@typescript-eslint/no-confusing-void-expression",
47
+ "@typescript-eslint/no-deprecated",
48
+ "@typescript-eslint/no-duplicate-type-constituents",
49
+ "@typescript-eslint/no-floating-promises",
50
+ "@typescript-eslint/no-for-in-array",
51
+ "@typescript-eslint/no-implied-eval",
52
+ "@typescript-eslint/no-meaningless-void-operator",
53
+ "@typescript-eslint/no-misused-promises",
54
+ "@typescript-eslint/no-misused-spread",
55
+ "@typescript-eslint/no-mixed-enums",
56
+ "@typescript-eslint/no-redundant-type-constituents",
57
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare",
58
+ "@typescript-eslint/no-unnecessary-condition",
59
+ "@typescript-eslint/no-unnecessary-qualifier",
60
+ "@typescript-eslint/no-unnecessary-template-expression",
61
+ "@typescript-eslint/no-unnecessary-type-arguments",
62
+ "@typescript-eslint/no-unnecessary-type-assertion",
63
+ "@typescript-eslint/no-unnecessary-type-conversion",
64
+ "@typescript-eslint/no-unnecessary-type-parameters",
65
+ "@typescript-eslint/no-unsafe-argument",
66
+ "@typescript-eslint/no-unsafe-assignment",
67
+ "@typescript-eslint/no-unsafe-call",
68
+ "@typescript-eslint/no-unsafe-enum-comparison",
69
+ "@typescript-eslint/no-unsafe-member-access",
70
+ "@typescript-eslint/no-unsafe-return",
71
+ "@typescript-eslint/no-unsafe-type-assertion",
72
+ "@typescript-eslint/no-unsafe-unary-minus",
73
+ "@typescript-eslint/non-nullable-type-assertion-style",
74
+ "@typescript-eslint/only-throw-error",
75
+ "@typescript-eslint/prefer-destructuring",
76
+ "@typescript-eslint/prefer-find",
77
+ "@typescript-eslint/prefer-includes",
78
+ "@typescript-eslint/prefer-nullish-coalescing",
79
+ "@typescript-eslint/prefer-optional-chain",
80
+ "@typescript-eslint/prefer-promise-reject-errors",
81
+ "@typescript-eslint/prefer-readonly",
82
+ "@typescript-eslint/prefer-readonly-parameter-types",
83
+ "@typescript-eslint/prefer-reduce-type-parameter",
84
+ "@typescript-eslint/prefer-regexp-exec",
85
+ "@typescript-eslint/prefer-return-this-type",
86
+ "@typescript-eslint/prefer-string-starts-ends-with",
87
+ "@typescript-eslint/promise-function-async",
88
+ "@typescript-eslint/related-getter-setter-pairs",
89
+ "@typescript-eslint/require-array-sort-compare",
90
+ "@typescript-eslint/require-await",
91
+ "@typescript-eslint/restrict-plus-operands",
92
+ "@typescript-eslint/restrict-template-expressions",
93
+ "@typescript-eslint/return-await",
94
+ "@typescript-eslint/strict-boolean-expressions",
95
+ "@typescript-eslint/switch-exhaustiveness-check",
96
+ "@typescript-eslint/unbound-method",
97
+ "@typescript-eslint/use-unknown-in-catch-callback-variable"
98
+ ];
38
99
  export {
39
100
  rulesPrefixesForPlugins,
40
- typescriptRulesExtendEslintRules
101
+ typescriptRulesExtendEslintRules,
102
+ typescriptTypeAwareRules
41
103
  };
@@ -299,6 +299,8 @@ const suspiciousRules = [
299
299
  "react/no-namespace",
300
300
  "react/react-in-jsx-scope",
301
301
  "react/style-prop-object",
302
+ "@typescript-eslint/no-misused-promises",
303
+ "@typescript-eslint/no-floating-promises",
302
304
  "@typescript-eslint/no-confusing-non-null-assertion",
303
305
  "@typescript-eslint/no-extraneous-class",
304
306
  "@typescript-eslint/no-unnecessary-type-constraint",
@@ -1,6 +1,6 @@
1
1
  import * as rules from "./generated/rules.mjs";
2
2
  import { nurseryRules } from "./generated/rules.mjs";
3
- import { rulesPrefixesForPlugins, typescriptRulesExtendEslintRules } from "./constants.mjs";
3
+ import { typescriptTypeAwareRules, rulesPrefixesForPlugins, typescriptRulesExtendEslintRules } from "./constants.mjs";
4
4
  const allRules = Object.values(rules).flat();
5
5
  const isValueInSet = (value, validSet) => validSet.includes(value) || Array.isArray(value) && validSet.includes(value[0]);
6
6
  const isActiveValue = (value) => isValueInSet(value, ["error", "warn", 1, 2]);
@@ -46,6 +46,12 @@ const transformRuleEntry = (eslintConfig, targetConfig, options) => {
46
46
  options?.reporter !== void 0 && options.reporter(`unsupported rule, but in development: ${rule}`);
47
47
  continue;
48
48
  }
49
+ if (!options?.typeAware && typescriptTypeAwareRules.includes(rule)) {
50
+ options?.reporter !== void 0 && options.reporter(
51
+ `type-aware rule detected, but \`--type-aware\` is not enabled: ${rule}`
52
+ );
53
+ continue;
54
+ }
49
55
  if (options?.merge) {
50
56
  if (!(rule in targetConfig.rules)) {
51
57
  targetConfig.rules[rule] = normalizeSeverityValue(config);
@@ -27,5 +27,6 @@ export type Options = {
27
27
  reporter?: Reporter;
28
28
  merge?: boolean;
29
29
  withNursery?: boolean;
30
+ typeAware?: boolean;
30
31
  };
31
32
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "1.10.0",
3
+ "version": "1.11.1",
4
4
  "description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
5
5
  "type": "module",
6
6
  "bin": {
@@ -65,7 +65,7 @@
65
65
  "husky": "^9.1.7",
66
66
  "jiti": "^2.4.2",
67
67
  "lint-staged": "^16.1.2",
68
- "oxlint": "^1.10.0",
68
+ "oxlint": "^1.11.1",
69
69
  "prettier": "^3.6.1",
70
70
  "typescript": "^5.8.3",
71
71
  "typescript-eslint": "^8.35.0",
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};