eslint-plugin-check-local-import
v0.0.12
Published
The Eslint plugin for checking imports inside modules.
Downloads
8
Maintainers
Readme
eslint-plugin-check-local-import
The Eslint plugin for checking imports inside modules. Based on the FSD architecture, but can be used for any architecture.
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-check-local-import
:
npm install eslint-plugin-check-local-import --save-dev
Usage
Add check-local-import
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"check-local-import"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"check-local-import/path-checker-layers": [
"error",
{
"rootPath": "project path",
"layers": [
"array",
"of",
"monitored",
"layers"
]
}
]
}
}
Flat configuration
import checkLocalImport from 'eslint-plugin-check-local-import'
export default [
{
plugins: {
'check-local-import': checkLocalImport,
},
rules: {
'check-local-import/path-checker-layers': ['error', {rootPath: 'src', layers: ['api', 'components']}],
},
},
];
Configurations
TODO: Run eslint-doc-generator to generate the configs list (or delete this section if no configs are offered).
Rules
| Name | Description | | :------------------------------------------------------- | :--------------------------------------------------------- | | path-checker-layers | Check path layer. | | path-checker-slices | Check import into slices | | public-api-module | Verifying that the module is accessed through a public api |