Skip to content

Latest commit

 

History

History
81 lines (61 loc) · 1.64 KB

no-ignored.md

File metadata and controls

81 lines (61 loc) · 1.64 KB

boundaries/no-ignored

Prevent importing ignored files from recognized elements

Rule details

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".

Options

"boundaries/no-ignored": [<enabled>]
  • enabled: for enabling the rule. 0=off, 1=warn, 2=error.
Options example
{
  "rules": {
    "boundaries/no-ignored": [2]
  }
}

Settings

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"]
      }
    ]
  }
}

Examples of incorrect code for this rule:

foo.js file is ignored, so it can't be imported by helpers

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

Examples of correct code for this rule:

index.js file is not recognized as any known element type, so it can import foo.js

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

Further reading

Read how to configure the boundaries/elements setting to assign an element type to each project's file.