From a68bf59c3266f373fa5de42465e6aa1501e5b7c7 Mon Sep 17 00:00:00 2001 From: MK Date: Thu, 2 Apr 2026 14:00:40 +0800 Subject: [PATCH 1/2] fix(check): do not treat lint warnings as errors in exit code When oxlint reports only warnings (0 errors), override the raw exit code to SUCCESS instead of propagating oxlint's non-zero exit code. This fixes ecosystem-ci failures where type-aware lint rules (e.g. typescript-eslint/await-thenable) produce warnings that cause `vp check --fix` to exit with code 1. --- packages/cli/binding/src/cli.rs | 1 + .../snap-tests/check-fix-lint-warn/.oxlintrc.json | 5 +++++ .../cli/snap-tests/check-fix-lint-warn/package.json | 5 +++++ .../cli/snap-tests/check-fix-lint-warn/snap.txt | 13 +++++++++++++ .../cli/snap-tests/check-fix-lint-warn/src/index.js | 5 +++++ .../cli/snap-tests/check-fix-lint-warn/steps.json | 6 ++++++ 6 files changed, 35 insertions(+) create mode 100644 packages/cli/snap-tests/check-fix-lint-warn/.oxlintrc.json create mode 100644 packages/cli/snap-tests/check-fix-lint-warn/package.json create mode 100644 packages/cli/snap-tests/check-fix-lint-warn/snap.txt create mode 100644 packages/cli/snap-tests/check-fix-lint-warn/src/index.js create mode 100644 packages/cli/snap-tests/check-fix-lint-warn/steps.json diff --git a/packages/cli/binding/src/cli.rs b/packages/cli/binding/src/cli.rs index 6ddcb82688..1ede4a2146 100644 --- a/packages/cli/binding/src/cli.rs +++ b/packages/cli/binding/src/cli.rs @@ -1214,6 +1214,7 @@ async fn execute_direct_subcommand( Some(Err(failure)) => { if failure.errors == 0 && failure.warnings > 0 { output::warn(lint_message_kind.warning_heading()); + status = ExitStatus::SUCCESS; } else { output::error(lint_message_kind.issue_heading()); } diff --git a/packages/cli/snap-tests/check-fix-lint-warn/.oxlintrc.json b/packages/cli/snap-tests/check-fix-lint-warn/.oxlintrc.json new file mode 100644 index 0000000000..6479217883 --- /dev/null +++ b/packages/cli/snap-tests/check-fix-lint-warn/.oxlintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "no-console": "warn" + } +} diff --git a/packages/cli/snap-tests/check-fix-lint-warn/package.json b/packages/cli/snap-tests/check-fix-lint-warn/package.json new file mode 100644 index 0000000000..e1e2c2fdf9 --- /dev/null +++ b/packages/cli/snap-tests/check-fix-lint-warn/package.json @@ -0,0 +1,5 @@ +{ + "name": "check-fix-lint-warn", + "version": "0.0.0", + "private": true +} diff --git a/packages/cli/snap-tests/check-fix-lint-warn/snap.txt b/packages/cli/snap-tests/check-fix-lint-warn/snap.txt new file mode 100644 index 0000000000..5160027f39 --- /dev/null +++ b/packages/cli/snap-tests/check-fix-lint-warn/snap.txt @@ -0,0 +1,13 @@ +> vp check --fix +warn: Lint warnings found +⚠ eslint(no-console): Unexpected console statement. + ╭─[src/index.js:2:3] + 1 │ function hello() { + 2 │ console.log("hello"); + · ─────────── + 3 │ } + ╰──── + help: Delete this console statement. + +Found 0 errors and 1 warning in 1 file (ms, threads) +pass: Formatting completed for checked files (ms) diff --git a/packages/cli/snap-tests/check-fix-lint-warn/src/index.js b/packages/cli/snap-tests/check-fix-lint-warn/src/index.js new file mode 100644 index 0000000000..9373ddd734 --- /dev/null +++ b/packages/cli/snap-tests/check-fix-lint-warn/src/index.js @@ -0,0 +1,5 @@ +function hello() { + console.log("hello"); +} + +export { hello }; diff --git a/packages/cli/snap-tests/check-fix-lint-warn/steps.json b/packages/cli/snap-tests/check-fix-lint-warn/steps.json new file mode 100644 index 0000000000..b09548d9eb --- /dev/null +++ b/packages/cli/snap-tests/check-fix-lint-warn/steps.json @@ -0,0 +1,6 @@ +{ + "env": { + "VITE_DISABLE_AUTO_INSTALL": "1" + }, + "commands": ["vp check --fix"] +} From b24b5272bfd58d668cae9d5f177416da002bc503 Mon Sep 17 00:00:00 2001 From: MK Date: Thu, 2 Apr 2026 14:11:10 +0800 Subject: [PATCH 2/2] test(check): add follow-up vp check after vp check --fix in lint warn snap test Verify that a plain `vp check` also exits with code 0 when only warnings are present, matching the --fix behavior. --- .../cli/snap-tests/check-fix-lint-warn/snap.txt | 14 ++++++++++++++ .../cli/snap-tests/check-fix-lint-warn/steps.json | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/cli/snap-tests/check-fix-lint-warn/snap.txt b/packages/cli/snap-tests/check-fix-lint-warn/snap.txt index 5160027f39..c9956c8c46 100644 --- a/packages/cli/snap-tests/check-fix-lint-warn/snap.txt +++ b/packages/cli/snap-tests/check-fix-lint-warn/snap.txt @@ -11,3 +11,17 @@ warn: Lint warnings found Found 0 errors and 1 warning in 1 file (ms, threads) pass: Formatting completed for checked files (ms) + +> vp check +pass: All 4 files are correctly formatted (ms, threads) +warn: Lint warnings found +⚠ eslint(no-console): Unexpected console statement. + ╭─[src/index.js:2:3] + 1 │ function hello() { + 2 │ console.log("hello"); + · ─────────── + 3 │ } + ╰──── + help: Delete this console statement. + +Found 0 errors and 1 warning in 1 file (ms, threads) diff --git a/packages/cli/snap-tests/check-fix-lint-warn/steps.json b/packages/cli/snap-tests/check-fix-lint-warn/steps.json index b09548d9eb..26bc19147b 100644 --- a/packages/cli/snap-tests/check-fix-lint-warn/steps.json +++ b/packages/cli/snap-tests/check-fix-lint-warn/steps.json @@ -2,5 +2,5 @@ "env": { "VITE_DISABLE_AUTO_INSTALL": "1" }, - "commands": ["vp check --fix"] + "commands": ["vp check --fix", "vp check"] }