Remediate autofixable ESLint findings
ProprietaryApplies every ESLint autofix remediation in this package, covering the core ESLint rules that ship an autofixer and can be reproduced faithfully on the LST. Each sub-recipe replicates the behavior of eslint --fix for one rule under that rule's default options, and is also available to run individually.
org. openrewrite. javascript. cleanup. ESLintAutofixmod run . --recipe= org. openrewrite. javascript. cleanup. ESLintAutofixInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Require
letorconstinstead ofvar - Require
constdeclarations for variables that are never reassigned after declared - Disallow initializing variables to
undefined - Enforce consistent brace style for all control statements
- Disallow
elseblocks afterreturnstatements inifstatements - Disallow
ifstatements as the only statement inelseblocks - Remove unused labels
- Disallow unnecessary labels
- Disallow redundant
returnstatements - Require the use of
===and!== - Disallow "Yoda" conditions
- Disallow ternary operators when simpler alternatives exist
- Disallow unnecessary boolean casts
- Disallow shorthand type conversions
- Use operator-assignment shorthand where possible
- Use logical assignment operator shorthand
- Enforce dot notation whenever possible
- Require object literal shorthand syntax
- Disallow unnecessary computed property keys in objects and classes
- Disallow renaming import, export, and destructured assignments to the same name
- Require destructuring from arrays and/or objects
- Use object spread instead of
Object.assignwith an object literal first argument - Prefer
Object.hasOwn()overObject.prototype.hasOwnProperty.call() - Disallow unnecessary calls to
.bind() - Require using arrow functions for callbacks
- Omit braces around arrow function bodies containing only a
return - Require template literals instead of string concatenation
- Disallow
parseInt()in favor of binary, octal, and hexadecimal literals - Disallow the use of
Math.powin favor of the**operator - Disallow
Arrayconstructors - Disallow multiple spaces in regular expressions