-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
outdatedscope: angularIssues related to Angular support in NxIssues related to Angular support in Nxtype: bug
Description
Current Behavior
When generating a buildable Angular library, lint for the new library fails right away with the following error:
9:5 error The "tslib" package is not used by "my-lib" project @nx/dependency-checks
Expected Behavior
Newly generated Angular libraries (buildable or not) should not fail lint.
GitHub Repo
https://github.com/abaran30/nx-angular
Steps to Reproduce
- Clone the above repo;
gh repo clone abaran30/nx-angular
npm ci
- Generate a new buildable Angular library:
npx nx generate @nx/angular:library --name=my-lib --buildable=true --projectNameAndRootFormat=derived --standalone=false --style=none --no-interactive
- Run
npx nx run my-lib:lint
Nx Report
NX Report complete - copy this into the issue template
Node : 20.11.0
OS : darwin-arm64
npm : 10.2.4
nx : 19.0.4
@nx/js : 19.0.4
@nx/jest : 19.0.4
@nx/linter : 19.0.4
@nx/eslint : 19.0.4
@nx/workspace : 19.0.4
@nx/angular : 19.0.4
@nx/devkit : 19.0.4
@nx/eslint-plugin : 19.0.4
@nx/playwright : 19.0.4
@nrwl/tao : 19.0.4
@nx/web : 19.0.4
@nx/webpack : 19.0.4
typescript : 5.4.5
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/eslint/plugin
Failure Logs
9:5 error The "tslib" package is not used by "my-lib" project @nx/dependency-checks
✖ 1 problem (1 error, 0 warnings)
1 error and 0 warnings potentially fixable with the `--fix` option.
Lint errors found in the listed files.
Package Manager Version
No response
Operating System
- macOSLinuxWindowsOther (Please specify)To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Additional Information
As shown in the failure logs, the lint error is fixable with the --fix
option. The fixer removes tslib
from the the library's package.json dependencies
. Should tslib
not be included upon generation?
Metadata
Metadata
Assignees
Labels
outdatedscope: angularIssues related to Angular support in NxIssues related to Angular support in Nxtype: bug
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
andy-bond commentedon Jan 5, 2024
Similarly I get an error during lint if I don't utilize
@angular/core
in a utility library.My organization uses these Angular libraries to hold utilities - some of which might just be plain TypeScript functions & could contain shared Angular Pipes for instance.
Is the expected behavior here to remove
@angular/core
from the library'spackage.json
until an Angular class is used?That seems kinda annoying to do if I wanted to add an Angular Pipe to a utility library that previously only contained a TypeScript helper function.
alexanderPastornicky commentedon Jan 31, 2024
same behavior with latest nx
angular monorepo project with generated publishable library
9:5 error The "tslib" package is not used by "mylibpublishable" project @nx/dependency-checks
ci: make dependency checks warn
Coly010 commentedon May 15, 2024
Hey! It looks your GH Repo is 404ing. Could you provide me with another repo so that I can investigate further?
abaran30 commentedon May 15, 2024
@Coly010 my apologies; did a repo cleanup and forgot I had one linked to this issue 😅.
I updated the issue description with a new repo; updated to latest Nx and issue is still reproducible.
fix(angular): libraries should not contain tslib by default #21023
fix(angular): libraries should not contain tslib by default #21023 (#…
fix(angular): libraries should not contain tslib by default #21023 (#…
3 remaining items