Prevent importing ignored files from recognized elements
It checks import
statements to local files. If the imported file is marked as ignored in the plugin settings, the import
will be notified as an error in files recognized as "elements".
"boundaries/no-ignored": [<enabled>]
enabled
: for enabling the rule. 0=off, 1=warn, 2=error.
{
"rules": {
"boundaries/no-ignored": [2]
}
}
Examples in the next sections are based on the previous options example and these files and settings.
src/
├── helpers/
│ ├── data/
│ │ ├── sort.js
│ │ └── parse.js
│ └── permissions/
│ └── roles.js
│
├── foo.js
└── index.js
{
"settings": {
"boundaries/include": ["src/**/*.js"],
"boundaries/ignore": ["src/foo.js"],
"boundaries/elements": [
{
"type": "helpers",
"pattern": "helpers/*/*.js",
"mode": "file",
"capture": ["category", "elementName"]
}
]
}
}
foo.js
file is ignored, so it can't be imported by helpers
// src/helpers/data/sort.js
import foo from "../../foo"
index.js
file is not recognized as any known element type, so it can import foo.js
// src/index.js
import foo from "./foo"
Read how to configure the boundaries/elements
setting to assign an element type to each project's file.