Skip to content

Commit 4eaba42

Browse files
committed
refactor(migrate): drop @nuxt/eslint from ESLINT_ECOSYSTEM_NAMES
The entry was unreachable: when `@nuxt/eslint` is present anywhere in the workspace, `detectIncompatibleEslintIntegration` short-circuits the entire ESLint migration before `rewriteEslintPackageJson` runs, so the second list never gets consulted. Two side effects from keeping it duplicated: - Maintenance hazard: the "what to do about Nuxt" decision lives in two places that could drift. - Misleading future intent: a contributor scanning the cleanup list would conclude `@nuxt/eslint` gets stripped on migration, which isn't true today. The right home for the policy is `INCOMPATIBLE_ESLINT_INTEGRATIONS` (which is already what controls the actual behavior). Added an explicit unit test asserting `rewriteEslintPackageJson` leaves `@nuxt/eslint` alone, with a comment explaining the upstream skip.
1 parent 9146fc1 commit 4eaba42

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

packages/cli/src/migration/__tests__/migrator.spec.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ describe('rewriteEslintPackageJson', () => {
404404
expect(pkg.devDependencies).toEqual({ keepme: '^1.0.0' });
405405
});
406406

407-
it('removes ESLint formatter, helper, and runtime-integration packages', () => {
407+
it('removes ESLint formatter and helper packages', () => {
408408
const pkgPath = writePkg({
409409
devDependencies: {
410410
eslint: '^9.0.0',
@@ -416,7 +416,6 @@ describe('rewriteEslintPackageJson', () => {
416416
'eslint-scope': '^8.0.0',
417417
'eslint-define-config': '^2.0.0',
418418
'eslint-doc-generator': '^2.0.0',
419-
'@nuxt/eslint': '^0.5.0',
420419
keepme: '^1.0.0',
421420
},
422421
});
@@ -425,6 +424,21 @@ describe('rewriteEslintPackageJson', () => {
425424
expect(pkg.devDependencies).toEqual({ keepme: '^1.0.0' });
426425
});
427426

427+
it('does NOT remove framework-ESLint integrations (e.g. @nuxt/eslint) — those short-circuit migration upstream', () => {
428+
// The skip path in `bin.ts` prevents `rewriteEslintPackageJson` from
429+
// being called when `@nuxt/eslint` is present, so this function
430+
// doesn't need to (and shouldn't) know about it.
431+
const pkgPath = writePkg({
432+
devDependencies: {
433+
eslint: '^9.0.0',
434+
'@nuxt/eslint': '^1.0.0',
435+
},
436+
});
437+
rewriteEslintPackageJson(pkgPath);
438+
const pkg = readJson(pkgPath);
439+
expect(pkg.devDependencies).toEqual({ '@nuxt/eslint': '^1.0.0' });
440+
});
441+
428442
it('preserves reusable @typescript-eslint/* AST libraries (utils, typescript-estree, etc.)', () => {
429443
const pkgPath = writePkg({
430444
devDependencies: {

packages/cli/src/migration/migrator.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,11 @@ const ESLINT_ECOSYSTEM_NAMES = new Set<string>([
383383
'@typescript-eslint/eslint-plugin',
384384
'@typescript-eslint/parser',
385385
'@typescript-eslint/rule-tester',
386-
// Framework runtime modules that wire ESLint and break without it:
387-
'@nuxt/eslint',
386+
// Note: framework-ESLint integration modules (e.g. `@nuxt/eslint`)
387+
// are NOT listed here. They short-circuit the entire ESLint
388+
// migration via `INCOMPATIBLE_ESLINT_INTEGRATIONS`, so this list is
389+
// never consulted for them. Keeping them out avoids duplicating the
390+
// "what to do about Nuxt" decision in two places.
388391
]);
389392

390393
// Flat name prefixes that mark an ESLint-only package.

0 commit comments

Comments
 (0)