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