Skip to content

Conversation

jdegand
Copy link
Contributor

@jdegand jdegand commented Aug 18, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

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?

[ ] Yes
[X] No

Other information

Copy link

netlify bot commented Aug 18, 2025

Deploy Preview for ngrx-io canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit bf83265
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-io/deploys/68acc16ebb02d70008166d44

Copy link

netlify bot commented Aug 18, 2025

Deploy Preview for ngrx-site-v19 ready!

Name Link
🔨 Latest commit bf83265
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-site-v19/deploys/68acc16ece68cc0008483cf3
😎 Deploy Preview https://deploy-preview-4926--ngrx-site-v19.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jdegand
Copy link
Contributor Author

jdegand commented Aug 21, 2025

@timdeschryver I updated logic and added the missing cases back. All tests pass, but there still might be subtle issues.

@timdeschryver timdeschryver requested a review from Copilot August 24, 2025 18:06
Copy link

@Copilot Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The rule "@ngrx/prefix-selectors-with-select" sometimes crashes ESLint when checking destructured selectors from an adaptor's getSelectors method
2 participants