-
-
Notifications
You must be signed in to change notification settings - Fork 715
refactor(eslint/arrow-body-style): clean up implementation and improve documentation #13389
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
refactor(eslint/arrow-body-style): clean up implementation and improve documentation #13389
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 refactors the arrow-body-style ESLint rule implementation to improve code organization and enhance documentation. The changes focus on making the code more idiomatic Rust while standardizing the documentation format.
Key Changes:
- Restructured the rule implementation by extracting logic into separate methods for better maintainability
- Enhanced documentation with detailed examples for each configuration option
- Improved code organization using pattern matching and early returns
Tip: Customize your code reviews with copilot-instructions.md. Create the file or 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.
thanks!
I pushed another commit with a minor change.
In general it's preferable to have the file look like:
- diagnostic functions
- the rule struct + config
- the rule's proc macro
- the
impl Rule for - any helper methods
keeping this same order helps consistency across all rules
CodSpeed Instrumentation Performance ReportMerging #13389 will not alter performanceComparing Summary
|
Alright, I'll keep this in mind in my future rules refactors, thanks for the feedback |
…nce readability (#13516) ## Refactor and Standardize: `eslint/default-param-last` This PR refactors the implementation of the `default-param-last` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Focused on optimization and performances. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified. --------- Co-authored-by: Cameron <cameron.clark@hey.com>
…ce readability (#13515) ## Refactor and Standardize: `eslint/default-case-last` This PR refactors the implementation of the `default-case-last` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Focused on optimization and performances. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified. --------- Co-authored-by: Cameron <cameron.clark@hey.com>
…e documentation (#13417) ## Refactor and Standardize: `eslint/block-scoped-var` This PR refactors the implementation of the `block-scoped-var` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified.
…adability (#13430) ## Refactor and Standardize: `eslint/default-case` This PR refactors the implementation of the `default-case` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Focused on optimization and performances. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified.
…ocumentation (#13532) ## Refactor and Standardize: `eslint/for-direction` This PR refactors the implementation of the `for-direction` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Focused on optimization and performances. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified.
…ocumentation (#13532) ## Refactor and Standardize: `eslint/for-direction` This PR refactors the implementation of the `for-direction` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Focused on optimization and performances. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified.
…mentation (#13601) ## Refactor and Standardize: `eslint/func-names` This PR refactors the implementation of the `func-names` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Focused on optimization and performances. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified. --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
…ation (#13527) ## Refactor and Standardize: `eslint/eqeqeq` This PR refactors the implementation of the `eqeqeq` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Standardized rule documentation for consistency across the linter rules. > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified.
…13498) ## Refactor and Standardize: `eslint/curly` This PR refactors the implementation of the `curly` rule to make the codebase more **idiomatic Rust**, improving readability, maintainability, and alignment with Rust best practices. In addition, the rule documentation has been **standardized and enhanced** following the documentation skeleton described in #13389. ### Changes included * Refactored rule logic with clearer naming, early returns, and idiomatic Rust patterns (`if let`, `Option`, `Iterator`, etc.). * Improved structure for better readability and maintainability. * Focused on optimization and performances. * Standardized rule documentation for consistency across the linter rules. --- > [!NOTE] > This PR is focused solely on refactoring and documentation; no test behavior is modified. --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
This is my first contribution to Oxc, aimed at improving code maintainability and standardizing documentation across rules.
This PR serves as a draft proposal for how I can contribute to rules, focusing on both code and documentation. Comments and suggestions are very welcome to refine the style in a way that satisfies everyone.
Note
This PR is focused solely on refactoring and documentation; no test behavior is modified.
🔩 Refactoring
Goals when refactoring rules:
?,match,if let,Option/Result,Iterator, etc. naturally).&/Cow/From/Intowhere appropriate).📚 Documentation
Main changes in the documentation:
Next steps (if accepted):
📖 Rule documentation skeleton