Commit a9d939c
committed
fix(migrate): broaden ESLint ecosystem cleanup and address review findings
Address findings from the extra-high-effort review of this PR:
- Iterate `peerDependencies` and `optionalDependencies` in addition to
`devDependencies` and `dependencies`, matching the sister code path
that handles vite/vitest overrides.
- Narrow the `@typescript-eslint/*` namespace removal to the
ESLint-specific entry points (`eslint-plugin`, `parser`,
`rule-tester`); preserve the reusable AST libraries (`utils`,
`typescript-estree`, `scope-manager`, `types`) so codemods and doc
generators that import them directly keep working.
- Recognize `@eslint/*`, `@eslint-community/*`, and `@angular-eslint/*`
scopes as ESLint-only (e.g. `@eslint/js`, `@eslint/eslintrc`,
`@eslint-community/eslint-utils`, `@angular-eslint/template-parser`).
- Recognize flat ESLint-only helpers: `eslint-formatter-*`, `eslintrc`,
`eslint-utils`, `eslint-visitor-keys`, `eslint-scope`,
`eslint-define-config`, `eslint-doc-generator`.
- Recognize `@nuxt/eslint` (Nuxt's ESLint integration module that
`require`s `eslint` at runtime — useless after removal). The unit test
that previously asserted this was preserved is now inverted.
- Strip `@types/` symmetrically: a `@types/<X>` is removable iff `<X>`
is. Fixes the inconsistency where `@types/eslint-plugin-foo` was
removed but `@types/eslint` survived.
- Delete a dependency field entirely (`devDependencies`,
`peerDependencies`, etc.) when our cleanup emptied it, avoiding
`"devDependencies": {}` noise. Visible in the
`migration-eslint-monorepo` snap diff.
- Split `rewriteEslintPackageJson` into root vs workspace modes:
workspace sub-packages get a conservative cleanup (only `eslint`
itself), since they may intentionally publish plugins/configs as part
of a shared lint-preset API consumed outside Vite+.
- Drop the broken `"include": ["src/**/*"]` from the
`migration-eslint-type-aware` fixture's `tsconfig.json` (no `src/`
directory exists).
- Expand the `migration-eslint-plugins-cleanup` fixture to exercise
the wider matrix (scopes, formatters, `@types`, preserved
`@typescript-eslint/utils`, peer `eslint`).
Deferred (out of scope for this PR):
- `detectEslintProject` gating on the literal `eslint` symbol — a
project that has only `typescript-eslint` etc. never triggers the
migration. Pre-existing.
- Stale `--rule '@typescript-eslint/...'` arguments in scripts after
plugin removal — requires Rust ast-grep rule updates.
- Non-atomic `fs.writeFileSync` across N workspace `package.json` files;
a SIGKILL mid-loop leaves the monorepo half-migrated. Pre-existing
utility behavior.1 parent e50e1ae commit a9d939c
7 files changed
Lines changed: 239 additions & 32 deletions
File tree
- packages/cli
- snap-tests-global
- migration-eslint-monorepo
- migration-eslint-plugins-cleanup
- migration-eslint-type-aware
- src/migration
- __tests__
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
9 | 16 | | |
10 | 17 | | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
13 | 21 | | |
14 | 22 | | |
| 23 | + | |
15 | 24 | | |
16 | 25 | | |
17 | 26 | | |
18 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
10 | 9 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
387 | | - | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
388 | 503 | | |
389 | 504 | | |
390 | 505 | | |
391 | 506 | | |
392 | 507 | | |
393 | 508 | | |
394 | | - | |
395 | 509 | | |
396 | 510 | | |
397 | 511 | | |
| |||
401 | 515 | | |
402 | 516 | | |
403 | 517 | | |
404 | | - | |
405 | | - | |
406 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
407 | 540 | | |
408 | 541 | | |
409 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
308 | 309 | | |
309 | | - | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
310 | 313 | | |
311 | 314 | | |
312 | | - | |
| 315 | + | |
313 | 316 | | |
314 | 317 | | |
315 | 318 | | |
| |||
337 | 340 | | |
338 | 341 | | |
339 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
340 | 374 | | |
341 | 375 | | |
342 | | - | |
343 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
344 | 380 | | |
345 | 381 | | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 382 | + | |
| 383 | + | |
350 | 384 | | |
351 | 385 | | |
352 | | - | |
| 386 | + | |
353 | 387 | | |
354 | 388 | | |
355 | | - | |
| 389 | + | |
356 | 390 | | |
357 | 391 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
362 | 397 | | |
363 | 398 | | |
364 | 399 | | |
365 | 400 | | |
366 | 401 | | |
367 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
368 | 414 | | |
369 | 415 | | |
370 | 416 | | |
| 417 | + | |
| 418 | + | |
371 | 419 | | |
372 | 420 | | |
373 | 421 | | |
374 | 422 | | |
375 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
376 | 430 | | |
377 | 431 | | |
378 | 432 | | |
379 | 433 | | |
| 434 | + | |
380 | 435 | | |
381 | | - | |
| 436 | + | |
382 | 437 | | |
383 | 438 | | |
| 439 | + | |
384 | 440 | | |
385 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
386 | 447 | | |
387 | 448 | | |
388 | 449 | | |
| |||
0 commit comments