Skip to content

Commit 6bfcbdb

Browse files
authored
fix(check): respect oxlint exit code so denyWarnings fails vp check (#1425)
`vp check` was unconditionally resetting the status to success whenever lint reported only warnings, masking the non-zero exit code produced by oxlint when `options.denyWarnings` (or `--deny-warnings`) is enabled. Drop the override and trust oxlint's exit code so warning-only runs fail the check when warnings have been opted in as failures. Closes #1424 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes `vp check` exit-code behavior for warning-only lint results, which can cause previously-passing pipelines to fail when `denyWarnings` is enabled. Scope is small and localized to the check command plus a new regression snap-test. > > **Overview** > `vp check` no longer forces a success exit status when oxlint reports only warnings; it now propagates oxlint’s actual exit code so `lint.options.denyWarnings` (or `--deny-warnings`) correctly fails the check. > > Adds a new snap-test fixture `check-lint-warn-deny-warnings` that configures `denyWarnings: true` with a warning-level `no-console` rule and asserts the expected warning output and summary. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f6466c2. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 58141d7 commit 6bfcbdb

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

packages/cli/binding/src/check/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ pub(crate) async fn execute_check(
178178
Some(Err(failure)) => {
179179
if failure.errors == 0 && failure.warnings > 0 {
180180
output::warn(lint_message_kind.warning_heading());
181-
status = ExitStatus::SUCCESS;
182181
} else {
183182
output::error(lint_message_kind.issue_heading());
184183
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "check-lint-warn-deny-warnings",
3+
"version": "0.0.0",
4+
"private": true
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[1]> vp check
2+
pass: All 4 files are correctly formatted (<variable>ms, <variable> threads)
3+
warn: Lint warnings found
4+
⚠ eslint(no-console): Unexpected console statement.
5+
╭─[src/index.js:2:3]
6+
1 │ function hello() {
7+
2 │ console.log("hello");
8+
· ───────────
9+
3 │ }
10+
╰────
11+
help: Delete this console statement.
12+
13+
Found 0 errors and 1 warning in 2 files (<variable>ms, <variable> threads)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function hello() {
2+
console.log("hello");
3+
}
4+
5+
export { hello };
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"env": {
3+
"VITE_DISABLE_AUTO_INSTALL": "1"
4+
},
5+
"commands": ["vp check"]
6+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
lint: {
3+
options: {
4+
denyWarnings: true,
5+
},
6+
rules: {
7+
"no-console": "warn",
8+
},
9+
},
10+
};

0 commit comments

Comments
 (0)