Remediate autofixable ESLint findings

Proprietary

Applies 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.ESLintAutofix
mod run . --recipe=org.openrewrite.javascript.cleanup.ESLintAutofix

Install 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.

  1. Require let or const instead of var
  2. Require const declarations for variables that are never reassigned after declared
  3. Disallow initializing variables to undefined
  4. Enforce consistent brace style for all control statements
  5. Disallow else blocks after return statements in if statements
  6. Disallow if statements as the only statement in else blocks
  7. Remove unused labels
  8. Disallow unnecessary labels
  9. Disallow redundant return statements
  10. Require the use of === and !==
  11. Disallow "Yoda" conditions
  12. Disallow ternary operators when simpler alternatives exist
  13. Disallow unnecessary boolean casts
  14. Disallow shorthand type conversions
  15. Use operator-assignment shorthand where possible
  16. Use logical assignment operator shorthand
  17. Enforce dot notation whenever possible
  18. Require object literal shorthand syntax
  19. Disallow unnecessary computed property keys in objects and classes
  20. Disallow renaming import, export, and destructured assignments to the same name
  21. Require destructuring from arrays and/or objects
  22. Use object spread instead of Object.assign with an object literal first argument
  23. Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
  24. Disallow unnecessary calls to .bind()
  25. Require using arrow functions for callbacks
  26. Omit braces around arrow function bodies containing only a return
  27. Require template literals instead of string concatenation
  28. Disallow parseInt() in favor of binary, octal, and hexadecimal literals
  29. Disallow the use of Math.pow in favor of the ** operator
  30. Disallow Array constructors
  31. Disallow multiple spaces in regular expressions