Skip to main content

no-ignored

Prevent importing ignored files from recognized elements.

Rule Details

This rule validates import statements (or any other dependency-creating syntax) to local files. If the imported file is marked as ignored in the plugin settings, the import will be reported as an error when importing from files recognized as elements.

info

This rule prevents recognized elements from depending on files that have been explicitly excluded from the architectural boundaries.

Options

"boundaries/no-ignored": [<enabled>]

Configuration properties:

  • enabled: Enables the rule. 0 = off, 1 = warning, 2 = error

Configuration Example

{
"rules": {
"boundaries/no-ignored": [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": "helpers",
"pattern": "helpers/*/*.js",
"mode": "file",
"capture": ["category", "elementName"]
}
]
}
}

Examples

Incorrect

Helpers importing ignored foo.js file:

// src/helpers/data/sort.js
import foo from "../../foo"

Correct

Unknown files importing ignored files:

// src/index.js
import foo from "./foo"

Further Reading

Read next sections to learn more about related topics: