fix(jsts): stop reporting prettier as eslint, and distil prettier's real output#130
Merged
Merged
Conversation
…eal output (#114) Three compounding defects made `npm run format` (prettier --write, which rewrote files across 109 paths) come out as `eslint: no problems found` — a destructive command reported as a clean run of a different tool that never ran. 1. `is_eslint_output` matched the bare word "eslint", which appears as a FILENAME (`eslint.config.js`) in prettier's file list. eslint is checked before prettier in the dispatch chain, so prettier output was handed to `distill_eslint`, which found no findings and returned "eslint: no problems found". Same substring-in- data trap as #105/#106. 2. `is_prettier_output` only matched lowercase `checking `/`reformatted `, but prettier prints `Checking formatting…` and `[warn]`. The detector was dead. 3. `distill_prettier` parsed black's `reformatted N files` summary — prettier prints no such line — so both counters stayed 0 and a failing `--check` and a successful `--write` both rendered `prettier: 0 files reformatted, 0 unchanged`. Fixes: eslint detection anchors on eslint's real line shape (`✖ N problems (`, a rule id, or a `<line>:<col> error|warning` finding) instead of a substring that also occurs in filenames; prettier detection matches what prettier really prints; `distill_prettier` is rewritten per mode — `--check` surfaces the offending filenames, `--write` reports "N reformatted, M unchanged" and names the changed files (capped) — and declines (returns input) rather than fabricate a count when neither mode is recognisable. Verified through the real binary: `npm run format` now → `prettier --write: 3 reformatted, 6 unchanged` + the three changed files, no eslint. Snapshot tests added for both modes; teeth proven by restoring the filename match and watching --write revert to `eslint: no problems found`. The existing eslint/vitest/tsc snapshots are unchanged. Not fixed: report's defect 4 (`--check` reorder + `[warn]` filename drop) — an untraced stdout/stderr-ordering observation, left for its own issue.
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.
Closes #114
Problem — three compounding prettier defects
npm run format(prettier --write ., which rewrote files across 109 paths) came out as:A destructive command reported as a clean run of a different tool that never ran.
is_eslint_outputmatched the bare wordeslint— which appears as a filename,eslint.config.js, in prettier's file list — and eslint is checked before prettier, so prettier output went todistill_eslint→eslint: no problems found. Same substring-in-data trap as CloudDistiller misidentifies any 'kubectl get <resource> -A' table as a pod table, reporting healthy objects as errors #105/Composite npm scripts are distilled as a single tool:npm run verifycollapses 19.5 KB totsc: no errors, discarding four of five gates #106.is_prettier_outputonly matched lowercasechecking/reformatted, but prettier printsChecking formatting…and[warn]. It never fired on real prettier output.distill_prettierparsed black'sreformatted N filessummary, which prettier never prints — so both counters stayed 0 and a failing--checkand a successful--writeboth renderedprettier: 0 files reformatted, 0 unchanged("nothing to do" in the one case the gate is red).Fix
✖ N problems (, a rule id (@typescript-eslint/…), or a<line>:<col> error|warningfinding line.Checking formatting,[warn],Code style issues, a<path> <n>mswrite line, or aprettierecho (any case).distill_prettierrewritten per mode:--checksurfaces the offending filenames (prettier --check: N file(s) need formatting);--writereportsN reformatted, M unchangedand names the changed files (capped); declines (returns input) rather than fabricate a count when neither mode is recognisable.Verified (real binary + snapshots)
prettier --check→prettier --check: 2 file(s) need formatting+ the filenames (wasprettier: 0 files reformatted, 0 unchanged).Snapshot tests added for both modes (
prettier_write.txt,prettier_check.txt). Teeth: restoring theeslintfilename match reverts--writeto the exact reportedeslint: no problems found; restoring the fix keeps the prettier summary. The existing eslint / vitest / tsc snapshots are unchanged.Gates:
cargo fmt/clippy -D warnings/cargo test(1048 passed, 0 failed) on local Homebrew 1.94.0, not CI's pinned 1.97.0 — CI is the source of truth for clippy.Not fixed here
Report's defect 4 —
prettier --checkoutput reordered with the[warn]filename dropped — is an untraced stdout/stderr-ordering observation (omni execinherits stderr, so the[warn]lines never reach the distiller there; the merged hook payload is fine). The reporter flagged it as observation, not diagnosis; left for its own issue. This distiller fix is order-independent (it scans all lines for[warn]).PR Auto Describe
Summary
Fixed three compounding defects in
distillers::jststhat misidentified prettier output as eslint:is_eslint_outputmatched filenames containing "eslint",is_prettier_outputonly matched lowercase strings that never fired on real prettier output, anddistill_prettierparsed black's summary format that prettier never prints. Added snapshot tests for both--checkand--writemodes.Key Changes
is_eslint_output: Anchored detection on real eslint output shapes (problems (, rule ids, finding lines) — no longer matches bare word "eslint" in filenamesis_prettier_output: Matches capitalized "Checking formatting…",[warn], "Code style issues", and prettier's<path> <n>msfile linesdistill_prettier: Rewritten to parse prettier's real output per mode; declines (returns input) rather than fabricate zeros when output is unrecognizedDetailed Breakdown
is_eslint_finding_line: Parses eslint's<line>:<col> error|warning …shape — requires all-digit line/col and anerror/warningkeyword tokenis_prettier_write_line: Detects<path> <n>mspattern by verifying a token ending inmswith numeric prefixcapped_lines: Helper renders file lists with 20-item cap and… and N moretaildistill_prettier--check: Extracts[warn] <path>lines, reports count and capped filenames, or "all files formatted" if cleandistill_prettier--write: Separates changed vs(unchanged)files from<path> <n>mslines, reports counts and changed filenames cappedtests/fixtures/prettier_check.txt,tests/fixtures/prettier_write.txttest_jsts_prettier_check,test_jsts_prettier_writeNotes
The
--checkstdout/stderr ordering issue noted in #114 is out of scope — filed separately.Last updated: 2026-07-21 08:57:28