$ npm i eslint-plugin-autofix -D
add prefix "autofix" to the rulename in eslintrc:
{
"plugins": ["autofix"],
"rules": {
"autofix/no-debugger": "error"
}
}
βοΈ indicates that a rule is recommended for all users. π indicates that a rule is fixable.
Name | βοΈ | π | Description |
---|---|---|---|
array-bracket-newline | π | enforce linebreaks after opening and before closing array brackets | |
array-bracket-spacing | π | enforce consistent spacing inside array brackets | |
array-element-newline | π | enforce line breaks after each array element | |
arrow-body-style | π | require braces around arrow function bodies | |
arrow-parens | π | require parentheses around arrow function arguments | |
arrow-spacing | π | enforce consistent spacing before and after the arrow in arrow functions | |
block-spacing | π | disallow or enforce spaces inside of blocks after opening block and before closing block | |
brace-style | π | enforce consistent brace style for blocks | |
capitalized-comments | π | enforce or disallow capitalization of the first letter of a comment | |
comma-dangle | π | require or disallow trailing commas | |
comma-spacing | π | enforce consistent spacing before and after commas | |
comma-style | π | enforce consistent comma style | |
computed-property-spacing | π | enforce consistent spacing inside computed property brackets | |
curly | π | enforce consistent brace style for all control statements | |
dot-location | π | enforce consistent newlines before and after dots | |
dot-notation | π | enforce dot notation whenever possible | |
eol-last | π | require or disallow newline at the end of files | |
eqeqeq | π | require the use of === and !== |
|
func-call-spacing | π | require or disallow spacing between function identifiers and their invocations | |
function-paren-newline | π | enforce consistent line breaks inside function parentheses | |
generator-star-spacing | π | enforce consistent spacing around * operators in generator functions |
|
implicit-arrow-linebreak | π | enforce the location of arrow function bodies | |
indent | π | enforce consistent indentation | |
indent-legacy | π | enforce consistent indentation | |
jsx-quotes | π | enforce the consistent use of either double or single quotes in JSX attributes | |
key-spacing | π | enforce consistent spacing between keys and values in object literal properties | |
keyword-spacing | π | enforce consistent spacing before and after keywords | |
linebreak-style | π | enforce consistent linebreak style | |
lines-around-comment | π | require empty lines around comments | |
lines-around-directive | π | require or disallow newlines around directives | |
lines-between-class-members | π | require or disallow an empty line between class members | |
multiline-comment-style | π | enforce a particular style for multiline comments | |
new-parens | π | require parentheses when invoking a constructor with no arguments | |
newline-after-var | π | require or disallow an empty line after variable declarations | |
newline-before-return | π | require an empty line before return statements |
|
newline-per-chained-call | π | require a newline after each call in a method chain | |
no-alert | π | disallow the use of alert , confirm , and prompt |
|
no-caller | π | disallow the use of arguments.caller or arguments.callee |
|
no-confusing-arrow | π | disallow arrow functions where they could be confused with comparisons | |
no-console | βοΈ | π | disallow the use of console |
no-debugger | βοΈ | π | disallow the use of debugger |
no-else-return | π | disallow else blocks after return statements in if statements |
|
no-eq-null | π | disallow null comparisons without type-checking operators |
|
no-extra-bind | π | disallow unnecessary calls to .bind() |
|
no-extra-boolean-cast | π | disallow unnecessary boolean casts | |
no-extra-label | π | disallow unnecessary labels | |
no-extra-parens | π | disallow unnecessary parentheses | |
no-extra-semi | π | disallow unnecessary semicolons | |
no-floating-decimal | π | disallow leading or trailing decimal points in numeric literals | |
no-implicit-coercion | π | disallow shorthand type conversions | |
no-lonely-if | π | disallow if statements as the only statement in else blocks |
|
no-multi-spaces | π | disallow multiple spaces | |
no-multiple-empty-lines | π | disallow multiple empty lines | |
no-new-symbol | π | disallow new operators with the Symbol object |
|
no-plusplus | βοΈ | π | disallow the unary operators ++ and -- |
no-proto | π | disallow the use of the __proto__ property |
|
no-prototype-builtins | π | disallow calling some Object.prototype methods directly on objects |
|
no-regex-spaces | π | disallow multiple spaces in regular expressions | |
no-spaced-func | π | disallow spacing between function identifiers and their applications (deprecated) | |
no-throw-literal | π | disallow throwing literals as exceptions | |
no-trailing-spaces | π | disallow trailing whitespace at the end of lines | |
no-undef-init | π | disallow initializing variables to undefined |
|
no-unneeded-ternary | π | disallow ternary operators when simpler alternatives exist | |
no-unsafe-negation | π | disallow negating the left operand of relational operators | |
no-unused-labels | π | disallow unused labels | |
no-unused-vars | π | disallow unused variables | |
no-useless-computed-key | π | disallow unnecessary computed property keys in object literals | |
no-useless-concat | π | disallow unnecessary concatenation of literals or template literals | |
no-useless-rename | π | disallow renaming import, export, and destructured assignments to the same name | |
no-useless-return | π | disallow redundant return statements | |
no-var | π | require let or const instead of var |
|
no-whitespace-before-property | π | disallow whitespace before properties | |
nonblock-statement-body-position | π | enforce the location of single-line statements | |
object-curly-newline | π | enforce consistent line breaks inside braces | |
object-curly-spacing | π | enforce consistent spacing inside braces | |
object-property-newline | π | enforce placing object properties on separate lines | |
object-shorthand | π | require or disallow method and property shorthand syntax for object literals | |
one-var | π | enforce variables to be declared either together or separately in functions | |
one-var-declaration-per-line | π | require or disallow newlines around variable declarations | |
operator-assignment | π | require or disallow assignment operator shorthand where possible | |
operator-linebreak | π | enforce consistent linebreak style for operators | |
padded-blocks | π | require or disallow padding within blocks | |
padding-line-between-statements | π | require or disallow padding lines between statements | |
prefer-arrow-callback | π | require using arrow functions for callbacks | |
prefer-const | π | require const declarations for variables that are never reassigned after declared |
|
prefer-destructuring | π | require destructuring from arrays and/or objects | |
prefer-numeric-literals | π | disallow parseInt() and Number.parseInt() in favor of binary, octal, and hexadecimal literals |
|
prefer-object-spread | π | disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead. | |
prefer-spread | π | require spread operators instead of .apply() |
|
prefer-template | π | require template literals instead of string concatenation | |
quote-props | π | require quotes around object literal property names | |
quotes | π | enforce the consistent use of either backticks, double, or single quotes | |
radix | π | enforce the consistent use of the radix argument when using parseInt() |
|
rest-spread-spacing | π | enforce spacing between rest and spread operators and their expressions | |
semi | π | require or disallow semicolons instead of ASI | |
semi-spacing | π | enforce consistent spacing before and after semicolons | |
semi-style | π | enforce location of semicolons | |
sort-imports | π | enforce sorted import declarations within modules | |
sort-vars | π | require variables within the same declaration block to be sorted | |
space-before-blocks | π | enforce consistent spacing before blocks | |
space-before-function-paren | π | enforce consistent spacing before function definition opening parenthesis |
|
space-in-parens | π | enforce consistent spacing inside parentheses | |
space-infix-ops | π | require spacing around infix operators | |
space-unary-ops | π | enforce consistent spacing before or after unary operators | |
spaced-comment | π | enforce consistent spacing after the // or /* in a comment |
|
strict | π | require or disallow strict mode directives | |
switch-colon-spacing | π | enforce spacing around colons of switch statements | |
template-curly-spacing | π | require or disallow spacing around embedded expressions of template strings | |
template-tag-spacing | π | require or disallow spacing between template tags and their literals | |
unicode-bom | π | require or disallow Unicode byte order mark (BOM) | |
valid-jsdoc | π | enforce valid JSDoc comments | |
valid-typeof | π | enforce comparing typeof expressions against valid strings |
|
wrap-iife | π | require parentheses around immediate function invocations |
|
wrap-regex | π | require parenthesis around regex literals | |
yield-star-spacing | π | require or disallow spacing around the * in yield* expressions |
|
yoda | π | require or disallow "Yoda" conditions |
- to add a new rule:
npm run new ${ruleName}