ngrx / platform

Reactive State for Angular
https://ngrx.io
Other
8.01k stars 1.97k forks source link

[18.0.0-rc.0] Failed to load config "plugin:@ngrx/recommended-requiring-type-checking" #4381

Closed Julien-Marcou closed 3 months ago

Julien-Marcou commented 3 months ago

Which @ngrx/* package(s) are the source of the bug?

eslint-plugin

Minimal reproduction of the bug/regression with instructions

I was using ngrx version 18.0.0-beta.1 and everything was working fine, but then I updated to the first release candidate and I got the following errors:

Failed to process project graph. Run "nx reset" to fix this. Please report the issue if you keep seeing it.
  AggregateCreateNodesError: An error occurred while processing files for the @nx/eslint/plugin plugin.
    - apps/my-project/.eslintrc.json: Failed to load config "plugin:@ngrx/recommended-requiring-type-checking" to extend from.
  Referenced from: /Users/julien.marcou/dev/my-repo/.eslintrc.angular.json

Expected behavior

NgRx ESLint should work as it was in the beta 1

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

NgRx: 18.0.0-rc.0 Angular: 18.0.2 Nx: 19.2.2

Other information

I'm using Nx to manage multiple projects in a monorepo, hence the specific log from Nx, but I do believe that the problem comes from NgRx

Here is my .eslint.angular.json file:

{
  "extends": [".eslintrc.json"],
  "ignorePatterns": ["!**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "createDefaultProgram": true
      },
      "extends": [
        "plugin:@nx/angular",
        "plugin:@angular-eslint/template/process-inline-templates",
        "plugin:rxjs/recommended",
        "plugin:@ngrx/recommended-requiring-type-checking"
      ],
      "rules": {
        // ...
      }
    },
    {
      "files": ["*.html"],
      "extends": ["plugin:@nx/angular-template", "plugin:prettier/recommended"],
      "rules": {
        // ...
      }
    }
  ]
}

Removing "plugin:@ngrx/recommended-requiring-type-checking" from the extends fixes the issue, but then I will no longer benefit from NgRx's recommended linting

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

brandonroberts commented 3 months ago

Check the updated rules https://next.ngrx.io/guide/eslint-plugin#configurations

timdeschryver commented 3 months ago

Woops, I think I broke the configurations as these aren't displayed anymore (I'll take a look at it)

image

The new configurations are:

Julien-Marcou commented 3 months ago

Does that mean that the @ngrx/recommended-requiring-type-checking has been removed?

I haven't seen any mention about it in the breaking changes

timdeschryver commented 3 months ago

Does that mean that the @ngrx/recommended-requiring-type-checking has been removed?

I haven't seen any mention about it in the breaking changes

Yes, it has been removed. See https://next.ngrx.io/guide/migration/v18 for more information.

Julien-Marcou commented 3 months ago

Yes, it has been removed. See https://next.ngrx.io/guide/migration/v18 for more information.

Ah, I had seen it but I didn't understand it at first, thanks for the clarification.

The documentation is still referring to this old configuration here:

Screenshot 2024-06-10 at 18 27 40

It should probably be removed here too to avoid confusion 😅

timdeschryver commented 3 months ago

Yea, you're correct. I plan to revamp/update it in https://github.com/ngrx/platform/issues/4375 before v18 is released.

Julien-Marcou commented 3 months ago

Sorry to bother you again, but I have another problem, if I now extend from plugin:@ngrx/all, I have the following errors:

  1:1  error  Definition for rule '@ngrx/signal-state-no-arrays-at-root-level' was not found  @ngrx/signal-state-no-arrays-at-root-level
  1:1  error  Definition for rule '@ngrx/with-state-no-arrays-at-root-level' was not found    @ngrx/with-state-no-arrays-at-root-level

If I turn these rules off, it's working again, am I missing something?

timdeschryver commented 3 months ago

I'll look into it, thanks @Julien-Marcou !