@oxlint/migrate 1.75.0 → 1.77.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-V0W_ayvY.mjs";
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-C1jP736q.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.75.0";
33
+ var version = "1.77.0";
34
34
  //#endregion
35
35
  //#region src/walker/comments/replaceRuleDirectiveComment.ts
36
36
  const allRulesSet = new Set(Object.values(rules_exports).flat());
@@ -10,7 +10,7 @@
10
10
  /**
11
11
  * What to enforce for `/// <reference types="..." />` references.
12
12
  */
13
- //#region node_modules/.pnpm/oxlint@1.75.0_oxlint-tsgolint@0.24.0/node_modules/oxlint/dist/index.d.ts
13
+ //#region node_modules/.pnpm/oxlint@1.77.0_oxlint-tsgolint@0.24.0/node_modules/oxlint/dist/index.d.ts
14
14
  //#region src-js/package/config.generated.d.ts
15
15
  type AllowWarnDeny = ("allow" | "off" | "warn" | "error" | "deny") | number;
16
16
  type GlobalValue = ("readonly" | "writable" | "off") | undefined;
@@ -95,8 +95,8 @@ type MaxDependenciesConfigJson = number | MaxDependenciesConfig;
95
95
  type Target = "single" | "any";
96
96
  type TestCaseName = "it" | "test";
97
97
  type JestFnType = "hook" | "describe" | "test" | "expect" | "jest" | "unknown";
98
- type DummyRule = AllowWarnDeny | [AllowWarnDeny, ...unknown[]];
99
98
  type SnapshotHintMode = "always" | "multi";
99
+ type DummyRule = AllowWarnDeny | [AllowWarnDeny, ...unknown[]];
100
100
  type AltTextElements = "img" | "object" | "area" | 'input[type="image"]';
101
101
  type AnchorIsValidAspect = "noHref" | "invalidHref" | "preferButton";
102
102
  type Assert = "htmlFor" | "nesting" | "both" | "either";
@@ -123,6 +123,8 @@ type NoInnerDeclarationsConfig = "functions" | "both";
123
123
  type BlockScopedFunctions = "allow" | "disallow";
124
124
  type Namespaces = "allow" | "disallow";
125
125
  type NoMagicNumbersNumber = number | string;
126
+ type NoRestrictedGlobalsConfigEnum = string | RestrictedGlobal | NoRestrictedGlobalsObjectConfig;
127
+ type GlobalNameOrObject = string | RestrictedGlobal;
126
128
  type NoRestrictedImportsConfigEnum = string | RestrictedPath | NoRestrictedImportsConfig;
127
129
  type PossiblePaths = string | RestrictedPath;
128
130
  type PossiblePatterns = string | RestrictedPattern;
@@ -145,6 +147,7 @@ type Location = "start" | "anywhere";
145
147
  * The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are `callback`, `cb`, `next`.
146
148
  */
147
149
  type CallbackReturn = string[];
150
+ type ExportsStyleMode = "module.exports" | "exports";
148
151
  /**
149
152
  * The rule takes a single string option: the name of the error parameter.
150
153
  *
@@ -483,9 +486,23 @@ interface Oxlintrc$1 {
483
486
  */
484
487
  env?: OxlintEnv;
485
488
  /**
486
- * Paths of configuration files that this configuration file extends (inherits from). The files
487
- * are resolved relative to the location of the configuration file that contains the `extends`
488
- * property. The configuration files are merged from the first to the last, with the last file
489
+ * Configurations that this configuration file extends (inherits from).
490
+ *
491
+ * In `.oxlintrc.json`, `extends` has type `string[]`. Each string is a path to a configuration
492
+ * file, resolved relative to the location of the configuration file that contains the
493
+ * `extends` property.
494
+ *
495
+ * In `oxlint.config.ts`, `extends` has type `OxlintConfig[]`. Import each configuration and
496
+ * pass the configuration object directly:
497
+ *
498
+ * ```ts
499
+ * import { defineConfig } from "oxlint";
500
+ * import baseConfig from "./base-config.ts";
501
+ *
502
+ * export default defineConfig({ extends: [baseConfig] });
503
+ * ```
504
+ *
505
+ * Configurations are merged from the first to the last, with the last configuration
489
506
  * overriding the previous ones.
490
507
  */
