Repository navigation
Conversation
guyoron1
force-pushed
the
fix/prettier-check-stderr-false-success
branch
from
August 15, 2026 07:22
6e359a1 to
f2c1e48
Compare
This was referenced Aug 17, 2026
The filter printed "All files formatted correctly" for any output that
had no parsable file list. Prettier >= 1.19 writes its --check findings
("[warn] <file>", "[error] ...") to stderr, so a syntax error or a
non-matching pattern (exit 2), and a failing check seen through
`rtk format`, had no list to parse and came out as formatted next to a
non-zero exit code.
- give the filter the exit code: a failing run with no parsable file
list passes what prettier printed through instead of a success line
- recognise "[warn] <file>" lines, which `rtk format` hands the filter
because it filters stdout and stderr together
- `rtk prettier` keeps filtering stdout only and forwarding stderr, so
prettier's own diagnostics still reach the user untouched
guyoron1
force-pushed
the
fix/prettier-check-stderr-false-success
branch
from
September 21, 2026 12:20
f2c1e48 to
aa5f31e
Compare
Contributor
Author
|
Reworked after the stdout-only stderr forwarding landed: The filter now takes the exit code and refuses to summarise a failed run, and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rtk prettier --checkandrtk format prettier --checkcould reportPrettier: All files formatted correctlyfor a run that had failed.Reproduced with prettier 3.9.8:
Prettier: All files formatted correctlyon stdout, with the real[error] ...only on stderrrtk format prettier --check bad.js(which filters stdout and stderr together) printedPrettier: All files formatted correctlywith exit code 1, and for a syntax error lost every diagnosticFix: the prettier filter now takes the exit code and refuses to summarise a failed run (
files_to_format.is_empty() && exit_code != 0returns prettier's own text),[warn] <file>lines are recognised (needed for thertk formatpath), andrtk formatpasses the exit code through.rtk prettierkeepsRunOptions::stdout_only()and forwards stderr, so the contract pinned bytests/stderr_only_failure_test.rsstill holds. A plain failing check throughrtk prettierwas already faithful on develop (raw stdout plus the forwarded[warn]lines) and is unchanged.An earlier version of this PR filtered the combined stream inside
rtk prettier. Since stdout-only stderr forwarding landed, that failsno_invented_stdout_diagnostic_when_the_tool_used_stderr, so it is reduced here to the part that still reproduces.Overlaps #2410 (fixes #2395 with the same combined-stream idea; merged onto develop it fails that pinned test as well, and it does not pass the exit code from
rtk format). Glad to coordinate on whichever the maintainers prefer.Test plan
tests/prettier_failed_run_test.rs(4 tests; a stand-inprettierprinting real 3.9.8 output on the right streams): 3 of the 4 fail on develop's code with the false success linetests/stderr_only_failure_test.rsstill passes (6 tests)cargo fmt --all -- --check,cargo clippy --all-targets(0 warnings),cargo test --all(all pass)