feat(linter): Update linter JSON rule output to include extra information.#15763
feat(linter): Update linter JSON rule output to include extra information.#15763graphite-app[bot] merged 1 commit intomainfrom
Conversation
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. |
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the JSON output format for the oxlint --rules -f=json command by adding three new fields to provide more comprehensive rule information: docs_url (documentation URL), has_fix (boolean indicating fix availability), and type_aware (boolean indicating if the rule is type-aware/tsgolint).
Key Changes:
- Added
docs_url,has_fix, andtype_awarefields to the JSON rule output - Documentation URLs are constructed following the pattern
https://oxc.rs/docs/guide/usage/linter/rules/{plugin}/{rule}.html - Test assertions updated to validate the presence of new fields
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apps/oxlint/src/output_formatter/json.rs | Extended RuleInfoJson struct with three new fields and implemented logic to populate them from rule metadata |
| apps/oxlint/src/lint.rs | Added test assertions to verify the new fields are present in JSON output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2da14ba to
edb0729
Compare
edb0729 to
a0c42c0
Compare
a0c42c0 to
5ff3d0d
Compare
5ff3d0d to
749ac64
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
Merge activity
|
…tion. (#15763) Partially addresses #12499. When running `oxlint --rules -f=json`, the output JSON for each rule now includes: - `docs_url`: A URL pointing to the documentation page for the rule. - `fix`: A string indicating the type of fixer a rule has, if any. - `type_aware`: A boolean indicating whether the rule is type-aware (meaning a tsgolint rule). e.g: ```json { "scope": "vue", "value": "require-typed-ref", "category": "style", "type_aware": false, "fix": "none", "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vue/require-typed-ref.html" }, { "scope": "vue", "value": "valid-define-emits", "category": "correctness", "type_aware": false, "fix": "pending", "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vue/valid-define-emits.html" }, ``` You can see the full JSON output by this here: https://gist.github.com/connorshea/2a239e01f32740411f231c493bffb5ce I don't know if including the docs for all the rules in this is necessarily a good idea, as it'd be pretty huge, but it would be possible to do if we want to. I think we should probably serialize something about the config options here in the future as well, but I didn't feel like bothering with that right now.
0b4a96e to
1757251
Compare
…17973) This builds on #15763 to change the rules generation for the website repo to emit a JSON file. This will support oxc-project/website#782 I have removed the ability to have a link prefix for the generated markdown table, as it was only used for the generated-rules.md file.
Partially addresses #12499.
When running
oxlint --rules -f=json, the output JSON for each rule now includes:docs_url: A URL pointing to the documentation page for the rule.fix: A string indicating the type of fixer a rule has, if any.type_aware: A boolean indicating whether the rule is type-aware (meaning a tsgolint rule).e.g:
{ "scope": "vue", "value": "require-typed-ref", "category": "style", "type_aware": false, "fix": "none", "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vue/require-typed-ref.html" }, { "scope": "vue", "value": "valid-define-emits", "category": "correctness", "type_aware": false, "fix": "pending", "docs_url": "https://oxc.rs/docs/guide/usage/linter/rules/vue/valid-define-emits.html" },You can see the full JSON output by this here: https://gist.github.com/connorshea/2a239e01f32740411f231c493bffb5ce
I don't know if including the docs for all the rules in this is necessarily a good idea, as it'd be pretty huge, but it would be possible to do if we want to. I think we should probably serialize something about the config options here in the future as well, but I didn't feel like bothering with that right now.