UNPKG

eslint-plugin-autofix

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