Skip to content

Conversation

@connorshea
Copy link
Contributor

@connorshea connorshea commented Jan 16, 2026

Fix #18045.

To avoid any contributors trying to generate rules that are not possible/that we don't want, don't want to waste people's time if we can avoid it.

Examples:

connorshea@Connors-MacBook-Pro oxc % just new-n-rule no-hide-core-modules
cargo run -p rulegen no-hide-core-modules n
   Compiling rulegen v0.0.0 (/Users/connorshea/code/oxc/tasks/rulegen)
    Finished `dev` profile [unoptimized] target(s) in 1.61s
     Running `target/debug/rulegen no-hide-core-modules n`

Error: This rule is either not planned or not possible to implement in Oxlint.
The rule 'n/no-hide-core-modules' will not be implemented for the following reason:
> This rule is deprecated in eslint-plugin-n for being inherently incorrect, no need for us to implement it.

error: Recipe `new-rule` failed on line 157 with exit code 1
connorshea@Connors-MacBook-Pro oxc % just new-rule no-dupe-args          
cargo run -p rulegen no-dupe-args eslint
    Finished `dev` profile [unoptimized] target(s) in 0.21s
     Running `target/debug/rulegen no-dupe-args eslint`

Error: This rule is either not planned or not possible to implement in Oxlint.
The rule 'eslint/no-dupe-args' will not be implemented for the following reason:
> Superseded by strict mode.

error: Recipe `new-rule` failed on line 157 with exit code 1

And generating a valid rule like just new-react-rule no-multi-comp still works:

Reading test file from https://raw.githubusercontent.com/jsx-eslint/eslint-plugin-react/master/tests/lib/rules/no-multi-comp.js
File parsed and 16 pass cases, 20 fail cases are found
Reading rule source file from https://raw.githubusercontent.com/jsx-eslint/eslint-plugin-react/master/lib/rules/no-multi-comp.js
Rule config parsed.
Saved file to crates/oxc_linter/src/rules/react/no_multi_comp.rs
Formatted rule file
Updated crates/oxc_linter/src/rules.rs
Generating RuleRunner impl...

Copilot AI review requested due to automatic review settings January 16, 2026 03:28
@github-actions github-actions bot added the C-enhancement Category - New feature or request label Jan 16, 2026
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 adds validation to the rulegen tool to prevent contributors from attempting to generate rules that are unsupported (either deprecated, not possible to implement, or already covered by other rules). The implementation reads from tasks/lint_rules/src/unsupported-rules.json to check if a requested rule is on the unsupported list and exits with an informative error message if so.

Changes:

  • Added find_unsupported_rule function to check if a rule name exists in the unsupported rules JSON file
  • Integrated the validation check into the main rulegen flow to exit early with an error message when an unsupported rule is requested
  • Added serde_json dependency for JSON parsing

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 11 comments.

File Description
tasks/rulegen/src/main.rs Added unsupported rule validation logic, imports, and test
tasks/rulegen/Cargo.toml Added serde_json dependency
Cargo.lock Updated with serde_json dependency for rulegen

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 16, 2026

Merging this PR will not alter performance

✅ 42 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing error-on-unsupported-rulegen (6f8f1b6) with main (7a0ca99)2

Open in CodSpeed

Footnotes

  1. 3 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 (5346fc9) during the generation of this report, so 7a0ca99 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linter/rulegen: Have the rulegen tool check the unsupported-rules before generating a rule

2 participants