Plugin for checking imports path in FSD project.
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-fsd-import:
npm install eslint-plugin-fsd-import --save-devAdd fsd-import to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"fsd-import"
]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"fsd-import/fsd-relative-path": "error",
"fsd-import/public-api-imports": "error",
"fsd-import/layer-imports": "error",
}
}Check FSD imports is correct:
- fsd-relative-path Imports within one slice should be relative.
- public-api-imports Absolute imports should be only from public API.
- layer-imports Modules on one layer can only interact with modules from the layers strictly below.