Skip to main content

no-unknown-files

Prevent creating files not recognized as any element type.

Rule Details

This rule validates local file paths. If a file is not recognized as part of any element defined in settings, it will be reported as an error.

info

This rule ensures that all files in your project belong to a defined element type, maintaining a clean architectural structure.

Options

"boundaries/no-unknown-files": [<enabled>]

Configuration properties:

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

Configuration Example

{
"rules": {
"boundaries/no-unknown-files": [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/ignore": ["src/index.js"],
"boundaries/elements": [
{
"type": "helpers",
"pattern": "helpers/*/*.js",
"mode": "file"
}
]
}
}

Examples

Incorrect

Unrecognized foo.js file:

// src/foo.js

Correct

Helper files that match element definitions:

// src/helpers/data/sort.js

Ignored files in settings:

// src/index.js

Further Reading

Read next sections to learn more about related topics: