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. A Boolean call is left unchanged where a binding in scope shadows the global Boolean. Replicates the autofix of the ESLint rule no-extra-boolean-cast under its default options.

io.moderne.javascript.cleanup.NoExtraBooleanCast
mod run . --recipe=io.moderne.javascript.cleanup.NoExtraBooleanCast

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