Skip to content

Comments

feat(linter): Update linter JSON rule output to include extra information.#15763

Merged
graphite-app[bot] merged 1 commit intomainfrom
implement-12499
Jan 14, 2026
Merged

feat(linter): Update linter JSON rule output to include extra information.#15763
graphite-app[bot] merged 1 commit intomainfrom
implement-12499

Conversation

@connorshea
Copy link
Member

@connorshea connorshea commented Nov 17, 2025

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.

@connorshea connorshea requested a review from camc314 as a code owner November 17, 2025 06:02
Copilot AI review requested due to automatic review settings November 17, 2025 06:02
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 17, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-enhancement Category - New feature or request labels Nov 17, 2025
Copy link
Contributor

Copilot AI left a 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 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, and type_aware fields 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 13, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 41 skipped benchmarks1


Comparing implement-12499 (0b4a96e) with main (6b29bd1)2

Open in CodSpeed

Footnotes

  1. 41 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (e795a0a) during the generation of this report, so 6b29bd1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 self-assigned this Jan 14, 2026
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Jan 14, 2026
Copy link
Contributor

camc314 commented Jan 14, 2026

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.
@graphite-app graphite-app bot merged commit 1757251 into main Jan 14, 2026
20 checks passed
@graphite-app graphite-app bot deleted the implement-12499 branch January 14, 2026 12:15
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 14, 2026
graphite-app bot pushed a commit that referenced this pull request Jan 14, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants