5.1.0 • Published 4 years ago
@xwtec/eslint-config-legacy v5.1.0
@xwtec/eslint-config-legacy
ESLint Configuration for xwtec es5 projects
Install
# with yarn
yarn add --dev eslint prettier @xwtec/eslint-config-legacy @xwtec/prettier-config
# with npm
npm install --save-dev eslint prettier @xwtec/eslint-config-legacy @xwtec/prettier-configConfiguration
Add following code
module.exports = {
extends: ['@xwtec/legacy'],
};to .eslintrc.js in your project.
You may also want config prettier with @xwtec/prettier-config.
Usage
npx eslint "**/*.js"Rules
Error
| # | Type | Rule | Description |
|---|---|---|---|
| 1 | error | no-caller | disallow the use of arguments.caller or arguments.callee |
| 2 | error | no-delete-var | disallow deleting variables |
| 3 | error | no-dupe-args | disallow duplicate arguments in function definitions |
| 4 | error | no-dupe-else-if | disallow duplicate conditions in if-else-if chains |
| 5 | error | no-dupe-keys | disallow duplicate keys in object literals |
| 6 | error | no-empty-pattern | disallow empty destructuring patterns |
| 7 | error | no-eval | disallow the use of eval() |
| 8 | error | no-func-assign | disallow reassigning function declarations |
| 9 | error | no-implied-eval | disallow the use of eval()-like methods |
| 10 | error | no-import-assign | disallow assigning to imported bindings |
| 11 | error | no-irregular-whitespace | disallow irregular whitespace |
| 12 | error | no-obj-calls | disallow calling global object properties as functions |
| 13 | error | no-redeclare | disallow variable redeclaration |
| 14 | error | no-self-compare | disallow comparisons where both sides are exactly the same |
| 15 | error | no-sequences | disallow comma operators |
| 16 | error | no-setter-return | disallow returning values from setters |
| 17 | error | no-undef | disallow the use of undeclared variables unless mentioned in /*global */ comments |
| 18 | error | radix | enforce the consistent use of the radix argument when using parseInt() |
| 19 | error | use-isnan | require calls to isNaN() when checking for NaN |
Warn
| # | Type | Rule | Description |
|---|---|---|---|
| 1 | warn | default-case-last | enforce default clauses in switch statements to be last |
| 2 | warn | for-direction | enforce "for" loop update clause moving the counter in the right direction. |
| 3 | warn | getter-return | enforce return statements in getters |
| 4 | warn | no-case-declarations | disallow lexical declarations in case clauses |
| 5 | warn | no-catch-shadow | disallow catch clause parameters from shadowing variables in the outer scope |
| 6 | warn | no-compare-neg-zero | disallow comparing against -0 |
| 7 | warn | no-constant-condition | disallow constant expressions in conditions |
| 8 | warn | no-duplicate-case | disallow duplicate case labels |
| 9 | warn | no-empty | disallow empty block statements |
| 10 | warn | no-empty-character-class | disallow empty character classes in regular expressions |
| 11 | warn | no-ex-assign | disallow reassigning exceptions in catch clauses |
| 12 | warn | no-extend-native | disallow extending native types |
| 13 | warn | no-fallthrough | disallow fallthrough of case statements |
| 14 | warn | no-global-assign | disallow assignments to native objects or read-only global variables |
| 15 | warn | no-inner-declarations | disallow variable or function declarations in nested blocks |
| 16 | warn | no-invalid-regexp | disallow invalid regular expression strings in RegExp constructors |
| 17 | warn | no-iterator | disallow the use of the __iterator__ property |
| 18 | warn | no-labels | disallow labeled statements |
| 19 | warn | no-multi-str | disallow multiline strings |
| 20 | warn | no-new-wrappers | disallow new operators with the String, Number, and Boolean objects |
| 21 | warn | no-octal | disallow octal literals |
| 22 | warn | no-octal-escape | disallow octal escape sequences in string literals |
| 23 | warn | no-proto | disallow the use of the __proto__ property |
| 24 | warn | no-restricted-globals | disallow specified global variables |
| 25 | warn | no-restricted-properties | disallow certain properties on certain objects |
| 26 | warn | no-self-assign | disallow assignments where both sides are exactly the same |
| 27 | warn | no-sparse-arrays | disallow sparse arrays |
| 28 | warn | no-throw-literal | disallow throwing literals as exceptions |
| 29 | warn | no-unmodified-loop-condition | disallow unmodified loop conditions |
| 30 | warn | no-unreachable | disallow unreachable code after return, throw, continue, and break statements |
| 31 | warn | no-unsafe-finally | disallow control flow statements in finally blocks |
| 32 | warn | no-unsafe-negation | disallow negating the left operand of relational operators |
| 33 | warn | no-unsafe-optional-chaining | disallow use of optional chaining in contexts where the undefined value is not allowed |
| 34 | warn | no-unused-vars | disallow unused variables |
| 35 | warn | no-useless-escape | disallow unnecessary escape characters |
| 36 | warn | no-void | disallow void operators |
| 37 | warn | no-with | disallow with statements |
| 38 | warn | valid-typeof | enforce comparing typeof expressions against valid strings |
Fixable
| # | Type | Rule | Description |
|---|---|---|---|
| 1 | warn | comma-style | enforce consistent comma style |
| 2 | warn | curly | enforce consistent brace style for all control statements |
| 3 | warn | dot-notation | enforce dot notation whenever possible |
| 4 | error | eqeqeq | require the use of === and !== |
| 5 | warn | no-div-regex | disallow division operators explicitly at the beginning of regular expressions |
| 6 | warn | no-else-return | disallow else blocks after return statements in if statements |
| 7 | warn | no-extra-bind | disallow unnecessary calls to .bind() |
| 8 | warn | no-extra-boolean-cast | disallow unnecessary boolean casts |
| 9 | warn | no-extra-label | disallow unnecessary labels |
| 10 | warn | no-regex-spaces | disallow multiple spaces in regular expressions |
| 11 | warn | no-undef-init | disallow initializing variables to undefined |
| 12 | warn | no-unneeded-ternary | disallow ternary operators when simpler alternatives exist |
| 13 | warn | no-unused-labels | disallow unused labels |
| 14 | warn | no-useless-return | disallow redundant return statements |
| 15 | warn | one-var | enforce variables to be declared either together or separately in functions |
| 16 | warn | operator-assignment | require or disallow assignment operator shorthand where possible |
| 17 | warn | spaced-comment | enforce consistent spacing after the // or /* in a comment |
| 18 | warn | strict | require or disallow strict mode directives |
| 19 | warn | yoda | require or disallow "Yoda" conditions |
| 20 | warn | prettier/prettier |
Related
Links
5.1.0
4 years ago
5.0.0
4 years ago
4.3.1
5 years ago
4.3.0
6 years ago
4.2.0
6 years ago
4.1.20
6 years ago
4.1.19
6 years ago
4.1.18
6 years ago
4.1.17
6 years ago
4.1.16
6 years ago
4.1.15
6 years ago
4.1.14
6 years ago
4.1.13
6 years ago
4.1.12
6 years ago
4.1.11
6 years ago
4.1.10
6 years ago
4.1.9
7 years ago
4.1.8
7 years ago
4.1.7
7 years ago
4.1.6
7 years ago
4.1.5
7 years ago