eslint-plugin-fsd-projects
v0.1.8
Published
Feature-Sliced Design architectural methodology for frontend projects
Downloads
15
Maintainers
Readme
eslint-plugin-fsd-projects
Use power ESLint for Feature-Sliced Design architectural methodology for frontend projects
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-fsd-projects
:
npm install eslint-plugin-fsd-projects --save-dev
Usage
Add fsd-projects
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"fsd-projects"
]
}
Then configure the rules you want to use under the rules section.
{
rules: {
"fsd-projects/path-checker": ["error", { param: "" }]
}
}
Supported Rules
FSD / path-checker
Feature-Sliced Design architectural methodology for relative path checker, using an alias. Specify the alias you are using. The key accepts any string value. Rule supports autofix.
{
rules: {
"fsd-projects/path-checker": ["error", { alias: "@" }]
}
}
FSD / public-api-imports
Import control from external modules only through public api. Rule supports autofix.
testFilesPatterns
The key takes an array of strings as its value. Allows you to specify aliases for test environments excluded from the rule
{
rules: {
'fsd-projects/public-api-imports': [
'error',
{
alias: '@',
testFilesPatterns: ['**/*.test.*', '**/*.story.*', '**/StoreDecorator.tsx'],
},
]
}
}
FSD / layer-imports
Prohibition of the use of overlying layers in the underlying
testFilesPatterns
The key takes an array of strings as its value. Allows you to specify aliases for test environments excluded from the rule
{
rules: {
'fsd-projects/layer-imports': [
'error',
{
alias: '@',
ignoreImportPatterns: ['**/StoreProvider', '**/testing'],
},
],
}
}