0.0.15 • Published 2 years ago

eslint-plugin-project-fsd-architecture v0.0.15

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

eslint-plugin-project-fsd-architecture

eslint plugin for project fsd architecture validation

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-project-fsd-architecture:

npm install eslint-plugin-project-fsd-architecture --save-dev

Usage

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

{
    "plugins": [
        "project-fsd-architecture"
    ]
}

Project structure example:

src
  app
  |  providers
  |    ...
  |    StoreProvider
  |    |  ui
  |    |  |  StoreProvider.tsx
  |    |  index.ts
  |    ThemeProvider
  |    ...
  pages
  |  ...
  |  Main
  |    model
  |    ui
  |    |  MainPage.tsx
  |    index.ts
  widgets
  |  Sidebar
  |    model
  |    |  selectors
  |    |  types
  |    |    sidebar.ts
  |    ui
  |    |  Sidebar.tsx
  |    index.ts
  |    testing.ts
  features
  entities    
  shared
    config
      StoreProviderDecorator.tsx

.eslintrc.js example:

// your .eslintrc.js
module.exports = {
    // ...
    plugins: [
        // ...
        'project-fsd-architecture',
        // ...
    ],
    rules: {
        // ...
        'project-fsd-architecture/slice-imports-validation': ['error', { alias: '@' }],
        'project-fsd-architecture/public-api-imports-validation':
            [
                'error', {
                alias: '@',
                testFilesPatterns: ['**/*.test.*', '**/*.story.*', '**/StoreProviderDecorator.tsx'],
            },
            ],
        'project-fsd-architecture/layer-imports': [
            'error',
            {
                alias: '@',
                ignoreImportPatterns: ['**/StoreProvider', '**/testing', '**/router'],
                testFilesPatterns: ['**/tests/*'],
            },
        ],
    },
}

Rules

Name                         Description
layer-importsChecks imports from higher layer into layer below
public-api-imports-validationChecks imports from other modules (allowed only from the public API)
slice-imports-validationChecks imports within a module
0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.3

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago