feat(linter): Add test to enforce schema documentation for rules with configuration options #15234
+265
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
gitin 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
ruledocsfeature 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 aconfigparameter passed.Scuffed implementation for #15095