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..c9956c8c46 --- /dev/null +++ b/packages/cli/snap-tests/check-fix-lint-warn/snap.txt @@ -0,0 +1,27 @@ +> 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) + +> 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/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..26bc19147b --- /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", "vp check"] +}