fix: lint --format markdown renders report instead of [object Object]#95
Merged
Conversation
formatAsMarkdown template-literaled obj.summary directly, which coerced
the lint summary object { errors, warnings, infos } to its toString
representation '[object Object]'.
Detect the lint output shape (findings array + numeric summary) and
render a proper markdown report with severity counts and a bulleted
findings list. The legacy string-summary path for fixer/diff shapes
is preserved.
Adds 6 tests covering the regression, findings with and without paths,
empty findings, the --format md alias, and the legacy fixer shape.
Fixes the bug originally reported in PR #56.
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
lint --format markdownemits a literal# [object Object]instead of a readable report. This was originally reported in PR #56, which was closed due to CLA. Thank you to @johansabent for raising it originally.Before:
After:
Root cause
formatAsMarkdowninutils.tstemplate-literaledobj.summarydirectly on line 59:\# ${obj.summary}`. This works when summary is a string (the legacy fixer shape) but the lint command returns{ errors: number, warnings: number, infos: number }, which coerces to[object Object]`.Fix
findingsarray + numericsummaryobject) and route to a dedicatedformatLintAsMarkdownrendererobj.summarybranch ontypeof obj.summary === 'string'so fixer/diff shapes still workTests
New
utils.test.tswith 6 tests:[object Object]and produces a headed report (regression test)--format mdalias worksAll 244 tests pass.