-
-
Notifications
You must be signed in to change notification settings - Fork 737
docs(linter): Updated eslint/yoda rule with auto-gen config options, I have.
#16562
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: handle-tuple-rules-better
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #16562 will not alter performanceComparing Summary
Footnotes
|
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 modernizes the eslint/yoda rule to use DefaultRuleConfig for configuration handling and enables automatic schema generation. The rule configuration now uses a tuple struct pattern Yoda(AllowYoda, YodaOptions) to match ESLint's configuration format where the first parameter is a string mode ("never" or "always") and the second is an optional options object with exceptRange and onlyEquality properties.
Key Changes:
- Replaced manual configuration parsing with
DefaultRuleConfigwrapper for cleaner deserialization - Restructured configuration types to support automatic schema generation and documentation
- Removed the rule from the schema exclusion list in test configuration
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crates/oxc_linter/src/rules/eslint/yoda.rs |
Refactored configuration handling: introduced AllowYoda enum and YodaOptions struct with proper serde/schema derives, updated from_configuration() to use DefaultRuleConfig, and adjusted run() method to destructure the tuple struct |
crates/oxc_linter/tests/rule_configuration_documentation_test.rs |
Removed eslint/yoda from the exclusion list since it now has proper schema support for auto-generated documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
lol, great PR title and description
ca59885 to
962bfe2
Compare
…rule, I have. Uses DefaultRuleConfig now, this rule does. Updated it to use a proper tuple config, I have. Continue to pass, the tests do.
Uses DefaultRuleConfig now, this rule does. Updated to use a proper tuple config, it has been.
Continue to pass, the tests do.
Part of #14743 and dependent on #16555, this PR is.
Generated docs: