Repository navigation
fix(lint): count Prettier's "(unchanged)" lines in prettier-format - #1201
Merged
Merged
Conversation
Prettier 3 --write prints "file.ts 12ms (unchanged)" for files already formatted. parsePrettierWrite's timing strip was anchored to the line end, so those lines failed the file-path check and were dropped, and filesUnchanged was always 0 (#1161). parsePrettierWrite now strips the marker before the timing, counts those lines as filesUnchanged (not as changed files), and the tool adds them to the processed total. Checked end to end on 2 formatted + 1 unformatted file: the Aug 19 build reports filesUnchanged 0, this branch 2. Fixes #1161
horza-bora
approved these changes
Oct 19, 2026
horza-bora
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed: "(unchanged)" lines counted; verified old vs new end to end. CI green.
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.
What changed
Prettier 3
--writeprintsfile.ts 12ms (unchanged)for a file that's already formatted.parsePrettierWritestrips timing with a pattern anchored to the end of the line, so those lines kept their(unchanged)suffix, failed the file-path check and were dropped. As a result,filesUnchangedwas always 0 (#1161).The parser now strips the
(unchanged)marker before the timing, and counts those lines as unchanged rather than changed.prettier-formatadds them to the processed total thatfilesUnchangedis derived from.Fixes #1161.
How it was tested
ok1.ts 26ms (unchanged),ok2.ts 2ms (unchanged),bad.ts 2ms. That's now a new unit test, plus one covering the total passed tobuildPrettierWriteResult.filesChanged 1, filesUnchanged 0; this branch returnsfilesChanged 1, filesUnchanged 2.prettier-format23 of 23,parsers34 of 34,fidelity41 of 41. Smoke 2337 of 2337. tsc and prettier are clean.