best practices
Eslint plugin for FSDInstallation
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:
You can configure rules in 2 ways:
- Configure each rule you want to use under the rules section.
- Use shared config from this plugin.
Supported Rules
- hof-name-prefix - enforce
make
prefix in higher order function names - jq-use-js-prefix-in-selector - enforce
js-
prefix in classes that are used to search the DOM - jq-cache-dom-elements - enforce caching of all found DOM elements
- split-conditionals - disallow complex conditions
- no-heavy-constructor - disallow searching the DOM tree and defining handlers in the constructor
- no-function-declaration-in-event-listener - enforce moving event handlers to separate functions
If you want to contribute, check out README.dev.