ESLint Configuration for xwtec projects

Usage no npm install needed!

<script type="module">
  import xwtecEslintConfig from 'https://cdn.skypack.dev/@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


# 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


Add following code

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

to .eslintrc.js in your project.

You may also want config prettier with @xwtec/prettier-config.


npx eslint "**/*.js"



# 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 radix enforce the consistent use of the radix argument when using parseInt()
23 error require-yield require generator functions to contain yield
24 error use-isnan require calls to isNaN() when checking for NaN
25 error regexp/no-legacy-features disallow legacy RegExp features


# Type Rule Description
1 warn constructor-super require super() calls in constructors
2 warn default-case-last enforce default clauses in switch statements to be last
3 warn for-direction enforce "for" loop update clause moving the counter in the right direction.
4 warn getter-return enforce return statements in getters
5 warn no-case-declarations disallow lexical declarations in case clauses
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-this-before-super disallow this/super before calling super() in constructors
29 warn no-throw-literal disallow throwing literals as exceptions
30 warn no-unmodified-loop-condition disallow unmodified loop conditions
31 warn no-unreachable disallow unreachable code after return, throw, continue, and break statements
32 warn no-unsafe-finally disallow control flow statements in finally blocks
33 warn no-unsafe-negation disallow negating the left operand of relational operators
34 warn no-unsafe-optional-chaining disallow use of optional chaining in contexts where the undefined value is not allowed
35 warn no-unused-vars disallow unused variables
36 warn no-useless-escape disallow unnecessary escape characters
37 warn no-void disallow void operators
38 warn no-with disallow with statements
39 warn valid-typeof enforce comparing typeof expressions against valid strings
40 warn import/extensions


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