Skip to content

Commit 885b29f

Browse files
committed
fix(check): respect oxlint exit code so denyWarnings fails vp check
`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
1 parent 1ffb0f8 commit 885b29f

6 files changed

Lines changed: 43 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,12 @@ pub(crate) async fn execute_check(
176176
}
177177
}
178178
Some(Err(failure)) => {
179+
// Trust the oxlint exit code: oxlint exits 0 for warning-only
180+
// output by default and exits non-zero when `denyWarnings` (or
181+
// `--deny-warnings`) promotes warnings to failures. The heading
182+
// still reflects the findings (warnings vs errors).
179183
if failure.errors == 0 && failure.warnings > 0 {
180184
output::warn(lint_message_kind.warning_heading());
181-
status = ExitStatus::SUCCESS;
182185
} else {
183186
output::error(lint_message_kind.issue_heading());
184187
}
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)