Can't update to v18.1.0. `@angular-eslint/schematics` not being detected?
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
@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 👍
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
from what i understand, this line https://github.com/angular-eslint/angular-eslint/blob/fc31fef214a1ef3151ff541a451597ccd2176a67/packages/schematics/src/ng-add/index.ts#L100 removes it from the package.json as soon as you run any update (using flat config), or am i miss-reading it?
@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.
@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 😄
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'
@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
@JamesHenry
@jefbarn That is not the same thing, we have e2e tests that cover this and
ng lintworks 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).
@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