5.1.0 • Published 3 years ago

@xwtec/eslint-config-legacy v5.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@xwtec/eslint-config-legacy

devDependencies Issues Issues GitHub last commit GitHub Release Date

npm npm Snyk Vulnerabilities for npm package version

styled with prettier MIT license

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-config

Configuration

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

#TypeRuleDescription
1errorno-callerdisallow the use of arguments.caller or arguments.callee
2errorno-delete-vardisallow deleting variables
3errorno-dupe-argsdisallow duplicate arguments in function definitions
4errorno-dupe-else-ifdisallow duplicate conditions in if-else-if chains
5errorno-dupe-keysdisallow duplicate keys in object literals
6errorno-empty-patterndisallow empty destructuring patterns
7errorno-evaldisallow the use of eval()
8errorno-func-assigndisallow reassigning function declarations
9errorno-implied-evaldisallow the use of eval()-like methods
10errorno-import-assigndisallow assigning to imported bindings
11errorno-irregular-whitespacedisallow irregular whitespace
12errorno-obj-callsdisallow calling global object properties as functions
13errorno-redeclaredisallow variable redeclaration
14errorno-self-comparedisallow comparisons where both sides are exactly the same
15errorno-sequencesdisallow comma operators
16errorno-setter-returndisallow returning values from setters
17errorno-undefdisallow the use of undeclared variables unless mentioned in /*global */ comments
18errorradixenforce the consistent use of the radix argument when using parseInt()
19erroruse-isnanrequire calls to isNaN() when checking for NaN

Warn

#TypeRuleDescription
1warndefault-case-lastenforce default clauses in switch statements to be last
2warnfor-directionenforce "for" loop update clause moving the counter in the right direction.
3warngetter-returnenforce return statements in getters
4warnno-case-declarationsdisallow lexical declarations in case clauses
5warnno-catch-shadowdisallow catch clause parameters from shadowing variables in the outer scope
6warnno-compare-neg-zerodisallow comparing against -0
7warnno-constant-conditiondisallow constant expressions in conditions
8warnno-duplicate-casedisallow duplicate case labels
9warnno-emptydisallow empty block statements
10warnno-empty-character-classdisallow empty character classes in regular expressions
11warnno-ex-assigndisallow reassigning exceptions in catch clauses
12warnno-extend-nativedisallow extending native types
13warnno-fallthroughdisallow fallthrough of case statements
14warnno-global-assigndisallow assignments to native objects or read-only global variables
15warnno-inner-declarationsdisallow variable or function declarations in nested blocks
16warnno-invalid-regexpdisallow invalid regular expression strings in RegExp constructors
17warnno-iteratordisallow the use of the __iterator__ property
18warnno-labelsdisallow labeled statements
19warnno-multi-strdisallow multiline strings
20warnno-new-wrappersdisallow new operators with the String, Number, and Boolean objects
21warnno-octaldisallow octal literals
22warnno-octal-escapedisallow octal escape sequences in string literals
23warnno-protodisallow the use of the __proto__ property
24warnno-restricted-globalsdisallow specified global variables
25warnno-restricted-propertiesdisallow certain properties on certain objects
26warnno-self-assigndisallow assignments where both sides are exactly the same
27warnno-sparse-arraysdisallow sparse arrays
28warnno-throw-literaldisallow throwing literals as exceptions
29warnno-unmodified-loop-conditiondisallow unmodified loop conditions
30warnno-unreachabledisallow unreachable code after return, throw, continue, and break statements
31warnno-unsafe-finallydisallow control flow statements in finally blocks
32warnno-unsafe-negationdisallow negating the left operand of relational operators
33warnno-unsafe-optional-chainingdisallow use of optional chaining in contexts where the undefined value is not allowed
34warnno-unused-varsdisallow unused variables
35warnno-useless-escapedisallow unnecessary escape characters
36warnno-voiddisallow void operators
37warnno-withdisallow with statements
38warnvalid-typeofenforce comparing typeof expressions against valid strings

Fixable

#TypeRuleDescription
1warncomma-styleenforce consistent comma style
2warncurlyenforce consistent brace style for all control statements
3warndot-notationenforce dot notation whenever possible
4erroreqeqeqrequire the use of === and !==
5warnno-div-regexdisallow division operators explicitly at the beginning of regular expressions
6warnno-else-returndisallow else blocks after return statements in if statements
7warnno-extra-binddisallow unnecessary calls to .bind()
8warnno-extra-boolean-castdisallow unnecessary boolean casts
9warnno-extra-labeldisallow unnecessary labels
10warnno-regex-spacesdisallow multiple spaces in regular expressions
11warnno-undef-initdisallow initializing variables to undefined
12warnno-unneeded-ternarydisallow ternary operators when simpler alternatives exist
13warnno-unused-labelsdisallow unused labels
14warnno-useless-returndisallow redundant return statements
15warnone-varenforce variables to be declared either together or separately in functions
16warnoperator-assignmentrequire or disallow assignment operator shorthand where possible
17warnspaced-commentenforce consistent spacing after the // or /* in a comment
18warnstrictrequire or disallow strict mode directives
19warnyodarequire or disallow "Yoda" conditions
20warnprettier/prettier

Related

Links

5.1.0

3 years ago

5.0.0

3 years ago

4.3.1

4 years ago

4.3.0

4 years ago

4.2.0

4 years ago

4.1.20

4 years ago

4.1.19

4 years ago

4.1.18

5 years ago

4.1.17

5 years ago

4.1.16

5 years ago

4.1.15

5 years ago

4.1.14

5 years ago

4.1.13

5 years ago

4.1.12

5 years ago

4.1.11

5 years ago

4.1.10

5 years ago

4.1.9

5 years ago

4.1.8

5 years ago

4.1.7

5 years ago

4.1.6

5 years ago

4.1.5

5 years ago