eslint-plugin-fsd-by-korkh

0.1.6 • Public • Published

eslint-plugin-fsd-by-korkh

plugin for checking FSD architecture and import paths inside react projects

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-fsd-by-korkhn:

npm install eslint-plugin-fsd-by-korkhn --save-dev
or
npm i -D eslint-plugin-fsd-by-korkhn

Usage

Add eslint-plugin-fsd-by-korkh to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["fsd-by-korkh"]
}

Then configure the rules you want to use under the rules section. To control relative an absolute path for modules (slices) use:

{
  "rules": {
    "fsd-by-korkh/path-checker": "error"
  }
}

If there is alias used in the project, f.ex. "@":

{
  "rules": {
    "fsd-by-korkh/path-checker": ["error", { "alias": "@" }]
  }
}

If in your project you are using storybook with Decorators, or tests (jest or other) and want to isolate some reducers, can be used public API as (testing.ts or testing.js) needs to pass following patterns to eslint:

{
    "rules": {
        "fsd-by-korkh/path-checker":  [
      "error",
      {
        "alias": "@",
        "testFilesPatterns": [
          "**/*.test.*",
          "**/*.stories.*",
          "**/StoreDecorator.tsx"
        ]
      }
    ]
    }
}

Package Sidebar

Install

npm i eslint-plugin-fsd-by-korkh

Weekly Downloads

1

Version

0.1.6

License

ISC

Unpacked Size

25.1 kB

Total Files

14

Last publish

Collaborators

  • akorkh