-
-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(eslint-plugin): enhance prefix-selectors-with-select to handle destructuring #4926
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
✅ Deploy Preview for ngrx-io canceled.Built without sensitive environment variables
|
✅ Deploy Preview for ngrx-site-v19 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
modules/eslint-plugin/spec/rules/store/prefix-selectors-with-select.spec.ts
Show resolved
Hide resolved
@timdeschryver I updated logic and added the missing cases back. All tests pass, but there still might be subtle issues. |
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 enhances the prefix-selectors-with-select
ESLint rule to handle destructuring assignments when selectors are destructured from objects, particularly when using getSelectors()
calls. The rule now validates selector names in destructuring patterns and provides appropriate suggestions.
Key Changes:
- Added support for destructuring pattern validation in object destructuring assignments
- Refactored rule logic to handle multiple selector creation scenarios including arrow functions and function expressions
- Enhanced the
getSuggestedName
function with better edge case handling and type safety
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
modules/eslint-plugin/src/rules/store/prefix-selectors-with-select.ts | Core rule implementation enhanced to detect and validate destructured selector names from getSelectors() calls |
modules/eslint-plugin/spec/rules/store/prefix-selectors-with-select.spec.ts | Added comprehensive test cases for valid and invalid destructuring patterns |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #4845
What is the new behavior?
ESLint will now complain when destructuring is used with incorrect names. The rule will likely not work with nested destructuring or other advanced / edge cases.
Does this PR introduce a breaking change?
Other information