@xwtec/eslint-config
v11.0.3
Published
ESLint Configuration for xwtec projects
Downloads
602
Readme
@xwtec/eslint-config
ESLint Configuration for xwtec projects
Install
yarn add --dev eslint @xwtec/eslint-config
Configuration
Add the following code to your eslint.config.mjs
.
import xwtecEslintConfig from '@xwtec/eslint-config';
export default [
xwtecEslintConfig,
{
rules: {
'unicorn/no-array-for-each': 'error',
},
},
].flat();
Usage
npx eslint
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-restricted-globals | Disallow specified global variables |
| 19 | error | no-self-compare | Disallow comparisons where both sides are exactly the same |
| 20 | error | no-sequences | Disallow comma operators |
| 21 | error | no-setter-return | Disallow returning values from setters |
| 22 | error | no-undef | Disallow the use of undeclared variables unless mentioned in /*global */
comments |
| 23 | error | no-unused-expressions | Disallow unused expressions |
| 24 | error | radix | Enforce the consistent use of the radix argument when using parseInt()
|
| 25 | error | require-yield | Require generator functions to contain yield
|
| 26 | error | use-isnan | Require calls to isNaN()
when checking for NaN
|
| 27 | error | regexp/no-legacy-features | disallow legacy RegExp features |
Warn
| # | 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-properties | Disallow certain properties on certain objects |
| 25 | warn | no-self-assign | Disallow assignments where both sides are exactly the same |
| 26 | warn | no-sparse-arrays | Disallow sparse arrays |
| 27 | warn | no-this-before-super | Disallow this
/super
before calling super()
in constructors |
| 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 | 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 equal signs 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 | unicode-bom | Require or disallow Unicode byte order mark (BOM) |
| 28 | warn | yoda | Require or disallow "Yoda" conditions |
| 29 | warn | simple-import-sort/exports | - |
| 30 | warn | simple-import-sort/imports | - |