Skip to content

ZavNatalia/eslint-plugin-import-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Import checker plugin

Plugin checks absolute and relative paths in the project

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-import-checker-plugin:

npm install eslint-plugin-import-checker-plugin --save-dev

Usage

Add import-checker-plugin to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "import-checker-plugin"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "import-checker-plugin/rule-name": ["error", { "alias": "@" }],
        "import-checker-plugin/public-api-imports": [
          "error", 
          {
            "alias": "@",
            "testFilesPatterns": [",**/*.test.ts", ",**/*.story.*", ",**/StoreDecorator.tsx"]
          }
        ],
        "import-checker-plugin/layer-imports": [
          "error",
          {
            "alias": "@",
            "ignoreImportPatterns": ["**/StoreProvider"]
          }
        ]
    }
}

Rules

Name Description
path-checker Within a single slice, all paths must be relative
public-api-imports Absolute import is only allowed from Public API (index.ts)
layer-imports A layer can only import underlying layers into itself

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published