From 288d5aeb742fefed8eabba688ca1cf6bf89bc152 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 11:01:39 +0900 Subject: [PATCH 1/8] fix(migrate): strip ESLint flags that Oxlint rejects from scripts Script rewriting kept ESLint flags that Oxlint rejects, such as --cache-location and -o, and kept -c and --config pointing at the ESLint config that migration deletes. The migrated lint script then failed. Strip these flags when the script still means a lint run. Flags that change the run mode, such as --stdin and --print-config, stay so the script fails loudly instead of silently linting everything. --- .../migration_eslint_lint_staged/package.json | 4 +- crates/vp_migration/src/eslint.rs | 46 +++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json index 90a0d0b1a1..f0a125b177 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json @@ -1,13 +1,13 @@ { "name": "migration-eslint-lint-staged", "scripts": { - "lint": "eslint ." + "lint": "eslint --cache --cache-location node_modules/.cache/eslint -c eslint.config.mjs ." }, "devDependencies": { "eslint": "^9.0.0", "vite": "^7.0.0" }, "lint-staged": { - "*.ts": "eslint --fix" + "*.ts": "eslint -c eslint.config.mjs --fix" } } diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index 2dfb8d96c2..a978c6c843 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -9,16 +9,39 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--no-error-on-unmatched-pattern", "--debug", "--no-inline-config", + "--no-config-lookup", + "--color", + "--no-color", + "--no-warn-ignored", + "--pass-on-no-patterns", + "--exit-on-fatal-error", + "--stats", + "--pass-on-unpruned-suppressions", ], value_flags: &[ + // Migration moves the ESLint config into vite.config.ts and deletes the original file. + "-c", + "--config", "--ext", "--rulesdir", "--resolve-plugins-relative-to", "--parser", "--parser-options", "--plugin", + "-o", "--output-file", "--env", + "--cache-location", + "--cache-file", + "--cache-strategy", + "--global", + "--rule", + "--report-unused-inline-configs", + "--flag", + "--concurrency", + "--suppress-rule", + "--suppressions-location", + "--fix-type", ], flag_conversions: &[], }; @@ -62,6 +85,29 @@ mod tests { "vp lint --fix ." ); assert_eq!(rewrite_eslint_script("eslint --no-inline-config ."), "vp lint ."); + assert_eq!(rewrite_eslint_script("eslint --no-color --stats --fix ."), "vp lint --fix ."); + + // the migrated config lives in vite.config.ts, so config paths are dropped + assert_eq!(rewrite_eslint_script("eslint -c eslint.config.mjs ."), "vp lint ."); + assert_eq!(rewrite_eslint_script("eslint --config=eslint.config.mjs ."), "vp lint ."); + + // Oxlint has no cache, so cache options go with --cache + assert_eq!( + rewrite_eslint_script( + "eslint --cache --cache-location node_modules/.cache/eslint --cache-strategy content --fix ." + ), + "vp lint --fix ." + ); + assert_eq!( + rewrite_eslint_script("eslint -o report.txt --rule 'no-console: error' ."), + "vp lint ." + ); + + // flags Oxlint accepts stay + assert_eq!( + rewrite_eslint_script("eslint --quiet --max-warnings 0 --ignore-pattern dist ."), + "vp lint --quiet --max-warnings 0 --ignore-pattern dist ." + ); // multiple flags stripped at once assert_eq!( From bba0d3a92d1a59ae8051bd1238d364f59315c1e9 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 11:11:54 +0900 Subject: [PATCH 2/8] test(migrate): cover every ESLint flag stripped from scripts --- crates/vp_migration/src/eslint.rs | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index a978c6c843..cac0becbfd 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -155,6 +155,41 @@ mod tests { ); } + #[test] + fn test_rewrite_eslint_strips_flags_oxlint_rejects() { + // Each value flag must also drop its value; a boolean flag must keep the next token. + for flags in [ + "-c eslint.config.mjs", + "--config eslint.config.mjs", + "-o report.txt", + "--cache-location .eslintcache", + "--cache-file .eslintcache", + "--cache-strategy content", + "--global foo", + "--rule 'no-console: error'", + "--report-unused-inline-configs warn", + "--flag unstable_config_lookup_from_file", + "--concurrency 2", + "--fix-type problem", + "--suppress-rule no-console", + "--suppressions-location suppressions.json", + "--no-config-lookup", + "--color", + "--no-color", + "--stats", + "--no-warn-ignored", + "--pass-on-no-patterns", + "--exit-on-fatal-error", + "--pass-on-unpruned-suppressions", + ] { + assert_eq!( + rewrite_eslint_script(&format!("eslint {flags} --fix .")), + "vp lint --fix .", + "{flags}" + ); + } + } + #[test] fn test_rewrite_eslint_compound_commands() { // subshell (brush-parser adds spaces inside parentheses) From 6f6044d01e8fb66b3a8d85e1da20ee694fa18ca2 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 11:18:00 +0900 Subject: [PATCH 3/8] fix(migrate): keep ESLint flags that limit what a script fixes Stripping --pass-on-no-patterns turns an empty file list into a whole-project vp lint --fix, and stripping --fix-type widens the applied fixes. Keep both so the migrated script fails loudly instead. --- crates/vp_migration/src/eslint.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index cac0becbfd..e2dfc201b0 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -13,7 +13,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--color", "--no-color", "--no-warn-ignored", - "--pass-on-no-patterns", "--exit-on-fatal-error", "--stats", "--pass-on-unpruned-suppressions", @@ -41,7 +40,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--concurrency", "--suppress-rule", "--suppressions-location", - "--fix-type", ], flag_conversions: &[], }; @@ -170,7 +168,6 @@ mod tests { "--report-unused-inline-configs warn", "--flag unstable_config_lookup_from_file", "--concurrency 2", - "--fix-type problem", "--suppress-rule no-console", "--suppressions-location suppressions.json", "--no-config-lookup", @@ -178,7 +175,6 @@ mod tests { "--no-color", "--stats", "--no-warn-ignored", - "--pass-on-no-patterns", "--exit-on-fatal-error", "--pass-on-unpruned-suppressions", ] { @@ -188,6 +184,16 @@ mod tests { "{flags}" ); } + + // Stripping these would widen what the script fixes, so they stay and fail loudly. + assert_eq!( + rewrite_eslint_script("eslint --fix --pass-on-no-patterns $FILES"), + "vp lint --fix --pass-on-no-patterns $FILES" + ); + assert_eq!( + rewrite_eslint_script("eslint --fix --fix-type layout src"), + "vp lint --fix --fix-type layout src" + ); } #[test] From 05e19a477b016092ce55f2b95630e344ea9b3db1 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 11:33:55 +0900 Subject: [PATCH 4/8] fix(migrate): keep ESLint config and rule flags in migrated scripts Migration converts only the default ESLint config and never carries per-command --rule overrides, so stripping -c, --config, or --rule could silently change which checks run. Keep them so the migrated script fails loudly instead. --- .../migration_eslint_lint_staged/package.json | 4 +-- crates/vp_migration/src/eslint.rs | 26 +++++++------------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json index f0a125b177..6e01190512 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json @@ -1,13 +1,13 @@ { "name": "migration-eslint-lint-staged", "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/eslint -c eslint.config.mjs ." + "lint": "eslint --cache --cache-location node_modules/.cache/eslint ." }, "devDependencies": { "eslint": "^9.0.0", "vite": "^7.0.0" }, "lint-staged": { - "*.ts": "eslint -c eslint.config.mjs --fix" + "*.ts": "eslint --no-color --fix" } } diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index e2dfc201b0..b333f5459f 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -18,9 +18,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--pass-on-unpruned-suppressions", ], value_flags: &[ - // Migration moves the ESLint config into vite.config.ts and deletes the original file. - "-c", - "--config", "--ext", "--rulesdir", "--resolve-plugins-relative-to", @@ -34,7 +31,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--cache-file", "--cache-strategy", "--global", - "--rule", "--report-unused-inline-configs", "--flag", "--concurrency", @@ -85,10 +81,6 @@ mod tests { assert_eq!(rewrite_eslint_script("eslint --no-inline-config ."), "vp lint ."); assert_eq!(rewrite_eslint_script("eslint --no-color --stats --fix ."), "vp lint --fix ."); - // the migrated config lives in vite.config.ts, so config paths are dropped - assert_eq!(rewrite_eslint_script("eslint -c eslint.config.mjs ."), "vp lint ."); - assert_eq!(rewrite_eslint_script("eslint --config=eslint.config.mjs ."), "vp lint ."); - // Oxlint has no cache, so cache options go with --cache assert_eq!( rewrite_eslint_script( @@ -96,10 +88,7 @@ mod tests { ), "vp lint --fix ." ); - assert_eq!( - rewrite_eslint_script("eslint -o report.txt --rule 'no-console: error' ."), - "vp lint ." - ); + assert_eq!(rewrite_eslint_script("eslint -o report.txt ."), "vp lint ."); // flags Oxlint accepts stay assert_eq!( @@ -157,14 +146,11 @@ mod tests { fn test_rewrite_eslint_strips_flags_oxlint_rejects() { // Each value flag must also drop its value; a boolean flag must keep the next token. for flags in [ - "-c eslint.config.mjs", - "--config eslint.config.mjs", "-o report.txt", "--cache-location .eslintcache", "--cache-file .eslintcache", "--cache-strategy content", "--global foo", - "--rule 'no-console: error'", "--report-unused-inline-configs warn", "--flag unstable_config_lookup_from_file", "--concurrency 2", @@ -185,7 +171,15 @@ mod tests { ); } - // Stripping these would widen what the script fixes, so they stay and fail loudly. + // Stripping these would change what the script checks or fixes, so they stay and fail loudly. + assert_eq!( + rewrite_eslint_script("eslint -c eslint.ci.config.mjs src"), + "vp lint -c eslint.ci.config.mjs src" + ); + assert_eq!( + rewrite_eslint_script("eslint --rule 'no-console: error' src"), + "vp lint --rule 'no-console: error' src" + ); assert_eq!( rewrite_eslint_script("eslint --fix --pass-on-no-patterns $FILES"), "vp lint --fix --pass-on-no-patterns $FILES" From 4b2fef7c6ad4481586af19f79cba558a41e86590 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 11:45:06 +0900 Subject: [PATCH 5/8] fix(migrate): keep --no-error-on-unmatched-pattern in ESLint scripts Oxlint supports the flag with the same meaning. Stripping it made vp lint fail with "No files found to lint" when every passed file is ignored, such as a lint-staged run that only touches ignored files. --- crates/vp_migration/src/eslint.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index b333f5459f..8ccab93fe6 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -6,7 +6,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { boolean_flags: &[ "--cache", "--no-eslintrc", - "--no-error-on-unmatched-pattern", "--debug", "--no-inline-config", "--no-config-lookup", @@ -74,9 +73,10 @@ mod tests { assert_eq!(rewrite_eslint_script("eslint --cache --fix ."), "vp lint --fix ."); assert_eq!(rewrite_eslint_script("eslint --no-eslintrc --fix ."), "vp lint --fix ."); assert_eq!(rewrite_eslint_script("eslint --debug ."), "vp lint ."); + // Oxlint supports this flag with the same meaning, so it is kept assert_eq!( rewrite_eslint_script("eslint --no-error-on-unmatched-pattern --fix ."), - "vp lint --fix ." + "vp lint --no-error-on-unmatched-pattern --fix ." ); assert_eq!(rewrite_eslint_script("eslint --no-inline-config ."), "vp lint ."); assert_eq!(rewrite_eslint_script("eslint --no-color --stats --fix ."), "vp lint --fix ."); From 0723be4c526c188b25f04424d7be7d5e0b75a8bb Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 11:47:59 +0900 Subject: [PATCH 6/8] fix(migrate): keep ESLint flags that change checks in migrated scripts Stripping --no-config-lookup, --global, --report-unused-inline-configs, --suppress-rule, or --suppressions-location could silently change which checks run or what --fix applies, because migration does not carry these options into the config. Keep them so the migrated script fails loudly instead. --- crates/vp_migration/src/eslint.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index 8ccab93fe6..096686c9bf 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -8,7 +8,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--no-eslintrc", "--debug", "--no-inline-config", - "--no-config-lookup", "--color", "--no-color", "--no-warn-ignored", @@ -29,12 +28,8 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--cache-location", "--cache-file", "--cache-strategy", - "--global", - "--report-unused-inline-configs", "--flag", "--concurrency", - "--suppress-rule", - "--suppressions-location", ], flag_conversions: &[], }; @@ -150,13 +145,8 @@ mod tests { "--cache-location .eslintcache", "--cache-file .eslintcache", "--cache-strategy content", - "--global foo", - "--report-unused-inline-configs warn", "--flag unstable_config_lookup_from_file", "--concurrency 2", - "--suppress-rule no-console", - "--suppressions-location suppressions.json", - "--no-config-lookup", "--color", "--no-color", "--stats", @@ -180,6 +170,18 @@ mod tests { rewrite_eslint_script("eslint --rule 'no-console: error' src"), "vp lint --rule 'no-console: error' src" ); + for flags in [ + "--no-config-lookup", + "--global appRuntime", + "--report-unused-inline-configs error", + "--suppress-rule no-console", + "--suppressions-location suppressions.json", + ] { + assert_eq!( + rewrite_eslint_script(&format!("eslint {flags} --fix src")), + format!("vp lint {flags} --fix src"), + ); + } assert_eq!( rewrite_eslint_script("eslint --fix --pass-on-no-patterns $FILES"), "vp lint --fix --pass-on-no-patterns $FILES" From d45f87114f686a2ef44bd55a0030b58489393f6b Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 12:09:40 +0900 Subject: [PATCH 7/8] fix(migrate): convert --no-warn-ignored to --no-error-on-unmatched-pattern ESLint only warns about ignored files, so scripts such as lint-staged tasks pass --no-warn-ignored to succeed when every staged file is ignored. Oxlint skips ignored files silently but fails when nothing is left to lint, so convert the flag to --no-error-on-unmatched-pattern to keep that success. --- .../migration_eslint_lint_staged/package.json | 2 +- .../snapshots/migration_eslint_lint_staged.md | 2 +- crates/vp_migration/src/eslint.rs | 22 +++++++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json index 6e01190512..f5a352f874 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/package.json @@ -8,6 +8,6 @@ "vite": "^7.0.0" }, "lint-staged": { - "*.ts": "eslint --no-color --fix" + "*.ts": "eslint --no-color --no-warn-ignored --fix" } } diff --git a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/snapshots/migration_eslint_lint_staged.md b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/snapshots/migration_eslint_lint_staged.md index ded31805d7..255b4f1595 100644 --- a/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/snapshots/migration_eslint_lint_staged.md +++ b/crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/migration_eslint_lint_staged/snapshots/migration_eslint_lint_staged.md @@ -80,7 +80,7 @@ export default defineConfig({ ] }, staged: { - "*.ts": "vp lint --fix" + "*.ts": "vp lint --no-error-on-unmatched-pattern --fix" }, }); ``` diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index 096686c9bf..bb6a204c55 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -1,4 +1,4 @@ -use crate::script_rewrite::{ScriptRewriteConfig, rewrite_script}; +use crate::script_rewrite::{FlagConversion, ScriptRewriteConfig, rewrite_script}; const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { source_command: "eslint", @@ -10,7 +10,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--no-inline-config", "--color", "--no-color", - "--no-warn-ignored", "--exit-on-fatal-error", "--stats", "--pass-on-unpruned-suppressions", @@ -31,7 +30,12 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--flag", "--concurrency", ], - flag_conversions: &[], + // ESLint only warns about ignored files, but Oxlint fails when they leave nothing to lint. + flag_conversions: &[FlagConversion { + source_flags: &["--no-warn-ignored"], + target_flag: "--no-error-on-unmatched-pattern", + dedup_flag: "--no-error-on-unmatched-pattern", + }], }; /// Rewrite a single script: rename `eslint` → `vp lint` and strip ESLint-only flags. @@ -73,6 +77,17 @@ mod tests { rewrite_eslint_script("eslint --no-error-on-unmatched-pattern --fix ."), "vp lint --no-error-on-unmatched-pattern --fix ." ); + // ignored-only file lists keep succeeding, as they did with ESLint + assert_eq!( + rewrite_eslint_script("eslint --max-warnings 0 --no-warn-ignored --fix"), + "vp lint --max-warnings 0 --no-error-on-unmatched-pattern --fix" + ); + assert_eq!( + rewrite_eslint_script( + "eslint --no-warn-ignored --no-error-on-unmatched-pattern --fix ." + ), + "vp lint --no-error-on-unmatched-pattern --fix ." + ); assert_eq!(rewrite_eslint_script("eslint --no-inline-config ."), "vp lint ."); assert_eq!(rewrite_eslint_script("eslint --no-color --stats --fix ."), "vp lint --fix ."); @@ -150,7 +165,6 @@ mod tests { "--color", "--no-color", "--stats", - "--no-warn-ignored", "--exit-on-fatal-error", "--pass-on-unpruned-suppressions", ] { From 0bca50e297229ad518b464dda89ce1823cc9e4b5 Mon Sep 17 00:00:00 2001 From: JongKyung Lee Date: Wed, 25 Nov 2026 13:40:18 +0900 Subject: [PATCH 8/8] fix(migrate): keep ESLint feature flags in migrated scripts Feature flags such as v10_config_lookup_from_file change which config applies to each file, and migration does not carry that behavior over. Keep --flag so the migrated script fails loudly instead of silently dropping nested config rules. --- crates/vp_migration/src/eslint.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/vp_migration/src/eslint.rs b/crates/vp_migration/src/eslint.rs index bb6a204c55..19baae67a5 100644 --- a/crates/vp_migration/src/eslint.rs +++ b/crates/vp_migration/src/eslint.rs @@ -27,7 +27,6 @@ const ESLINT_CONFIG: ScriptRewriteConfig = ScriptRewriteConfig { "--cache-location", "--cache-file", "--cache-strategy", - "--flag", "--concurrency", ], // ESLint only warns about ignored files, but Oxlint fails when they leave nothing to lint. @@ -160,7 +159,6 @@ mod tests { "--cache-location .eslintcache", "--cache-file .eslintcache", "--cache-strategy content", - "--flag unstable_config_lookup_from_file", "--concurrency 2", "--color", "--no-color", @@ -190,6 +188,7 @@ mod tests { "--report-unused-inline-configs error", "--suppress-rule no-console", "--suppressions-location suppressions.json", + "--flag v10_config_lookup_from_file", ] { assert_eq!( rewrite_eslint_script(&format!("eslint {flags} --fix src")),