eslint-plugin-correct-imports
v1.3.1
Published
ESLint rules for enforcing the correct import of local files
Downloads
5
Readme
eslint-plugin-correct-imports
Eslint rules for correct imports in javascript files
Installation
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-correct-imports
:
$ npm install eslint-plugin-correct-imports --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-correct-imports
globally.
Usage
Add correct-imports
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["correct-imports"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"correct-imports/rule-name": "error"
}
}
You can also use the recommended config instead
{
"extends": ["plugin:correct-imports/recommended"]
}
Supported Rules
- correct-imports/no-relative-path: Enforce using import statements as string literal with absolute path
- correct-imports/group-import: Enforce grouping similar import statements together
- correct-imports/valid-order: Enforce consistent order of import statements
- correct-imports/import-name-comment: Enforce comment on top of import group