Skip to content

Conversation

Copy link

Copilot AI commented Nov 12, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] 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?

The @ngrx/prefix-selectors-with-select rule incorrectly flags variables with custom types ending in "Selector" as NgRx selectors:

type RowSelector<T> = { row: T };
const item: RowSelector<ItemData> = { row: { id: 1 } };
// ❌ Incorrectly flagged: "Selector should start with 'select'"

The rule used regex /Selector$/ to match type names, catching any type ending in "Selector".

Closes #4447

What is the new behavior?

The rule now explicitly checks for NgRx selector types (MemoizedSelector, MemoizedSelectorWithProps, Selector, SelectorWithProps). Custom types like RowSelector<T> or CustomSelector are no longer flagged.

Changes:

  • Replace regex pattern with explicit type name array check in prefix-selectors-with-select.ts
  • Add test cases covering custom types ending in "Selector"

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

None.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.nx.app
    • Triggering command: node ./bin/post-install (dns block)
    • Triggering command: node /home/REDACTED/work/platform/platform/node_modules/.bin/../nx/bin/nx.js test eslint-plugin (dns block)
    • Triggering command: node /home/REDACTED/work/platform/platform/node_modules/.bin/../nx/bin/nx.js test eslint-plugin --testNamePattern=prefix-selectors-with-select (dns block)
  • download.cypress.io
    • Triggering command: node index.js --exec install (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>False positive in @ngrx/prefix-selectors-with-select after upgrade (flags non-selector variables)</issue_title>
<issue_description>### Which @ngrx/* package(s) are the source of the bug?

eslint-plugin

Minimal reproduction of the bug/regression with instructions

After upgrading NgRx packages (including @ngrx/eslint-plugin) to the latest version, the rule @ngrx/prefix-selectors-with-select started reporting false positives for variables that are NOT NgRx selectors.

Example (spec file):

// Not a selector – just a plain data wrapper object typed with a generic containing 'Selector'
type RowSelector<T> = { row: T };

interface ItemData {
  id: number;
  name: string;
  active: boolean;
}

// Variable is just a data container, not created via createSelector
const item: RowSelector<ItemData> = {
  row: {
    id: 1,
    name: 'Test',
    active: false,
  },
};

// Lint error:
// Selector should start with 'select'

The variable isn’t produced by createSelector / createFeatureSelector / createSignalSelector. The rule appears to treat any identifier or type whose text includes Selector as an NgRx selector.

Expected behavior

Only actual NgRx selectors (returned from NgRx selector factory functions) should be enforced.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

NgRx: 20.1.0
Angular: 20.3.7
eslint: 9.38.0

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link

netlify bot commented Nov 12, 2025

Deploy Preview for ngrx-io canceled.

Name Link
🔨 Latest commit f544304
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-io/deploys/6914c047f5b35800082a07a3

@netlify
Copy link

netlify bot commented Nov 12, 2025

Deploy Preview for ngrx-site-v19 ready!

Name Link
🔨 Latest commit f544304
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-site-v19/deploys/6914c047d0153e000704b848
😎 Deploy Preview https://deploy-preview-4995--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.

Copilot AI changed the title [WIP] Fix false positive in @ngrx/prefix-selectors-with-select rule fix(eslint-plugin): prevent false positives in prefix-selectors-with-select for custom types Nov 12, 2025
Copilot AI requested a review from timdeschryver November 12, 2025 17:18
Copilot finished work on behalf of timdeschryver November 12, 2025 17:18
@timdeschryver timdeschryver marked this pull request as ready for review November 14, 2025 18:34
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.

False positive in @ngrx/prefix-selectors-with-select after upgrade (flags non-selector variables)

2 participants