platform icon indicating copy to clipboard operation
platform copied to clipboard

feat(eslint-plugin): extend NonRecord type checks in state rules

Open zenhuw opened this issue 1 month ago • 4 comments

update signal-state-no-arrays-at-root-level and with-state-no-arrays-at-root-level rules to detect all NonRecord types defined in @ngrx/signals ts-helpers.ts. The rules now check for: Set, Map, WeakSet, WeakMap, Date, Error, RegExp, ArrayBuffer, DataView, Promise, and Function types in addition to arrays

Closes #4615

PR Checklist

Please check if your PR fulfills the following requirements:

  • [x] The commit message follows our guidelines: https://github.com/ngrx/platform/blob/main/CONTRIBUTING.md#commit
  • [x] Tests for the changes have been added (for bug fixes / features)
  • [x] Documentation has been added / updated (for bug fixes / features)

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?

The signal-state-no-arrays-at-root-level and with-state-no-arrays-at-root-level ESLint rules only detect arrays at the root level of state.

Closes #4615

What is the new behavior?

The rules now detect all NonRecord types as invalid root-level state:

  • Array
  • Set, Map, WeakSet, WeakMap
  • Date, Error, RegExp
  • ArrayBuffer, DataView
  • Promise
  • Function

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

zenhuw avatar Dec 09 '25 04:12 zenhuw

Deploy Preview for ngrx-io canceled.

Name Link
Latest commit e8025a896572b7e650a22bd0fc53e106db7284ec
Latest deploy log https://app.netlify.com/projects/ngrx-io/deploys/6939c5dcc71ce400086ab548

netlify[bot] avatar Dec 09 '25 04:12 netlify[bot]

Deploy Preview for ngrx-site-v19 ready!

Name Link
Latest commit e8025a896572b7e650a22bd0fc53e106db7284ec
Latest deploy log https://app.netlify.com/projects/ngrx-site-v19/deploys/6939c5db7128280008fd01b2
Deploy Preview https://deploy-preview-5045--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.

netlify[bot] avatar Dec 09 '25 04:12 netlify[bot]

should i add the generated files generated by eslint-plugin:update ?

zenhuw avatar Dec 09 '25 04:12 zenhuw

commited your suggestions and also the docs, please take a look 😊 @timdeschryver

zenhuw avatar Dec 10 '25 09:12 zenhuw

awesome! Glad i could contribute @timdeschryver

zenhuw avatar Dec 10 '25 19:12 zenhuw