Miss any of our Open RFC calls?Watch the recordings here! »

@xwtec/eslint-config

6.3.1 • Public • Published

@xwtec/eslint-config

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 projects

Install

# with yarn 
yarn add --dev eslint prettier @xwtec/eslint-config @xwtec/prettier-config
 
# with npm 
npm install --save-dev eslint prettier @xwtec/eslint-config @xwtec/prettier-config

Configuration

Add following code

module.exports = {
  extends: ['@xwtec'],
};

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-class-assign disallow reassigning class members
3 error no-const-assign disallow reassigning const variables
4 error no-delete-var disallow deleting variables
5 error no-dupe-args disallow duplicate arguments in function definitions
6 error no-dupe-class-members disallow duplicate class members
7 error no-dupe-else-if disallow duplicate conditions in if-else-if chains
8 error no-dupe-keys disallow duplicate keys in object literals
9 error no-empty-pattern disallow empty destructuring patterns
10 error no-eval disallow the use of eval()
11 error no-func-assign disallow reassigning function declarations
12 error no-implied-eval disallow the use of eval()-like methods
13 error no-import-assign disallow assigning to imported bindings
14 error no-irregular-whitespace disallow irregular whitespace
15 error no-new-symbol disallow new operators with the Symbol object
16 error no-obj-calls disallow calling global object properties as functions
17 error no-redeclare disallow variable redeclaration
18 error no-self-compare disallow comparisons where both sides are exactly the same
19 error no-sequences disallow comma operators
20 error no-setter-return disallow returning values from setters
21 error no-undef disallow the use of undeclared variables unless mentioned in /*global */ comments
22 error require-yield require generator functions to contain yield
23 error use-isnan require calls to isNaN() when checking for NaN

Warn

# Type Rule Description
1 warn constructor-super require super() calls in constructors
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-compare-neg-zero disallow comparing against -0
6 warn no-constant-condition disallow constant expressions in conditions
7 warn no-duplicate-case disallow duplicate case labels
8 warn no-empty disallow empty block statements
9 warn no-empty-character-class disallow empty character classes in regular expressions
10 warn no-ex-assign disallow reassigning exceptions in catch clauses
11 warn no-extend-native disallow extending native types
12 warn no-fallthrough disallow fallthrough of case statements
13 warn no-global-assign disallow assignments to native objects or read-only global variables
14 warn no-inner-declarations disallow variable or function declarations in nested blocks
15 warn no-invalid-regexp disallow invalid regular expression strings in RegExp constructors
16 warn no-iterator disallow the use of the __iterator__ property
17 warn no-labels disallow labeled statements
18 warn no-multi-str disallow multiline strings
19 warn no-new-wrappers disallow new operators with the String, Number, and Boolean objects
20 warn no-octal disallow octal literals
21 warn no-octal-escape disallow octal escape sequences in string literals
22 warn no-proto disallow the use of the __proto__ property
23 warn no-restricted-properties disallow certain properties on certain objects
24 warn no-self-assign disallow assignments where both sides are exactly the same
25 warn no-sparse-arrays disallow sparse arrays
26 warn no-this-before-super disallow this/super before calling super() in constructors
27 warn no-throw-literal disallow throwing literals as exceptions
28 warn no-unmodified-loop-condition disallow unmodified loop conditions
29 warn no-unreachable disallow unreachable code after return, throw, continue, and break statements
30 warn no-unsafe-finally disallow control flow statements in finally blocks
31 warn no-unsafe-negation disallow negating the left operand of relational operators
32 warn no-unused-vars disallow unused variables
33 warn no-useless-escape disallow unnecessary escape characters
34 warn no-void disallow void operators
35 warn no-with disallow with statements
36 warn radix enforce the consistent use of the radix argument when using parseInt()
37 warn valid-typeof enforce comparing typeof expressions against valid strings

Fixable

# Type Rule Description
1 warn dot-notation enforce dot notation whenever possible
2 error eqeqeq require the use of === and !==
3 warn no-div-regex disallow division operators explicitly at the beginning of regular expressions
4 warn no-else-return disallow else blocks after return statements in if statements
5 warn no-extra-bind disallow unnecessary calls to .bind()
6 warn no-extra-boolean-cast disallow unnecessary boolean casts
7 warn no-extra-label disallow unnecessary labels
8 warn no-regex-spaces disallow multiple spaces in regular expressions
9 warn no-undef-init disallow initializing variables to undefined
10 warn no-unneeded-ternary disallow ternary operators when simpler alternatives exist
11 warn no-unused-labels disallow unused labels
12 warn no-useless-computed-key disallow unnecessary computed property keys in objects and classes
13 warn no-useless-rename disallow renaming import, export, and destructured assignments to the same name
14 warn no-useless-return disallow redundant return statements
15 warn no-var require let or const instead of var
16 warn object-shorthand require or disallow method and property shorthand syntax for object literals
17 warn one-var enforce variables to be declared either together or separately in functions
18 warn operator-assignment require or disallow assignment operator shorthand where possible
19 warn prefer-const require const declarations for variables that are never reassigned after declared
20 warn prefer-destructuring require destructuring from arrays and/or objects
21 warn prefer-exponentiation-operator disallow the use of Math.pow in favor of the ** operator
22 warn prefer-numeric-literals disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals
23 warn prefer-object-spread disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.
24 warn prefer-template require template literals instead of string concatenation
25 warn spaced-comment enforce consistent spacing after the // or /* in a comment
26 warn yoda require or disallow "Yoda" conditions
27 warn prettier/prettier

Related

Links

Install

npm i @xwtec/[email protected]

Version

6.3.1

License

MIT

Unpacked Size

39.3 kB

Total Files

12

Last publish

Collaborators

  • avatar