My ESLint plugin
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install eslint-plugin-emmanuel
:
$ npm install eslint-plugin-emmanuel --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-emmanuel
globally.
Add emmanuel
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"emmanuel"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"emmanuel/rule-name": 2
}
}
- Fill in provided rules here
If you want to use the Simplified CommonJS Wrapper format for your modules, you should not use this rule.
Key: ✔️ = recommended, 🔧 = fixable
Name | Description | ✔️ | 🔧 |
---|---|---|---|
emmanuel/avoid-class-name-conflict |
avoid use a native name for a class name | ||
emmanuel/avoid-infinite-loop |
disallow easy infinite loop | ✔️ | |
emmanuel/avoid-typing-mistake |
avoid typing mistake | ||
emmanuel/bool-concordance |
check type concordance on boolean properties values | ||
emmanuel/compare-regex |
use fast-deep-equal package to compare regex expressions |
🔧 | |
emmanuel/deterministic-stringify |
prefer fast-json-stable-stringify package to native JSON.stringify() | 🔧 | |
emmanuel/math-shortcut |
use Math constants | 🔧 | |
emmanuel/max-lines-per-loop |
Max lines per a loop | ||
emmanuel/negative-array |
avoid negative index on an array | ||
emmanuel/no-commented-out-code |
Detect commented code | ||
emmanuel/no-divide-by-zero |
No divide by zero | ||
emmanuel/no-double-negative |
No double negative | 🔧 | |
emmanuel/no-duplicate-requires |
eslint-plugin-import offer a rule to report when a resolved path is imported more than once, but that doesn't work with require | ||
emmanuel/no-empty-requires |
Find require() or require("") | ✔️ | |
emmanuel/no-invalid-xpath |
Check XPath expressions and avoid magic number | 🔧 | |
emmanuel/no-nan |
Don't try to assign value to readonly items | 🔧 | |
emmanuel/no-number-useless |
useless Number object constructor | 🔧 | |
emmanuel/no-redefine-require |
Detect if require() is redefine | ✔️ | |
emmanuel/no-reuse-function-name |
No reuse function name | 🔧 | |
emmanuel/no-same-arguments |
avoid arguments mistake, like same string arguments in a function call | ||
emmanuel/no-similar-fn-params |
Avoid similar params names | ✔️ | |
emmanuel/no-special-number |
prefer to use a standart Math constant | 🔧 | |
emmanuel/no-useless-concat |
disallow unnecessary concatenation of literals or template literals | ✔️ | 🔧 |
emmanuel/no-very-large-array |
no very large array | 🔧 | |
emmanuel/prefer-array-fill |
prefer Array.fill method to avoid mistake | 🔧 | |
emmanuel/prefer-flatmap |
slow code, prefer flatMap method |
✔️ | 🔧 |
emmanuel/securecontext |
check isSecureContext | ||
emmanuel/simplify-regex |
simplify regex | 🔧 | |
emmanuel/too-many-comments |
.. | ||
emmanuel/ts-type |
.. | 🔧 | |
emmanuel/url-needed |
.. | 🔧 |