eslint-plugin-autofix
Install & usage
$ npm i eslint-plugin-autofix -Dadd prefix "autofix" to the rulename in eslintrc:
{
"plugins": ["autofix"],
"rules": {
"autofix/no-debugger": "error"
}
}Supported rules
✔️ 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-call-argument-newline | | 🛠 | enforce line breaks between arguments of a function call | |
| 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 | | 🛠 | enforce or disallow 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-div-regex | | 🛠 | disallow division operators explicitly at the beginning of regular expressions | |
| 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-unused-labels | | 🛠 | disallow unused labels | |
| no-unused-vars | | 🛠 | disallow unused variables | |
| no-useless-catch | | 🛠 | disallow unnecessary catch clauses |
|
| no-useless-computed-key | | 🛠 | disallow unnecessary computed property keys in objects and classes | |
| 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-exponentiation-operator | | 🛠 | disallow the use of Math.pow in favor of the ** operator |
|
| 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 | |
Contributing
- to add a new rule:
npm run new ${ruleName}