-
-
Notifications
You must be signed in to change notification settings - Fork 788
feat(rulegen): Error upon generating an unsupported rule with rulegen #18051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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_rulefunction 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_jsondependency 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.
Merging this PR will not alter performance
Comparing Footnotes
|
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:
And generating a valid rule like
just new-react-rule no-multi-compstill works: