Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ steps = [
{ argv = ["vp", "check"], continue-on-failure = true },
{ argv = ["vp", "check", "--quiet"], comment = "warning diagnostics are suppressed", continue-on-failure = true },
{ argv = ["vp", "lint", "--quiet"], comment = "standalone lint has the same warning suppression semantics", continue-on-failure = true },
{ argv = ["vp", "check", "--deny-warnings"], comment = "warnings fail the check", continue-on-failure = true },
]
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,24 @@ standalone lint has the same warning suppression semantics
Found 1 warning and 0 errors.
Finished in <duration> on 2 files with <n> rules using <n> threads.
```

## `vp check --deny-warnings`

warnings fail the check

**Exit code:** 1

```
pass: All 3 files are correctly formatted (<duration>, <n> 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 2 files (<duration>, <n> threads)
```
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Arguments:
Options:
--fix Auto-fix format and lint issues
--quiet Disable reporting on warnings, only errors are reported
--deny-warnings Treat lint warnings as errors
--no-fmt Skip format check
--no-lint Skip lint rules; type-check still runs when `lint.options.typeCheck` is true
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
Expand Down Expand Up @@ -43,6 +44,7 @@ Arguments:
Options:
--fix Auto-fix format and lint issues
--quiet Disable reporting on warnings, only errors are reported
--deny-warnings Treat lint warnings as errors
--no-fmt Skip format check
--no-lint Skip lint rules; type-check still runs when `lint.options.typeCheck` is true
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
Expand Down Expand Up @@ -71,6 +73,7 @@ Arguments:
Options:
--fix Auto-fix format and lint issues
--quiet Disable reporting on warnings, only errors are reported
--deny-warnings Treat lint warnings as errors
--no-fmt Skip format check
--no-lint Skip lint rules; type-check still runs when `lint.options.typeCheck` is true
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Arguments:
Options:
--fix Auto-fix format and lint issues
--quiet Disable reporting on warnings, only errors are reported
--deny-warnings Treat lint warnings as errors
--no-fmt Skip format check
--no-lint Skip lint rules; type-check still runs when `lint.options.typeCheck` is true
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Arguments:
Options:
--fix Auto-fix format and lint issues
--quiet Disable reporting on warnings, only errors are reported
--deny-warnings Treat lint warnings as errors
--no-fmt Skip format check
--no-lint Skip lint rules; type-check still runs when `lint.options.typeCheck` is true
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
Expand Down
1 change: 1 addition & 0 deletions docs/guide/check.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ We recommend turning both `typeAware` and `typeCheck` on so `vp check` becomes t
vp check
vp check --fix # Format and run autofixers.
vp check --quiet # Hide lint warnings; still report and fail on errors.
vp check --deny-warnings # Treat lint warnings as errors.
vp check --no-fmt # Skip format; run lint (and type-check if enabled).
vp check --no-lint # Skip lint rules; keep type-check when enabled.
vp check --no-fmt --no-lint # Type-check only (requires both `typeAware` and `typeCheck` enabled).
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/binding/src/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub(crate) async fn execute_check(
resolver: &SubcommandResolver,
fix: bool,
quiet: bool,
deny_warnings: bool,
no_fmt_flag: bool,
no_lint_flag: bool,
no_error_on_unmatched_pattern: bool,
Expand Down Expand Up @@ -175,6 +176,9 @@ pub(crate) async fn execute_check(
if quiet {
args.push("--quiet".to_string());
}
if deny_warnings {
args.push("--deny-warnings".to_string());
}
// `vp check` parses oxlint's human-readable summary output to print
// unified pass/fail lines. When `GITHUB_ACTIONS=true`, oxlint auto-switches
// to the GitHub reporter, which omits that summary on success and makes the
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/binding/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ async fn execute_direct_subcommand(
SynthesizableSubcommand::Check {
fix,
quiet,
deny_warnings,
no_fmt,
no_lint,
no_error_on_unmatched_pattern,
Expand All @@ -108,6 +109,7 @@ async fn execute_direct_subcommand(
&resolver,
fix,
quiet,
deny_warnings,
no_fmt,
no_lint,
no_error_on_unmatched_pattern,
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/binding/src/cli/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ pub enum SynthesizableSubcommand {
/// Disable reporting on warnings, only errors are reported
#[arg(long)]
quiet: bool,
/// Treat lint warnings as errors
#[arg(long = "deny-warnings")]
deny_warnings: bool,
/// Skip format check
#[arg(long = "no-fmt")]
no_fmt: bool,
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ const commandHelpDocs = {
label: '--quiet',
description: 'Disable reporting on warnings, only errors are reported',
},
{ label: '--deny-warnings', description: 'Treat lint warnings as errors' },
{ label: '--no-fmt', description: 'Skip format check' },
{
label: '--no-lint',
Expand Down