Skip to content

Conversation

@connorshea
Copy link
Collaborator

@connorshea connorshea commented Nov 2, 2025

This was mostly built using GitHub Copilot w/ Claude Sonnet 4.5. This is primarily a port of the existing check logic I had written in JavaScript for detecting rules that violated this pattern, but somewhat more robust.

Due to how this is checked, it runs the website generation as part of this, and also uses git in order to run the website generation command. This is probably not desirable and there is likely a much better way to programmatically detect whether the rule is set up correctly without needing to generate the full docs as part of the test.

But this does work for now and the other attempts I tried weren't detecting all the problematic rules, so I'm pushing it up as a draft to be iterated upon. It's also using a somewhat-naive code-scanning method to implement the check for whether the schema is documented in the rule's documentation, which should probably also be improved by doing the check programmatically instead. It does work at least as well as the JavaScript script I've been refining, though.

I assume this isn't acceptable to merge as-is due to the naive implementation, but want to at least open this as a means of pushing forward on enforcing this for all lint rules via a test. We will need to if we do this run the tests with the ruledocs feature in CI for this to work (cargo test -p oxc_linter --features ruledocs), which is also potentially undesirable.

It should be noted that this technically also does not enforce that the config options be documented, it currently only checks that the declare_oxc_lint! macro has a config parameter passed.

Scuffed implementation for #15095

@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 2, 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 C-enhancement Category - New feature or request labels Nov 2, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 2, 2025

CodSpeed Performance Report

Merging #15234 will not alter performance

Comparing connorshea:add-rule-config-enforcer (e49bb9b) with main (6a2aaa2)

Summary

✅ 4 untouched
⏩ 33 skipped1

Footnotes

  1. 33 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.

…on options.

This was mostly built using GitHub Copilot w/ Claude Sonnet 4.5. This is primarily a port of the existing check logic I had written in JavaScript for detecting rules that violated, but somewhat more robust.

Due to how this is checked, it runs the website generation as part of this, and also uses `git` in order to run the website generation command. This is _probably_ not desirable and there is likely a much better way to programmatically detect whether the rule is set up correctly *without* needing to generate the full docs as part of the test.

But this does work for now and the other attempts I tried weren't detecting all the problematic rules, so I'll push it up as a draft. It's also using a somewhat-naive regex to implement the check for whether the schema is documented in the rule's documentation, which should probably also be improved by doing the check programmatically instead.
@connorshea connorshea force-pushed the add-rule-config-enforcer branch from 7ce7eb8 to e49bb9b Compare November 3, 2025 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant