eslint-plugin-lucky-fsd

0.0.20 • Public • Published

eslint-plugin-lucky-fsd

Plugin for Feature-Sliced Design(it was developed for Windows and may not work on Mac)

  1. Checks that the paths inside the component are relative. Also supports checking with aliases.
  2. Prohibits importing from non-public api
  3. Prohibits import from overlying layers

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-lucky-fsd:

npm install eslint-plugin-lucky-fsd --save-dev

Usage

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

{
    "plugins": [
        "lucky-fsd"
    ]
}

Then configure the rules you want to use under the rules section.

'lucky-fsd/path-checker' - checks that the paths inside the component are relative. Also supports checking with aliases. 'lucky-fsd/public-api-imports' - prohibits importing from non-public api 'lucky-fsd/layer-imports' - prohibits import from overlying layers

{
    rules: {
      'lucky-fsd/path-checker': ['error', { alias: '@' }],
      'lucky-fsd/public-api-imports': [
        'error',
        {
          alias: '@',
          testFilesPatterns: ['**/*.test.*', '**/*.stories.*', '**/StoreDecorator.tsx'],
        }
      ],
      'lucky-fsd/layer-imports': [
        'error',
        {
          alias: '@',
          ignoreImportPatterns: [ '**/StoreProvider' ],
        }
      ]
    },
}

/eslint-plugin-lucky-fsd/

    Package Sidebar

    Install

    npm i eslint-plugin-lucky-fsd

    Weekly Downloads

    0

    Version

    0.0.20

    License

    ISC

    Unpacked Size

    23.5 kB

    Total Files

    18

    Last publish

    Collaborators

    • alexander_lucky