ESLint rules for Feature-Sliced Design.
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install @eryshev/eslint-plugin-fsd
:
npm install @eryshev/eslint-plugin-fsd --save-dev
Add @eryshev/eslint-plugin-fsd
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": ["@eryshev/fsd"]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"@eryshev/fsd/path-checker": "error",
"@eryshev/fsd/public-api-imports": "error"
}
}
Use alias paths.
{
"rules": {
"@eryshev/fsd/path-checker": ["error", { "alias": "@" }],
"@eryshev/fsd/public-api-imports": ["error", { "alias": "@" }]
}
}
Use test files pattern for path-checker.
{
"rules": {
"@eryshev/fsd/path-checker": ["error", { "testFilesPatterns": ["**/*.test.*", "**/*.stories.*"] }]
}
}
Use ignore import pattern for layer-imports.
{
"rules": {
"@eryshev/fsd/layer-imports": ["error", { "ignoreImportPatterns": ["**/StoreProvider"] }]
}
}