491
508
  extends?: string[];
@@ -836,6 +853,7 @@ interface DummyRuleMap {
836
853
  "getter-return"?: RuleNoConfig | [AllowWarnDeny, GetterReturn];
837
854
  "grouped-accessor-pairs"?: RuleNoConfig | [AllowWarnDeny, PairOrder] | [AllowWarnDeny, PairOrder, GroupedAccessorPairsConfig];
838
855
  "guard-for-in"?: RuleNoConfig;
856
+ "id-denylist"?: RuleNoConfig | [AllowWarnDeny, string, ...string[]];
839
857
  "id-length"?: RuleNoConfig | [AllowWarnDeny, IdLengthConfig];
840
858
  "id-match"?: RuleNoConfig | [AllowWarnDeny, string] | [AllowWarnDeny, string, IdMatchOptions];
841
859
  "import/consistent-type-specifier-style"?: RuleNoConfig | [AllowWarnDeny, Mode];
@@ -913,7 +931,7 @@ interface DummyRuleMap {
913
931
  "jest/prefer-hooks-on-top"?: RuleNoConfig;
914
932
  "jest/prefer-importing-jest-globals"?: RuleNoConfig | [AllowWarnDeny, PreferImportingJestGlobalsConfig];
915
933
  "jest/prefer-jest-mocked"?: RuleNoConfig;
916
- "jest/prefer-lowercase-title"?: DummyRule;
934
+ "jest/prefer-lowercase-title"?: RuleNoConfig | [AllowWarnDeny, PreferLowercaseTitleConfig];
917
935
  "jest/prefer-mock-promise-shorthand"?: RuleNoConfig;
918
936
  "jest/prefer-mock-return-shorthand"?: RuleNoConfig;
919
937
  "jest/prefer-snapshot-hint"?: RuleNoConfig | [AllowWarnDeny, SnapshotHintMode];
@@ -1097,7 +1115,7 @@ interface DummyRuleMap {
1097
1115
  "no-redeclare"?: RuleNoConfig | [AllowWarnDeny, NoRedeclare];
1098
1116
  "no-regex-spaces"?: RuleNoConfig;
1099
1117
  "no-restricted-exports"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedExportsConfig];
1100
- "no-restricted-globals"?: DummyRule;
1118
+ "no-restricted-globals"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedGlobalsConfigEnum, ...NoRestrictedGlobalsConfigEnum[]];
1101
1119
  "no-restricted-imports"?: RuleNoConfig | [AllowWarnDeny, NoRestrictedImportsConfigEnum, ...NoRestrictedImportsConfigEnum[]];
1102
1120
  "no-restricted-properties"?: RuleNoConfig | [AllowWarnDeny, PropertyDetails, ...PropertyDetails[]];
1103
1121
  "no-return-assign"?: RuleNoConfig | [AllowWarnDeny, NoReturnAssignMode];
@@ -1142,9 +1160,10 @@ interface DummyRuleMap {
1142
1160
  "no-useless-return"?: RuleNoConfig;
1143
1161
  "no-var"?: RuleNoConfig;
1144
1162
  "no-void"?: RuleNoConfig | [AllowWarnDeny, NoVoid];
1145
- "no-warning-comments"?: RuleNoConfig | [AllowWarnDeny, NoWarningCommentsConfigJson];
1163
+ "no-warning-comments"?: RuleNoConfig | [AllowWarnDeny, NoWarningCommentsConfig];
1146
1164
  "no-with"?: RuleNoConfig;
1147
1165
  "node/callback-return"?: RuleNoConfig | [AllowWarnDeny, CallbackReturn];
1166
+ "node/exports-style"?: RuleNoConfig | [AllowWarnDeny, ExportsStyleMode] | [AllowWarnDeny, ExportsStyleMode, ExportsStyleOptions];
1148
1167
  "node/global-require"?: RuleNoConfig;
1149
1168
  "node/handle-callback-err"?: RuleNoConfig | [AllowWarnDeny, HandleCallbackErrConfig];
1150
1169
  "node/no-exports-assign"?: RuleNoConfig;
@@ -1161,6 +1180,7 @@ interface DummyRuleMap {
1161
1180
  "oxc/bad-bitwise-operator"?: RuleNoConfig;
1162
1181
  "oxc/bad-char-at-comparison"?: RuleNoConfig;
1163
1182
  "oxc/bad-comparison-sequence"?: RuleNoConfig;
1183
+ "oxc/bad-match-all-arg"?: RuleNoConfig;
1164
1184
  "oxc/bad-min-max-func"?: RuleNoConfig;
1165
1185
  "oxc/bad-object-literal-comparison"?: RuleNoConfig;
1166
1186
  "oxc/bad-replace-all-arg"?: RuleNoConfig;
@@ -1586,7 +1606,7 @@ interface DummyRuleMap {
1586
1606
  "vitest/prefer-hooks-on-top"?: RuleNoConfig;
1587
1607
  "vitest/prefer-import-in-mock"?: RuleNoConfig | [AllowWarnDeny, PreferImportInMockConfig];
1588
1608
  "vitest/prefer-importing-vitest-globals"?: RuleNoConfig;
1589
- "vitest/prefer-lowercase-title"?: DummyRule;
1609
+ "vitest/prefer-lowercase-title"?: RuleNoConfig | [AllowWarnDeny, PreferLowercaseTitleConfig];
1590
1610
  "vitest/prefer-mock-promise-shorthand"?: RuleNoConfig;
1591
1611
  "vitest/prefer-mock-return-shorthand"?: RuleNoConfig;
1592
1612
  "vitest/prefer-snapshot-hint"?: RuleNoConfig | [AllowWarnDeny, SnapshotHintMode];
@@ -2306,6 +2326,96 @@ interface PreferImportingJestGlobalsConfig {
2306
2326
  */
2307
2327
  types?: JestFnType[];
2308
2328
  }
2329
+ interface PreferLowercaseTitleConfig {
2330
+ /**
2331
+ * This array option allows specifying prefixes, which contain capitals that titles
2332
+ * can start with. This can be useful when writing tests for API endpoints, where
2333
+ * you'd like to prefix with the HTTP method.
2334
+ * By default, nothing is allowed (the equivalent of `{ "allowedPrefixes": [] }`).
2335
+ *
2336
+ * Example of **correct** code for the `{ "allowedPrefixes": ["GET"] }` option:
2337
+ * ```js
2338
+ * /* jest/prefer-lowercase-title: ["error", { "allowedPrefixes": ["GET"] }] * /
2339
+ * describe('GET /live');
2340
+ * ```
2341
+ */
2342
+ allowedPrefixes?: string[];
2343
+ /**
2344
+ * This array option controls which Jest or Vitest functions are checked by this rule. There
2345
+ * are four possible values:
2346
+ * - `"describe"`
2347
+ * - `"test"`
2348
+ * - `"it"`
2349
+ * - `"bench"`
2350
+ *
2351
+ * By default, none of these options are enabled (the equivalent of
2352
+ * `{ "ignore": [] }`).
2353
+ *
2354
+ * Example of **correct** code for the `{ "ignore": ["describe"] }` option:
2355
+ * ```js
2356
+ * /* jest/prefer-lowercase-title: ["error", { "ignore": ["describe"] }] * /
2357
+ * describe('Uppercase description');
2358
+ * ```
2359
+ *
2360
+ * Example of **correct** code for the `{ "ignore": ["test"] }` option:
2361
+ * ```js
2362
+ * /* jest/prefer-lowercase-title: ["error", { "ignore": ["test"] }] * /
2363
+ * test('Uppercase description');
2364
+ * ```
2365
+ *
2366
+ * Example of **correct** code for the `{ "ignore": ["it"] }` option:
2367
+ * ```js
2368
+ * /* jest/prefer-lowercase-title: ["error", { "ignore": ["it"] }] * /
2369
+ * it('Uppercase description');
2370
+ * ```
2371
+ */
2372
+ ignore?: string[];
2373
+ /**
2374
+ * This option can be set to allow only the top-level `describe` blocks to have a
2375
+ * title starting with an upper-case letter.
2376
+ *
2377
+ * Example of **correct** code for the `{ "ignoreTopLevelDescribe": true }` option:
2378
+ * ```js
2379
+ * /* jest/prefer-lowercase-title: ["error", { "ignoreTopLevelDescribe": true }] * /
2380
+ * describe('MyClass', () => {
2381
+ * describe('#myMethod', () => {
2382
+ * it('does things', () => {
2383
+ * //
2384
+ * });
2385
+ * });
2386
+ * });
2387
+ * ```
2388
+ */
2389
+ ignoreTopLevelDescribe?: boolean;
2390
+ /**
2391
+ * This option can be set to only validate that the first character of a test name is lowercased.
2392
+ *
2393
+ * Example of **correct** code for the `{ "lowercaseFirstCharacterOnly": true }` option:
2394
+ * ```js
2395
+ * /* vitest/prefer-lowercase-title: ["error", { "lowercaseFirstCharacterOnly": true }] * /
2396
+ * describe('myClass', () => {
2397
+ * describe('myMethod', () => {
2398
+ * it('does things', () => {
2399
+ * //
2400
+ * });
2401
+ * });
2402
+ * });
2403
+ * ```
2404
+ *
2405
+ * Example of **incorrect** code for the `{ "lowercaseFirstCharacterOnly": true }` option:
2406
+ * ```js
2407
+ * /* vitest/prefer-lowercase-title: ["error", { "lowercaseFirstCharacterOnly": true }] * /
2408
+ * describe('MyClass', () => {
2409
+ * describe('MyMethod', () => {
2410
+ * it('does things', () => {
2411
+ * //
2412
+ * });
2413
+ * });
2414
+ * });
2415
+ * ```
2416
+ */
2417
+ lowercaseFirstCharacterOnly?: boolean;
2418
+ }
2309
2419
  interface RequireHookConfig {
2310
2420
  /**
2311
2421
  * An array of function names that are allowed to be called outside of hooks.
@@ -3389,6 +3499,38 @@ interface RestrictDefaultExports {
3389
3499
  */
3390
3500
  namespaceFrom?: boolean;
3391
3501
  }
3502
+ /**
3503
+ * A restricted global with an optional custom message.
3504
+ */
3505
+ interface RestrictedGlobal {
3506
+ /**
3507
+ * A custom message shown when the restricted global is used.
3508
+ */
3509
+ message?: string;
3510
+ /**
3511
+ * The name of the restricted global.
3512
+ */
3513
+ name: string;
3514
+ }
3515
+ /**
3516
+ * Object form of the configuration, which additionally allows detecting
3517
+ * restricted globals accessed via global objects.
3518
+ */
3519
+ interface NoRestrictedGlobalsObjectConfig {
3520
+ /**
3521
+ * Whether to also detect restricted globals accessed via global objects. Default is `false`.
3522
+ */
3523
+ checkGlobalObject?: boolean;
3524
+ /**
3525
+ * Additional global object names to check when `checkGlobalObject` is enabled.
3526
+ * By default, the rule checks these global objects: `globalThis`, `self`, and `window`.
3527
+ */
3528
+ globalObjects?: string[];
3529
+ /**
3530
+ * The restricted globals, as names or `{ "name", "message" }` objects.
3531
+ */
3532
+ globals: GlobalNameOrObject[];
3533
+ }
3392
3534
  interface RestrictedPath {
3393
3535
  allowImportNames?: string[];
3394
3536
  allowTypeImports?: boolean;
@@ -3927,11 +4069,28 @@ interface NoVoid {
3927
4069
  */
3928
4070
  allowAsStatement?: boolean;
3929
4071
  }
3930
- interface NoWarningCommentsConfigJson {
4072
+ interface NoWarningCommentsConfig {
4073
+ /**
4074
+ * An array of characters to ignore at the start of comments when `location` is `"start"`.
4075
+ *
4076
+ * Useful for ignoring common comment decorations like `*` in JSDoc-style comments.
4077
+ */
3931
4078
  decoration?: string[];
4079
+ /**
4080
+ * Where to check for the terms.
4081
+ */
3932
4082
  location?: Location;
4083
+ /**
4084
+ * An array of terms to match. The matching is case-insensitive.
4085
+ */
3933
4086
  terms?: string[];
3934
4087
  }
4088
+ interface ExportsStyleOptions {
4089
+ /**
4090
+ * If this option is set to `true`, `module.exports = exports = obj` are allowed.
4091
+ */
4092
+ allowBatchAssign?: boolean;
4093
+ }
3935
4094
  interface NoMixedRequiresOptions {
3936
4095
  allowCall?: boolean;
3937
4096
  grouping?: boolean;
@@ -5514,12 +5673,30 @@ interface NoUnnecessaryBooleanLiteralCompareConfig {
5514
5673
  }
5515
5674
  interface NoUnnecessaryConditionConfig {
5516
5675
  /**
5517
- * Whether to allow constant loop conditions.
5518
- * `true` is treated as `"always"`, `false` as `"never"`.
5676
+ * Controls which constant conditions are allowed in `while`, `do...while`, and `for` loops.
5677
+ *
5678
+ * - `"never"` (or `false`) reports all constant loop conditions.
5679
+ * - `"always"` (or `true`) allows conditions whose type is the literal type `true`, such as
5680
+ * `while (true)` or `while (variable)` when `variable` has type `true`.
5681
+ * - `"only-allowed-literals"` allows only the literal expressions `true`, `false`, `0`, and
5682
+ * `1`. Variables whose types are those literal types are still reported.
5519
5683
  */
5520
5684
  allowConstantLoopConditions?: AllowConstantLoopConditions;
5521
5685
  /**
5522
- * Whether to check type predicate functions.
5686
+ * Whether to check arguments passed to type predicate and assertion functions.
5687
+ *
5688
+ * When enabled, the rule reports a call if the argument already satisfies the predicate or
5689
+ * if an assertion function receives an argument that is always truthy or always falsy.
5690
+ *
5691
+ * For example, `narrow(value)` is unnecessary because `value` already has type `true`:
5692
+ *
5693
+ * ```ts
5694
+ * declare const narrow: (value: unknown) => value is true;
5695
+ * const value = true;
5696
+ * if (narrow(value)) {
5697
+ * // ...
5698
+ * }
5699
+ * ```
5523
5700
  */
5524
5701
  checkTypePredicates?: boolean;
5525
5702
  }
@@ -6747,6 +6924,11 @@ interface VitestPluginSettings {
6747
6924
  //#region src-js/package/config.d.ts
6748
6925
  type Oxlintrc = Omit<Oxlintrc$1, "$schema" | "extends">;
6749
6926
  interface OxlintConfig$1 extends Oxlintrc {
6927
+ /**
6928
+ * Configuration objects to extend.
6929
+ *
6930
+ * Import configurations and pass them directly instead of using file paths.
6931
+ */
6750
6932
  extends?: OxlintConfig$1[];
6751
6933
  }
6752
6934
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as main } from "../src-V0W_ayvY.mjs";
1
+ import { t as main } from "../src-C1jP736q.mjs";
2
2
  export { main as default };
@@ -434,6 +434,7 @@ const pedanticRules = [
434
434
  "no-throw-literal",
435
435
  "no-useless-return",
436
436
  "no-warning-comments",
437
+ "prefer-promise-reject-errors",
437
438
  "radix",
438
439
  "require-await",
439
440
  "require-unicode-regexp",
@@ -546,6 +547,7 @@ const styleRules = [
546
547
  "func-style",
547
548
  "grouped-accessor-pairs",
548
549
  "guard-for-in",
550
+ "id-denylist",
549
551
  "id-length",
550
552
  "id-match",
551
553
  "init-declarations",
@@ -580,7 +582,6 @@ const styleRules = [
580
582
  "prefer-numeric-literals",
581
583
  "prefer-object-has-own",
582
584
  "prefer-object-spread",
583
- "prefer-promise-reject-errors",
584
585
  "prefer-regex-literals",
585
586
  "prefer-rest-params",
586
587
  "prefer-spread",
@@ -651,6 +652,7 @@ const styleRules = [
651
652
  "jsdoc/require-throws-description",
652
653
  "jsdoc/require-yields-description",
653
654
  "node/callback-return",
655
+ "node/exports-style",
654
656
  "node/global-require",
655
657
  "node/no-exports-assign",
656
658
  "node/no-mixed-requires",
@@ -1332,6 +1334,8 @@ var unsupportedRules = {
1332
1334
  "unicorn/no-nonstandard-builtin-properties": "No need to implement, TypeScript type checking reports non-standard properties and invalid calls or constructions on built-ins.",
1333
1335
  "unicorn/no-boolean-sort-comparator": "No need to implement, TypeScript type checking requires array sort comparators to return numbers.",
1334
1336
  "unicorn/no-invalid-argument-count": "No need to implement, TypeScript type checking reports invalid argument counts for functions, constructors, and built-in APIs.",
1337
+ "unicorn/no-unsafe-promise-all-settled-values": "No need to implement, TypeScript type checking reports accessing `value` on `Promise.allSettled()` results that have not been narrowed to the fulfilled variant.",
1338
+ "unicorn/no-undeclared-class-members": "No need to implement, TypeScript type checking reports accesses to undeclared class members.",
1335
1339
  "unicorn/no-useless-template-literals": "No need to implement. `typescript/no-unnecessary-template-expression` covers static and already-string expressions, while `eslint/no-implicit-coercion` with `disallowTemplateShorthand` covers expression-only string coercions.",
1336
1340
  "unicorn/prefer-explicit-viewport-units": "Not currently possible, as full support requires parsing standalone CSS files.",
1337
1341
  "unicorn/require-frontmatter-fields": "Not currently possible, as it requires parsing YAML frontmatter in Markdown files.",
@@ -1345,6 +1349,7 @@ var unsupportedRules = {
1345
1349
  "unicorn/no-misrefactored-assignment": "No need to implement, already covered by `oxc/misrefactored-assign-op`.",
1346
1350
  "unicorn/no-constant-zero-expression": "No need to implement, already covered by `oxc/erasing-op`.",
1347
1351
  "unicorn/prefer-math-constants": "No need to implement, already covered by `oxc/approx-constant`.",
1352
+ "unicorn/no-invalid-character-comparison": "No need to implement, already covered by `oxc/bad-char-at-comparison`.",
1348
1353
  "unicorn/require-array-sort-compare": "No need to implement, already implemented by `typescript/require-array-sort-compare` via tsgolint.",
1349
1354
  "eslint/no-negated-in-lhs": "Replaced by `eslint/no-unsafe-negation`, which we support.",
1350
1355
  "eslint/no-catch-shadow": "Replaced by `eslint/no-shadow`.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxlint/migrate",
3
- "version": "1.75.0",
3
+ "version": "1.77.0",
4
4
  "description": "Generates a `.oxlintrc.json` from a existing eslint flat config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -73,7 +73,7 @@
73
73
  "lint-staged": "^17.0.0",
74
74
  "next": "^16.0.0",
75
75
  "oxfmt": "^0.58.0",
76
- "oxlint": "^1.75.0",
76
+ "oxlint": "^1.77.0",
77
77
  "oxlint-tsgolint": "^0.24.0",
78
78
  "tsdown": "^0.22.0",
79
79
  "typescript": "^6.0.0",