WIP:At the moment at beta-testing - use carefully
Linting of FeatureSliced concepts by existing eslint-plugins
- Control Isolation
- Control Decomposition
- Control Public API
- Control Layers & Scopes
- Control Naming
-
You'll first need to install ESLint:
$ npm install -D eslint # or by yarn $ yarn add -D eslint -
Next, install
@feature-sliced/eslint-configand dependencies:$ npm install -D @feature-sliced/eslint-config eslint-plugin-import eslint-plugin-boundaries # or by yarn $ yarn add -D @feature-sliced/eslint-config eslint-plugin-import eslint-plugin-boundaries -
Add config to the
extendssection of your.eslintrcconfiguration file (for recommended rules). You can omit theeslint-configpostfix:{ "extends": ["@feature-sliced"] }
-
You can partially use the rules
WARN: Don't use main config (
"@feature-sliced") in customization to avoid rules conflicts.{ "extends": [ "@feature-sliced/eslint-config/rules/import-order", "@feature-sliced/eslint-config/rules/public-api", "@feature-sliced/eslint-config/rules/layers-slices" ] } -
You can use advanced FeatureSliced-specific messages processing
# (feature-sliced/public-api) - 'Reaching to "features/search/ui" is not allowed.' + 'Violated usage of modules Public API | https://git.io/Jymjf'
-
You can use warnings instead of errors for specific rules
// feature-sliced/import-order "import/order": "warn" // ~ 1, // feature-sliced/public-api "import/no-internal-modules": "warn" // ~ 1, // feature-sliced/layers-slices "boundaries/element-types": "warn" // ~ 1,
This plugin can be used also in TypeScript projects using @typescript-eslint/eslint-plugin. Follow next steps to configure it:
-
Install dependencies:
$ npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-import-resolver-typescript # or by yarn $ yarn add -D @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-import-resolver-typescript -
Configure
@typescript-eslint/parseras parser and setup theeslint-import-resolver-typescriptresolver in the.eslintrcconfig file:{ "parser": "@typescript-eslint/parser", "settings": { "import/resolver": { "typescript": { "alwaysTryTypes": true } } } }
- FAQ
- Releases & Changelog
- How can I help?
- ⭐ Rate us on GitHub
- 💫 Any assistance is important - from feedback to participation in the development of the methodology!