Skip to content

Commit e110588

Browse files
authored
feat: add support for NgRx 18 (#23)
* feat: add support for NgRx 18 * fix: apply requested changes * refactor: revert rules removal
1 parent 072ec01 commit e110588

File tree

5 files changed

+41
-20
lines changed

5 files changed

+41
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ All peer dependencies used by `@code-pushup/eslint-config` are listed below, alo
8484
| ![angular_component](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/angular_component.png) | [@angular-eslint/eslint-plugin-template](https://www.npmjs.com/package/@angular-eslint/eslint-plugin-template) | `^17.0.0 \|\| ^18.0.0` | |
8585
| ![angular_component](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/angular_component.png) | [@angular-eslint/template-parser](https://www.npmjs.com/package/@angular-eslint/template-parser) | `^17.0.0 \|\| ^18.0.0` | |
8686
| ![graphql](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/graphql.png) | [@graphql-eslint/eslint-plugin](https://www.npmjs.com/package/@graphql-eslint/eslint-plugin) | `^3.0.0` | |
87-
| ![ngrx](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/other/ngrx.png) | [@ngrx/eslint-plugin](https://www.npmjs.com/package/@ngrx/eslint-plugin) | `^17.0.0` | |
87+
| ![ngrx](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/other/ngrx.png) | [@ngrx/eslint-plugin](https://www.npmjs.com/package/@ngrx/eslint-plugin) | `^17.0.0 \|\| ^18.0.0` | |
8888
| ![cypress](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/cypress.png) | [eslint-plugin-cypress](https://www.npmjs.com/package/eslint-plugin-cypress) | `^2.0.0` | |
8989
| ![expired](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/icons8/expired.png) | [eslint-plugin-deprecation](https://www.npmjs.com/package/eslint-plugin-deprecation) | `^2.0.0 \|\| ^3.0.0` | |
9090
| ![jest](https://raw.githubusercontent.com/code-pushup/eslint-config/main/docs/icons/material/jest.png) | [eslint-plugin-jest](https://www.npmjs.com/package/eslint-plugin-jest) | `^27.0.0 \|\| ^28.0.0` | |

angular-ngrx.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,43 @@ module.exports = {
66
{
77
files: TYPESCRIPT_FILE_PATTERNS,
88

9-
extends: [
10-
'@code-pushup/eslint-config/angular',
11-
'plugin:@ngrx/recommended-requiring-type-checking',
12-
],
9+
plugins: ['@ngrx'],
10+
extends: ['@code-pushup/eslint-config/angular'],
1311

1412
rules: {
1513
// CUSTOMIZED RULES FROM EXTENDED CONFIGS
1614

15+
// ADDITIONAL RULES
16+
17+
// https://github.com/ngrx/platform/tree/main/modules/eslint-plugin
18+
'@ngrx/avoid-combining-component-store-selectors': 'warn',
1719
'@ngrx/avoid-cyclic-effects': 'error',
1820
'@ngrx/avoid-duplicate-actions-in-reducer': 'error',
19-
'@ngrx/no-multiple-actions-in-effects': 'off',
20-
'@ngrx/prefer-effect-callback-in-block-statement': 'off',
21+
'@ngrx/avoid-mapping-component-store-selectors': 'warn',
22+
'@ngrx/updater-explicit-return-type': 'warn',
23+
'@ngrx/no-dispatch-in-effects': 'warn',
24+
'@ngrx/no-effects-in-providers': 'error',
25+
'@ngrx/prefer-action-creator-in-of-type': 'warn',
26+
'@ngrx/prefer-concat-latest-from': 'warn',
27+
'@ngrx/use-effects-lifecycle-interface': 'warn',
28+
'@ngrx/avoid-combining-selectors': 'warn',
29+
'@ngrx/avoid-dispatching-multiple-actions-sequentially': 'warn',
30+
'@ngrx/avoid-mapping-selectors': 'warn',
31+
'@ngrx/good-action-hygiene': 'warn',
32+
'@ngrx/no-multiple-global-stores': 'warn',
33+
'@ngrx/no-reducer-in-key-names': 'warn',
34+
'@ngrx/no-store-subscription': 'warn',
35+
'@ngrx/no-typed-global-store': 'warn',
36+
'@ngrx/on-function-explicit-return-type': 'warn',
37+
'@ngrx/prefer-action-creator-in-dispatch': 'warn',
38+
'@ngrx/prefer-action-creator': 'warn',
39+
'@ngrx/prefer-inline-action-props': 'warn',
40+
'@ngrx/prefer-one-generic-in-create-for-feature-selector': 'warn',
41+
'@ngrx/prefer-selector-in-select': 'warn',
42+
'@ngrx/prefix-selectors-with-select': 'warn',
43+
'@ngrx/select-style': 'warn',
2144
'@ngrx/use-consistent-global-store-name': ['warn', 'store$'],
2245

23-
// ADDITIONAL RULES
24-
2546
// https://github.com/cartant/eslint-plugin-rxjs#rules
2647
'rxjs/no-unsafe-catch': 'error',
2748
'rxjs/no-unsafe-first': 'error',

docs/angular-ngrx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Config for **Angular** projects using **NgRx** library.
8787
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [prefer-inline-action-props](https://ngrx.io/guide/eslint-plugin/rules/prefer-inline-action-props)<br />Prefer using inline types instead of interfaces, types or classes. | | 💡 | |
8888
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [prefer-one-generic-in-create-for-feature-selector](https://ngrx.io/guide/eslint-plugin/rules/prefer-one-generic-in-create-for-feature-selector)<br />Prefer using a single generic to define the feature state. | | 💡 | |
8989
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [prefer-selector-in-select](https://ngrx.io/guide/eslint-plugin/rules/prefer-selector-in-select)<br />Using a selector in the `select` is preferred over `string` or `props drilling`. | | | |
90-
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [prefix-selectors-with-select](https://ngrx.io/guide/eslint-plugin/rules/prefix-selectors-with-select)<br />The selector should start with "select", for example "selectThing". | | 💡 | |
90+
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [prefix-selectors-with-select](https://ngrx.io/guide/eslint-plugin/rules/prefix-selectors-with-select)<br />The selector should start with "select", for example "selectEntity". | | 💡 | |
9191
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [select-style](https://ngrx.io/guide/eslint-plugin/rules/select-style)<br />Selector can be used either with `select` as a pipeable operator or as a method. | | 🔧 | |
9292
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [updater-explicit-return-type](https://ngrx.io/guide/eslint-plugin/rules/updater-explicit-return-type)<br />`Updater` should have an explicit return type. | | | |
9393
| [![@ngrx](./icons/other/ngrx.png)](https://ngrx.io/guide/eslint-plugin) | [use-consistent-global-store-name](https://ngrx.io/guide/eslint-plugin/rules/use-consistent-global-store-name)<br />Use a consistent name for the global store. | <details><summary>store$</summary><pre lang="json"><code>"store$"</code></pre></details> | 💡 | |

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@angular-eslint/eslint-plugin-template": "^17.0.0 || ^18.0.0",
3434
"@angular-eslint/template-parser": "^17.0.0 || ^18.0.0",
3535
"@graphql-eslint/eslint-plugin": "^3.0.0",
36-
"@ngrx/eslint-plugin": "^17.0.0",
36+
"@ngrx/eslint-plugin": "^17.0.0 || ^18.0.0",
3737
"@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0",
3838
"@typescript-eslint/parser": "^6.0.0 || ^7.0.0",
3939
"eslint": "^8.0.0",
@@ -101,7 +101,7 @@
101101
"@angular-eslint/eslint-plugin-template": "^18.0.1",
102102
"@angular-eslint/template-parser": "^18.0.1",
103103
"@graphql-eslint/eslint-plugin": "^3.20.1",
104-
"@ngrx/eslint-plugin": "^17.2.0",
104+
"@ngrx/eslint-plugin": "^18.1.0",
105105
"@typescript-eslint/eslint-plugin": "^7.13.1",
106106
"@typescript-eslint/parser": "^7.13.1",
107107
"build-md": "^0.4.1",

0 commit comments

Comments
 (0)