I have created a Nx Standalone Angular project and then created a local library, as described in the official documentation.
I am trying to add a lint rule to enforce module boundaries. I am using the following configuration:
"@nx/enforce-module-boundaries": [
"error",
{
// "allow": ["@angular/**"],
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "scope:main",
"onlyDependOnLibsWithTags": [
"scope:main",
"scope:my-components"
]
}
]
}
]
where scope:main
is the tag in the application and scope:my-components
is the tag I am using in the local library. The problem is that the linter complains about Angular’s imports such as @angular/core
.
The error reads:
Projects should use relative imports to import from other files within the same project. Use “./path/to/file” instead of import from “@angular/core” (eslint@nx/enforce-module-boundaries)
The only solution I found so far is to add the commented-out line "allow": ["@angular/**"]
.
But this looks like a workaround to me. Shouldn’t this work without this line?