Disallow unnecessary boolean casts

Proprietary

Removes redundant double negation (!!) and Boolean() calls in contexts where the value is already coerced to a boolean, such as if/while/do-while/for tests, ternary conditions, operands of !, and arguments of Boolean(). A zero-argument Boolean() in such a context is replaced by its constant value. Replicates the autofix of the ESLint rule no-extra-boolean-cast under its default options.

org.openrewrite.javascript.cleanup.NoExtraBooleanCast
mod run . --recipe=org.openrewrite.javascript.cleanup.NoExtraBooleanCast

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.