From f373ca88f8a292a0244431b5798b7279238212c6 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Sun, 15 Mar 2026 21:43:14 +0800 Subject: [PATCH] fix: failed to check inside github action --- packages/cli/binding/src/cli.rs | 6 ++++++ .../check-pass-typecheck-github-actions/package.json | 5 +++++ .../check-pass-typecheck-github-actions/snap.txt | 3 +++ .../check-pass-typecheck-github-actions/src/index.js | 5 +++++ .../check-pass-typecheck-github-actions/steps.json | 7 +++++++ .../check-pass-typecheck-github-actions/vite.config.ts | 8 ++++++++ 6 files changed, 34 insertions(+) create mode 100644 packages/cli/snap-tests/check-pass-typecheck-github-actions/package.json create mode 100644 packages/cli/snap-tests/check-pass-typecheck-github-actions/snap.txt create mode 100644 packages/cli/snap-tests/check-pass-typecheck-github-actions/src/index.js create mode 100644 packages/cli/snap-tests/check-pass-typecheck-github-actions/steps.json create mode 100644 packages/cli/snap-tests/check-pass-typecheck-github-actions/vite.config.ts diff --git a/packages/cli/binding/src/cli.rs b/packages/cli/binding/src/cli.rs index 4c17fbd04c..d33c960f9c 100644 --- a/packages/cli/binding/src/cli.rs +++ b/packages/cli/binding/src/cli.rs @@ -1109,6 +1109,12 @@ async fn execute_direct_subcommand( if fix { args.push("--fix".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 + // parser think linting never started. Force the default reporter here so the + // captured output is stable across local and CI environments. + args.push("--format=default".to_string()); if has_paths { args.extend(paths.iter().cloned()); } diff --git a/packages/cli/snap-tests/check-pass-typecheck-github-actions/package.json b/packages/cli/snap-tests/check-pass-typecheck-github-actions/package.json new file mode 100644 index 0000000000..b8fff0c623 --- /dev/null +++ b/packages/cli/snap-tests/check-pass-typecheck-github-actions/package.json @@ -0,0 +1,5 @@ +{ + "name": "check-pass-typecheck-github-actions", + "version": "0.0.0", + "private": true +} diff --git a/packages/cli/snap-tests/check-pass-typecheck-github-actions/snap.txt b/packages/cli/snap-tests/check-pass-typecheck-github-actions/snap.txt new file mode 100644 index 0000000000..ee9e81eaf4 --- /dev/null +++ b/packages/cli/snap-tests/check-pass-typecheck-github-actions/snap.txt @@ -0,0 +1,3 @@ +> vp check +pass: All 4 files are correctly formatted (ms, threads) +pass: Found no warnings, lint errors, or type errors in 2 files (ms, threads) diff --git a/packages/cli/snap-tests/check-pass-typecheck-github-actions/src/index.js b/packages/cli/snap-tests/check-pass-typecheck-github-actions/src/index.js new file mode 100644 index 0000000000..13305bd3e9 --- /dev/null +++ b/packages/cli/snap-tests/check-pass-typecheck-github-actions/src/index.js @@ -0,0 +1,5 @@ +function hello() { + return "hello"; +} + +export { hello }; diff --git a/packages/cli/snap-tests/check-pass-typecheck-github-actions/steps.json b/packages/cli/snap-tests/check-pass-typecheck-github-actions/steps.json new file mode 100644 index 0000000000..4c511adfb7 --- /dev/null +++ b/packages/cli/snap-tests/check-pass-typecheck-github-actions/steps.json @@ -0,0 +1,7 @@ +{ + "env": { + "GITHUB_ACTIONS": "true", + "VITE_DISABLE_AUTO_INSTALL": "1" + }, + "commands": ["vp check"] +} diff --git a/packages/cli/snap-tests/check-pass-typecheck-github-actions/vite.config.ts b/packages/cli/snap-tests/check-pass-typecheck-github-actions/vite.config.ts new file mode 100644 index 0000000000..ecd9dc9d34 --- /dev/null +++ b/packages/cli/snap-tests/check-pass-typecheck-github-actions/vite.config.ts @@ -0,0 +1,8 @@ +export default { + lint: { + options: { + typeAware: true, + typeCheck: true, + }, + }, +};