Disallow if statements as the only statement in else blocks
ProprietaryCollapses an else block that contains nothing but an if statement into an else if. For example, else { if (b) { g(); } } becomes else if (b) { g(); }. Unlike ESLint, it also leaves an else alone where the last statement of the inner if's chained else would run into the following token, which ESLint's fix splices into code that no longer parses or means something else. Replicates the autofix of the ESLint rule no-lonely-if under its default options.
io. moderne. javascript. cleanup. NoLonelyIfmod run . --recipe= io. moderne. javascript. cleanup. NoLonelyIfInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.