eslint-plugin-more - extra rules for Eslint
Eslint is a very great tool and it already has tons of rules. Eslint allows us to reduce amount of time required for code review. But, of course, eslint cannot cover all the issues. So, we do in the following way, if during code review we see, that we comment on thing that is possible to check automatically, then we create new eslint rule.
Some of this rules will go to upstream after proving them in our codebase.
Install ESLint either locally or globally.
$ npm install eslint
If you installed
ESLint globally, you have to install this plugin globally too. Otherwise, install it locally.
$ npm install eslint-plugin-more
plugins section and specify ESLint-plugin-more as a plugin.
Finally, enable all of the rules that you would like to use. For example:
- no-void-map: Prohibits the use of array.map without variable or property
- no-c-like-loops: Prohibits the use of 'For loop' with ++ or +=
- prefer-includes: Prohibits the use of comparison array.indexOf() == -1 and ask to use 'includes' instead
- no-then: Forces the use of async / await instead of then
- no-window: Prohibits the usage of
- force-native-methods: - Forces the use of native methods instead of lodash/underscore
- no-filter-instead-of-find: - Prohibits using Array.prototype.filter to find one element and asks to use 'find' instead.
- no-numeric-endings-for-variables: - Prohibits the use of variables that end in numerics.
- no-duplicated-chains: - Prohibits the duplication of long chains like
- classbody-starts-with-newline - Prohibits an empty line at the beggining of a class body
- no-hardcoded-password - Prohibits using hardcoded passwords.
- no-hardcoded-configuration-data - Prohibits using hardcoded configuration data.