Skip to content

fix(lint): count Prettier's "(unchanged)" lines in prettier-format - #1201

Merged
horza-bora merged 1 commit into
mainfrom
fix/1161-prettier-unchanged-count
Oct 19, 2026
Merged

horza-bora merged 1 commit into
mainfrom
fix/1161-prettier-unchanged-count

Conversation

@Dave-London

Copy link
Copy Markdown
Owner

What changed

Prettier 3 --write prints file.ts 12ms (unchanged) for a file that's already formatted. parsePrettierWrite strips 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, filesUnchanged was always 0 (#1161).

The parser now strips the (unchanged) marker before the timing, and counts those lines as unchanged rather than changed. prettier-format adds them to the processed total that filesUnchanged is derived from.

Fixes #1161.

How it was tested

  • Real Prettier 3.9.6 output: ok1.ts 26ms (unchanged), ok2.ts 2ms (unchanged), bad.ts 2ms. That's now a new unit test, plus one covering the total passed to buildPrettierWriteResult.
  • End to end on those three files. The Aug 19 build returns filesChanged 1, filesUnchanged 0; this branch returns filesChanged 1, filesUnchanged 2.
  • server-lint: prettier-format 23 of 23, parsers 34 of 34, fidelity 41 of 41. Smoke 2337 of 2337. tsc and prettier are clean.

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 horza-bora left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: "(unchanged)" lines counted; verified old vs new end to end. CI green.

@horza-bora
horza-bora merged commit 9e55ebb into main Oct 19, 2026
11 checks passed
@horza-bora
horza-bora deleted the fix/1161-prettier-unchanged-count branch October 19, 2026 10:18
@pare-ci-bot pare-ci-bot Bot mentioned this pull request Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pare-lint prettier-format: filesUnchanged is always 0 because "(unchanged)" lines are dropped

2 participants