Skip to content

Can't update to v18.1.0. @angular-eslint/schematics not being detected? #1906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nunoarruda opened this issue Jul 2, 2024 · 9 comments · Fixed by #2134
Closed

Can't update to v18.1.0. @angular-eslint/schematics not being detected? #1906

nunoarruda opened this issue Jul 2, 2024 · 9 comments · Fixed by #2134

Comments

@nunoarruda
Copy link

nunoarruda commented Jul 2, 2024

ng update is not detecting that there's a new angular-eslint version:

npx ng update

Using package manager: npm
Collecting installed dependencies...
Found 34 dependencies.
    We analyzed your package.json and everything seems to be in order. Good work!

If I try to update @angular-eslint/schematics directly, it also fails to detect it:

npx ng update @angular-eslint/schematics

Using package manager: npm
Collecting installed dependencies...
Found 34 dependencies.
Package '@angular-eslint/schematics' is not a dependency.

I see reference(s) of @angular-eslint/schematics on angular.json and on package-lock.json but not in package.json. Could this be related? Or, am I missing something?

Here's my ng version:

npx ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 18.0.6
Node: 20.15.0
Package Manager: npm 10.7.0
OS: darwin arm64

Angular: 18.0.5
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1800.6
@angular-devkit/build-angular   18.0.6
@angular-devkit/core            18.0.6
@angular-devkit/schematics      18.0.6
@angular/cli                    18.0.6
@schematics/angular             18.0.6
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6
@nunoarruda
Copy link
Author

@JamesHenry could you take a look at this when you have a chance? It is still an issue with v18.2.0.

Thanks in advance 👍

@JamesHenry
Copy link
Member

Yes @angular-eslint/schematics should be in your package.json, please add it and align it with other @angular-eslint packages in terms of version number

@JamesHenry JamesHenry closed this as not planned Won't fix, can't repro, duplicate, stale Aug 13, 2024
@robertado
Copy link

from what i understand, this line

delete json.devDependencies['@angular-eslint/schematics'];
removes it from the package.json as soon as you run any update (using flat config), or am i miss-reading it?

@JamesHenry JamesHenry reopened this Aug 14, 2024
@JamesHenry
Copy link
Member

JamesHenry commented Aug 14, 2024

@robertado Apologies, you are right, and as you can see in this file, this behaviour is new and specific to flat config.

The reason for this is historically all the @angular-eslint packages would be in your package.json directly, now I was trying to get it such that only angular-eslint (the new package) would be needed and it depends on the others.

I have reopened because effectively you are reporting to me that this strategy is not workable with the Angular CLI, it apparently needs that package to be a direct dev dependency of the repo in question?

I will need to test this out locally and see if it is consistent, and if so see if there is a workaround available, such as maybe exposing the schematics of @angular-eslint/schematics via the angular-eslint package (so you would run ng update angular-eslint instead.

@robertado
Copy link

@JamesHenry until now i updated the packages angular-eslint and typescript-eslint directly or via ng update angular-eslint. maybe a note in the readme is sufficient 😄

@jefbarn
Copy link

jefbarn commented Nov 5, 2024

Same problem with @angular-eslint/builder in angular.json. Need to add it as a direct dependency or get an error when running 'ng lint'

@JamesHenry
Copy link
Member

@jefbarn That is not the same thing, we have e2e tests that cover this and ng lint works just fine. Please provide much more information about your setup

@jefbarn
Copy link

jefbarn commented Nov 23, 2024

@JamesHenry

@jefbarn That is not the same thing, we have e2e tests that cover this and ng lint works just fine. Please provide much more information about your setup

Looks like it's related to pnpm usage vs npm. Pnpm has stricter usage of transitive dependencies and the ng cli tool is trying to go directly into the node_modules directory to find it (it doesn't live there with pnpm unless you add it as a project dependency).

@JamesHenry
Copy link
Member

@jefbarn Please provide a reproduction in a fresh issue, I just did:

pnpm dlx @angular/cli new --package-manager pnpm
cd the-workspace-name
pnpm ng add angular-eslint
pnpm ng lint

And everything worked fine

image

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