Skip to content

packages-imported-by-name

Field Value
Tool Dependency Cruiser
Enable via layout({ scope })
Severity error
Kind dependency rule
Source packages/rules/src/dependency-cruiser.cjs
Docs packages/rules/docs/dependency-cruiser.md

Local imports of packages by path instead of name.

{
"name": "packages-imported-by-name",
"severity": "error",
"from": {
"path": "^((?:apps|packages)/[^/]+)/"
},
"to": {
"path": "^packages/",
"pathNot": "^$1/",
"dependencyTypes": [
"local"
]
}
}

This rule is one of several in the Dependency Cruiser preset. The Dependency Cruiser page carries the full preset docs from packages/rules/docs/dependency-cruiser.md.

All rules · Dependency Cruiser rules