@oxlint/migrate 1.71.0 → 1.72.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.
- package/dist/bin/oxlint-migrate.mjs +21 -1
- package/dist/src/index.d.mts +28 -2
- package/package.json +4 -4
|
@@ -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.72.0";
|
|
34
34
|
//#endregion
|
|
35
35
|
//#region src/walker/comments/replaceRuleDirectiveComment.ts
|
|
36
36
|
const allRulesSet = new Set(Object.values(rules_exports).flat());
|
|
@@ -414,6 +414,25 @@ const getFileContent = (absoluteFilePath) => {
|
|
|
414
414
|
}
|
|
415
415
|
};
|
|
416
416
|
/**
|
|
417
|
+
* Strips JSON comments (single-line `//` and multi-line) and trailing commas
|
|
418
|
+
* so that `tsconfig.json` (which is actually JSONC) can be parsed with `JSON.parse`.
|
|
419
|
+
*/
|
|
420
|
+
const stripJsoncFeatures = (text) => text.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/,\s*([}\]])/g, "$1");
|
|
421
|
+
/**
|
|
422
|
+
* When `--type-aware` is used, check whether the project's `tsconfig.json`
|
|
423
|
+
* contains a `baseUrl` value in `compilerOptions`. If it does, emit a warning
|
|
424
|
+
* because `tsgo` does not support `baseUrl`, which may cause issues with
|
|
425
|
+
* type-aware linting.
|
|
426
|
+
*/
|
|
427
|
+
const warnIfTsconfigHasBaseUrl = (reporter) => {
|
|
428
|
+
const content = getFileContent(path.join(cwd, "tsconfig.json"));
|
|
429
|
+
if (content === void 0) return;
|
|
430
|
+
try {
|
|
431
|
+
const tsconfig = JSON.parse(stripJsoncFeatures(content));
|
|
432
|
+
if (tsconfig?.compilerOptions?.baseUrl !== void 0) reporter.addWarning(`tsconfig.json has \`baseUrl\` set to ${JSON.stringify(tsconfig.compilerOptions.baseUrl)}. \`baseUrl\` is not supported by tsgo, which may cause issues with type-aware linting. Consider removing \`baseUrl\` or using path aliases instead.`);
|
|
433
|
+
} catch {}
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
417
436
|
* Count enabled rules (excluding "off" rules) from both rules and overrides
|
|
418
437
|
*/
|
|
419
438
|
const countEnabledRules = (config) => {
|
|
@@ -440,6 +459,7 @@ program.name("oxlint-migrate").version(version).argument("[eslint-config]", "The
|
|
|
440
459
|
typeAware: !!cliOptions.typeAware,
|
|
441
460
|
jsPlugins
|
|
442
461
|
};
|
|
462
|
+
if (options.typeAware) warnIfTsconfigHasBaseUrl(reporter);
|
|
443
463
|
if (cliOptions.replaceEslintComments) {
|
|
444
464
|
await walkAndReplaceProjectFiles(await getAllProjectFiles(), (filePath) => getFileContent(filePath), (filePath, content) => writeFile(filePath, content, "utf-8"), options);
|
|
445
465
|
return;
|
package/dist/src/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* What to enforce for `/// <reference types="..." />` references.
|
|
6
6
|
*/
|
|
7
|
-
//#region node_modules/.pnpm/oxlint@1.
|
|
7
|
+
//#region node_modules/.pnpm/oxlint@1.72.0_oxlint-tsgolint@0.23.0/node_modules/oxlint/dist/index.d.ts
|
|
8
8
|
//#region src-js/package/config.generated.d.ts
|
|
9
9
|
type AllowWarnDeny = ("allow" | "off" | "warn" | "error" | "deny") | number;
|
|
10
10
|
type GlobalValue = ("readonly" | "writable" | "off") | undefined;
|
|
@@ -116,6 +116,9 @@ type AllowKind = "functions" | "arrowFunctions" | "generatorFunctions" | "method
|
|
|
116
116
|
type NoInnerDeclarationsConfig = "functions" | "both";
|
|
117
117
|
type BlockScopedFunctions = "allow" | "disallow";
|
|
118
118
|
type NoMagicNumbersNumber = number | string;
|
|
119
|
+
type NoRestrictedImportsConfigEnum = string | RestrictedPath | NoRestrictedImportsConfig;
|
|
120
|
+
type PossiblePaths = string | RestrictedPath;
|
|
121
|
+
type PossiblePatterns = string | RestrictedPattern;
|
|
119
122
|
type NoReturnAssignMode = "always" | "except-parens";
|
|
120
123
|
/**
|
|
121
124
|
* Controls how hoisting is handled when checking for shadowing.
|
|
@@ -142,6 +145,7 @@ type CallbackReturn = string[];
|
|
|
142
145
|
* - a regexp pattern (e.g. `"^(err|error)$"`)
|
|
143
146
|
*
|
|
144
147
|
* If the configured name of the error variable begins with a `^` it is considered to be a regexp pattern.
|
|
148
|
+
* Invalid regexp patterns are rejected during configuration parsing.
|
|
145
149
|
*
|
|
146
150
|
* Default: `"err"`.
|
|
147
151
|
*/
|
|
@@ -1078,7 +1082,7 @@ interface DummyRuleMap {
|
|
|
1078
1082
|
"no-regex-spaces"?: RuleNoConfig;
|
|
1079
1083
|
"no-restricted-exports"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedExportsConfig];
|
|
1080
1084
|
"no-restricted-globals"?: DummyRule;
|
|
1081
|
-
"no-restricted-imports"?:
|
|
1085
|
+
"no-restricted-imports"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedImportsConfigEnum, ...NoRestrictedImportsConfigEnum[]];
|
|
1082
1086
|
"no-restricted-properties"?: RuleNoConfig | [AllowWarnDeny, PropertyDetails, ...PropertyDetails[]];
|
|
1083
1087
|
"no-return-assign"?: RuleNoConfig | [AllowWarnDeny, NoReturnAssignMode];
|
|
1084
1088
|
"no-script-url"?: RuleNoConfig;
|
|
@@ -3305,6 +3309,28 @@ interface RestrictDefaultExports {
|
|
|
3305
3309
|
*/
|
|
3306
3310
|
namespaceFrom?: boolean;
|
|
3307
3311
|
}
|
|
3312
|
+
interface RestrictedPath {
|
|
3313
|
+
allowImportNames?: string[];
|
|
3314
|
+
allowTypeImports?: boolean;
|
|
3315
|
+
importNames?: string[];
|
|
3316
|
+
message?: string;
|
|
3317
|
+
name: string;
|
|
3318
|
+
}
|
|
3319
|
+
interface NoRestrictedImportsConfig {
|
|
3320
|
+
paths?: PossiblePaths[];
|
|
3321
|
+
patterns?: PossiblePatterns[];
|
|
3322
|
+
}
|
|
3323
|
+
interface RestrictedPattern {
|
|
3324
|
+
allowImportNamePattern?: string;
|
|
3325
|
+
allowImportNames?: string[];
|
|
3326
|
+
allowTypeImports?: boolean;
|
|
3327
|
+
caseSensitive?: boolean;
|
|
3328
|
+
group?: string[];
|
|
3329
|
+
importNamePattern?: string;
|
|
3330
|
+
importNames?: string[];
|
|
3331
|
+
message?: string;
|
|
3332
|
+
regex?: string;
|
|
3333
|
+
}
|
|
3308
3334
|
interface PropertyDetails {
|
|
3309
3335
|
/**
|
|
3310
3336
|
* Objects where property access should be allowed. This must be used with `property` and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxlint/migrate",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.72.0",
|
|
4
4
|
"description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@antfu/eslint-config": "^9.0.0",
|
|
48
|
-
"@babel/eslint-plugin": "^
|
|
48
|
+
"@babel/eslint-plugin": "^8.0.0",
|
|
49
49
|
"@e18e/eslint-plugin": "^0.5.0",
|
|
50
50
|
"@eslint-react/eslint-plugin": "^5.0.0",
|
|
51
51
|
"@eslint/js": "^10.0.0",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"eslint-plugin-react-web-api": "^5.0.0",
|
|
80
80
|
"eslint-plugin-regexp": "^3.0.0",
|
|
81
81
|
"eslint-plugin-tsdoc": "^0.5.0",
|
|
82
|
-
"eslint-plugin-unicorn": "^
|
|
82
|
+
"eslint-plugin-unicorn": "^67.0.0",
|
|
83
83
|
"husky": "^9.1.7",
|
|
84
84
|
"lint-staged": "^17.0.0",
|
|
85
85
|
"next": "^16.0.0",
|
|
86
86
|
"oxfmt": "^0.55.0",
|
|
87
|
-
"oxlint": "^1.
|
|
87
|
+
"oxlint": "^1.72.0",
|
|
88
88
|
"oxlint-tsgolint": "^0.23.0",
|
|
89
89
|
"tsdown": "^0.22.0",
|
|
90
90
|
"typescript": "^6.0.0",
|