Prevent creating files not recognized as any of the element types
It checks local files paths. If the file is not recognized as part of any element defined in settings, it will be notified as an error.
"boundaries/no-unknown-files": [<enabled>]
enabled
: for enabling the rule. 0=off, 1=warn, 2=error.
{
"rules": {
"boundaries/no-unknown-files": [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/ignore": ["src/index.js"],
"boundaries/elements": [
{
"type": "helpers",
"pattern": "helpers/*/*.js",
"mode": "file"
}
]
}
}
foo.js
file is not recognized, so it is not allowed
// src/foo.js
Helper files are allowed
// src/helpers/data/sort.js
index.js
file is not recognized, but it is ignored in settings
// src/index.js
- Read how to configure the
boundaries/elements
setting to assign an element type to each project's file.