-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
outdatedscope: corecore nx functionalitycore nx functionalityscope: linterIssues related to Eslint support in NxIssues related to Eslint support in Nxtype: bug
Description
Current Behavior
When you import a file that is not part of a project by the relative path that goes outside of the current project root, the eslint rule @nx/enforce-module-boundaries is not throwing an error. When you do the same relative import for a file that belongs to a project it shows the error as expected.
Expected Behavior
We want to prevent any relative import outside the project root, it doesn't matter if the relative import is a project file or a non-project file. Currently the linting works for project files but not for non-project files which can cause unexpected behavior
GitHub Repo
Steps to Reproduce
I created a reproduce-able scenario for this issue in nx-examples:
- I created 2 components, one as a project and the other one as a non-project
a. non-project:libs/shared/product/components/non-project/index.ts
b. project:libs/shared/product/components/project/project.json - I added imports to both components in the product-home-page
libs/products/home-page/src/lib/products-home-page.module.ts - When you use relative imports, the project will show an eslint error, but the non-project import is ok.
a. When you change the project component import to the npm scoped import this import is also ok.
- When I analyse the file-deps.json I see that the non-project import is a npm dependency with the relative path to the file. But because it is marked as npm: the linting rule will not complain.
Nx Report
Node : 20.9.0
OS : darwin-arm64
yarn : 1.22.19
nx : 17.1.3
@nx/js : 17.1.3
@nx/jest : 17.1.3
@nx/linter : 17.1.3
@nx/eslint : 17.1.3
@nx/workspace : 17.1.3
@nx/angular : 17.1.3
@nx/cypress : 17.1.3
@nx/devkit : 17.1.3
@nx/eslint-plugin : 17.1.3
@nx/react : 17.1.3
@nrwl/tao : 17.1.3
@nx/web : 17.1.3
@nx/webpack : 17.1.3
typescript : 5.2.2
---------------------------------------
Community plugins:
@ngrx/component-store : 16.0.0
@ngrx/effects : 16.0.0
@ngrx/entity : 16.0.0
@ngrx/router-store : 16.0.0
@ngrx/store : 16.0.0
@ngrx/store-devtools : 16.0.0Failure Logs
No response
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
henk-badenhorst
Metadata
Metadata
Assignees
Labels
outdatedscope: corecore nx functionalitycore nx functionalityscope: linterIssues related to Eslint support in NxIssues related to Eslint support in Nxtype: bug

