Skip to content

Commit ccdda97

Browse files
committed
fix(migration): pin @oxlint/migrate to bundled oxlint version
Prevent version drift between @oxlint/migrate and the oxlint binary shipped with vite-plus. Without this, `vp migrate` fetches the latest @oxlint/migrate from npm, which may reference rules not yet supported by the bundled oxlint, causing `vp lint` errors after migration.
1 parent d81a033 commit ccdda97

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/cli/src/migration/migrator.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'node:fs';
2+
import { createRequire } from 'node:module';
23
import path from 'node:path';
34

45
import * as prompts from '@voidzero-dev/vite-plus-prompts';
@@ -233,7 +234,12 @@ export async function migrateEslintToOxlint(
233234

234235
// Steps 1-2: Only run @oxlint/migrate if there's an eslint config at root
235236
if (eslintConfigFile) {
236-
const migratePackage = '@oxlint/migrate';
237+
// Pin @oxlint/migrate to the bundled oxlint version.
238+
// Uses createRequire to bypass the exports field (oxlint doesn't export ./package.json yet).
239+
const { version: oxlintVersion }: { version: string } = createRequire(import.meta.url)(
240+
'oxlint/package.json',
241+
);
242+
const migratePackage = `@oxlint/migrate@${oxlintVersion}`;
237243

238244
// Step 1: Generate .oxlintrc.json from ESLint config
239245
spinner.start('Migrating ESLint config to Oxlint...');

0 commit comments

Comments
 (0)