/eslint-plugin-fsd

Eslint plugin for FSD best practices

Primary LanguageTypeScript

Eslint plugin for FSD best practices

npm version Continuous Integration

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-fsd:

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

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-fsd globally.

Usage

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

{
  "plugins": ["fsd"]
}

You can configure rules in 2 ways:

  1. Configure each rule you want to use under the rules section.
{
  "rules": {
    "fsd/hof-name-prefix": "error",
    "fsd/no-heavy-constructor": "error",
    "fsd/jq-cache-dom-elements": "error",
    "fsd/jq-use-js-prefix-in-selector": "error",
    "fsd/no-function-declaration-in-event-listener": "error",
    "fsd/split-conditionals": "error"
  }
}
  1. Use shared config from this plugin.
{
  "extends": ["plugin:fsd/all"]
}

Supported Rules

If you want to contribute, check out readme-dev.