-
-
Notifications
You must be signed in to change notification settings - Fork 721
fix(linter): Error on unexpected tokens when declaring lint rule #14881
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
fix(linter): Error on unexpected tokens when declaring lint rule #14881
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
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 fixes a bug in the declare_oxc_lint! macro where missing commas between parameters would silently fail, causing incorrect documentation generation. The fix adds validation to error when unexpected tokens remain after parsing all expected parameters.
- Added error checking for remaining tokens after parsing lint rule metadata
- Fixed existing lint rule declarations that had missing or duplicate commas
- Improved error message to guide users toward the likely issue (missing comma)
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_macros/src/declare_oxc_lint.rs | Added validation to detect and error on unexpected tokens with helpful error message |
| crates/oxc_linter/src/rules/react/forward_ref_uses_ref.rs | Removed duplicate "suggestion" parameter |
| crates/oxc_linter/src/rules/oxc/bad_bitwise_operator.rs | Added missing comma after "restriction" parameter |
| crates/oxc_linter/src/rules/eslint/max_depth.rs | Added missing comma after "pedantic" parameter |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
cc @connorshea |
camc314
left a comment
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.
Thank you!
CodSpeed Performance ReportMerging #14881 will not alter performanceComparing Summary
Footnotes
|
Related to this issue where missing commas in
declare_oxc_lint!would cause documentation to be generated wrongly without erroring.In the image below, there is no warning about the missing comma after
dangerou_suggestion, this causesconfigto not be generated in the documentation.With the fix, users will be notified about the missing comma.