-
-
Notifications
You must be signed in to change notification settings - Fork 726
feat(linter): Add an "Enabled" total to the bottom of the --rules output, and add enabled value to the json rules output.
#15847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
And also pass it to the JSON output of all_rules, but that's not implemented quite yet.
…efine this logic in one place, rather than two.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
CodSpeed Performance ReportMerging #15847 will not alter performanceComparing Summary
Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an "Enabled" count to the --rules output, displayed alongside the existing "Default" and "Total" counts. It also refactors the rule table rendering code to eliminate duplication between CLI and website rendering paths.
Key changes:
- Unified
render_markdown_tableandrender_markdown_table_climethods into a single API that optionally accepts enabled rule names - Added "Enabled" count display in the default formatter when the enabled set is provided
- Simplified the
--rulesoutput logic in the CLI runner
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/oxc_linter/src/table.rs |
Consolidated two methods into one render_markdown_table method that optionally accepts enabled rules and conditionally renders the "Enabled?" column |
apps/oxlint/src/output_formatter/mod.rs |
Updated the InternalFormatter trait to pass enabled rules to all_rules method |
apps/oxlint/src/output_formatter/default.rs |
Added logic to display "Enabled: N" count when enabled rules are provided, with new test coverage |
apps/oxlint/src/output_formatter/json.rs |
Updated method signature to match trait changes |
apps/oxlint/src/lint.rs |
Refactored to build enabled set conditionally and pass it to the formatter |
tasks/website/src/linter/rules/table.rs |
Updated call site to pass None for enabled parameter, preserving existing behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Connor Shea <[email protected]>
This will print whether each rule is enabled in the JSON output of `--rules`. Maybe we should make this return a string instead of a boolean, to distinguish between off/warn/error?
--rules output.--rules output, and add enabled value to the json rules output.
This adds an enabled count to the
--rulesoutput alongside default and total:For example, with this lint config:
We get this output:
Output
This also refactors the lint rules printing code to simplify it a bit, we previously had two near-identical copies of this code. The rule table for the website is also able to generate fine still, and does not include the enabled column.
It also exposes the
enabledvalue to the json formatter, when runningoxlint --rules -f=json, so we print json objects like this:{ "scope": "vue", "value": "valid-define-props", "category": "correctness", "enabled": false }