no-ignored-dependencies
Prevent importing ignored files from files matching any element or file descriptor.
This rule was previously named boundaries/no-ignored. The old name still works but is deprecated: using it prints a one-time warning and it will be removed in a future major version. Update your configuration to boundaries/no-ignored-dependencies.
Rule Details
This rule validates dependencies to local files. If the imported file is marked as ignored in the plugin settings, the dependency is reported as an error.
The rule analyzes any source file that the plugin recognizes: a file that belongs to a known element or that matches a known file descriptor. It does not analyze files that are both element-unknown and file-unknown, or files that are ignored.
This rule is disabled in the recommended preset and enabled in the strict preset. Enable it when you want to prevent recognized files from depending on files that are intentionally excluded from analysis.
Options
"boundaries/no-ignored-dependencies": [<severity>]
This rule has no options. The only value is the ESLint severity: 0 = off, 1 = warning, 2 = error.
Configuration Example
{
rules: {
"boundaries/no-ignored-dependencies": [2]
}
}
Settings
The following examples use this project structure and settings configuration.
Project structure:
src/
├── helpers/
│ ├── data/
│ │ ├── sort.js
│ │ └── parse.js
│ └── permissions/
│ └── roles.js
├── foo.js
└── index.js
Settings configuration:
{
settings: {
"boundaries/include": ["src/**/*.js"],
"boundaries/ignore": ["src/foo.js"],
"boundaries/elements": [
{
type: "helper",
pattern: "helpers/*",
capture: ["family"]
}
]
}
}
Examples
Incorrect
Helpers importing the ignored foo.js file:
// src/helpers/data/sort.js
import foo from "../../foo"
Correct
A recognized file importing a non-ignored local file:
// src/helpers/data/sort.js
import { parse } from "./parse"
Unrecognized files (matched by no element or file descriptor) importing ignored files. The rule does not analyze src/index.js, so this dependency is not reported:
// src/index.js
import foo from "./foo"
Error Messages
Default error message:
Dependencies to ignored files are not allowed
Further Reading
Read next sections to learn more about related topics:
- Defining Elements - Learn how to define architectural elements in your project
- Selectors - Learn about element, file, and module selectors used in rules
- Policies - Learn how to configure rule options and custom messages
- Global Settings - Learn about global settings including ignore patterns