build(settings): add JSON output formatter for markdownlint-cli2#1382
Conversation
npm run lint:md previously produced only console output, so results were lost as soon as the terminal closed. markdownlint-cli2 supports outputFormatters; add the official markdownlint-cli2-formatter-json package and wire it up in .markdownlint-cli2.jsonc so a logs/markdownlint-results.json file is produced on every run (the logs/ directory is already gitignored). Manual verification: npm run lint:md now writes logs/markdownlint-results.json (0 entries when clean, full violation array with fileName/lineNumber/ruleNames/errorDetail when not). Closes microsoft#990.
WilliamBerryiii
left a comment
There was a problem hiding this comment.
LGTM with one suggested change.
Concern: Specifying outputFormatters replaces the default stderr listing rather than adding to it (per markdownlint-cli2 docs). After this change, npm run lint:md will stop printing human-readable violations to the console — devs and CI logs will only see the banner and have to open logs/markdownlint-results.json to find failures.
Suggested fix — include both formatters so console output is preserved alongside the new JSON file:
"outputFormatters": [
["markdownlint-cli2-formatter-default"],
["markdownlint-cli2-formatter-json", { "name": "logs/markdownlint-results.json" }]
]markdownlint-cli2-formatter-default is already pulled in transitively; if referenced explicitly in config it should also be added to dependencies in package.json.
Other notes (non-blocking):
- Nice catch on the missing EOF newline in
package.json. logs/is already gitignored, so the output file won't be committed. ✅- Worth adding a sentence to the PR description on the use case (e.g., enabling structured parsing referenced in
copilot-instructions.md).
WilliamBerryiii
left a comment
There was a problem hiding this comment.
LGTM with one suggested change.
Concern: Specifying outputFormatters replaces the default stderr listing rather than adding to it (per markdownlint-cli2 docs). After this change, npm run lint:md will stop printing human-readable violations to the console — devs and CI logs will only see the banner and have to open logs/markdownlint-results.json to find failures.
Suggested fix — include both formatters so console output is preserved alongside the new JSON file:
"outputFormatters": [
["markdownlint-cli2-formatter-default"],
["markdownlint-cli2-formatter-json", { "name": "logs/markdownlint-results.json" }]
]markdownlint-cli2-formatter-default is already pulled in transitively; if referenced explicitly in config it should also be added to dependencies in package.json.
Other notes (non-blocking):
- Nice catch on the missing EOF newline in
package.json. logs/is already gitignored, so the output file won't be committed. ✅- Worth adding a sentence to the PR description on the use case (e.g., enabling structured parsing referenced in
copilot-instructions.md).
Include markdownlint-cli2-formatter-default alongside the JSON formatter so > [email protected] lint:md > markdownlint-cli2 "**/*.md" markdownlint-cli2 v0.22.0 (markdownlint v0.40.0) Finding: **/*.md !**/node_modules/** !**/packages/** !.copilot-tracking/** !logs/** !venv/** !scripts/tests/Fixtures/** !extension/README.md !extension/README.*.md !extension/CHANGELOG.md !collections/*.collection.md !plugins/**/agents/** !plugins/**/instructions/** !plugins/**/commands/** !plugins/**/skills/** !plugins/**/docs/** !plugins/**/scripts/** !.github/instructions/** !.github/aw/logs/** !.github/agents/** !.github/prompts/** !.github/skills/** Linting: 197 file(s) Summary: 0 error(s) keeps emitting human-readable violations to stderr while also writing logs/markdownlint-results.json. Pin the default formatter as a direct devDependency since it is now referenced explicitly in config.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1382 +/- ##
==========================================
- Coverage 87.92% 87.91% -0.02%
==========================================
Files 62 62
Lines 9593 9593
==========================================
- Hits 8435 8434 -1
- Misses 1158 1159 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <[email protected]>
🔒 - Generated by Copilot
|
@MukundaKatta we have done the additional changes as we wanted to merge, thanks for your contribution! No actions required from you. |
Pull Request
Description
npm run lint:mdpreviously produced only console output, so markdown lint results were lost after the terminal session ended. This PR wires upmarkdownlint-cli2's official JSON formatter so runs also emitlogs/markdownlint-results.json, matching the structured log pattern already used by other linters in this repo.Changes included in this PR:
package.jsonandpackage-lock.json: add[email protected]as a dev dependency..markdownlint-cli2.jsonc: configureoutputFormattersto writelogs/markdownlint-results.json.No script changes are required because
markdownlint-cli2loads configured formatters automatically, andlogs/is already ignored by git.Related Issue(s)
Closes #990.
Type of Change
Select all that apply:
Code & Documentation:
Infrastructure & Configuration:
AI Artifacts:
prompt-builderagent and addressed all feedback.github/instructions/*.instructions.md).github/prompts/*.prompt.md).github/agents/*.agent.md).github/skills/*/SKILL.md)Other:
.ps1,.sh,.py)Testing
mkdir -p logs && npm run lint:mdlogs/markdownlint-results.jsonis created.[]on a clean tree and that the formatter schema matches the documented fields when violations exist.Checklist
Required Checks
AI Artifact Contributions
/prompt-analyzeto review contributionprompt-builderreviewRequired Automated Checks
The following validation commands must pass before merging:
npm run lint:mdnpm run spell-checknpm run lint:frontmatternpm run validate:skillsnpm run lint:md-linksnpm run lint:psnpm run plugin:generatenpm run docs:testSecurity Considerations
Additional Notes