Plugin for Feature-Sliced Design(it was developed for Windows and may not work on Mac)
- Checks that the paths inside the component are relative. Also supports checking with aliases.
- Prohibits importing from non-public api
- Prohibits import from overlying layers
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-lucky-fsd
:
npm install eslint-plugin-lucky-fsd --save-dev
Add lucky-fsd
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"lucky-fsd"
]
}
Then configure the rules you want to use under the rules section.
'lucky-fsd/path-checker' - checks that the paths inside the component are relative. Also supports checking with aliases. 'lucky-fsd/public-api-imports' - prohibits importing from non-public api 'lucky-fsd/layer-imports' - prohibits import from overlying layers
{
rules: {
'lucky-fsd/path-checker': ['error', { alias: '@' }],
'lucky-fsd/public-api-imports': [
'error',
{
alias: '@',
testFilesPatterns: ['**/*.test.*', '**/*.stories.*', '**/StoreDecorator.tsx'],
}
],
'lucky-fsd/layer-imports': [
'error',
{
alias: '@',
ignoreImportPatterns: [ '**/StoreProvider' ],
}
]
},
}