eslint-plugin-trn-plugin
v0.0.22
Published
plugin for advanced project
Downloads
23
Maintainers
Readme
eslint-plugin-trn-plugin
The plugin contains the following rules:
- path-checker - prohibits absolute imports within one module
- layer-imports - checks if layers are used correctly from Feature-Sliced Design point of view (e.g. widgets cannot be used in features and entities)
- public-api-imports - allows import from other modules only from public api. Has auto fix
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-trn-plugin
:
npm install eslint-plugin-trn-plugin --save-dev
Usage
Add trn-plugin
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"trn-plugin"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"trn-plugin/path-checker": [
"error",
{
alias: "@",
},
],
"trn-plugin/layer-imports": [
"error",
{
alias: "@", ignoreImportPatterns: ["**/StoreProvider", "**/testing"],
},
],
"trn-plugin/public-api-imports": [
"error",
{
alias: "@",
testFilesPatterns: ["**/*.test.*", "**/*.story.*", "**/StoreDecorator.tsx"],
},
],
}
}