Nucleus handler tools › Docs › Checks

An else-if that can never run

Warningno-dupe-else-ifA general JavaScript mistake (ESLint's no-dupe-else-if) · Probably wrong: Nucleus runs it, but not the way you meant.

Why it matters

This else if tests what an earlier branch already caught, so it never runs.

Example

✗ Wrong

var a = 1;
if (a == 1) {
} else if (a == 1) {
}

✓ Right

var a = 1;
if (a == 1) {
} else if (a == 2) {
}

How to fix it

Test something the earlier branch didn't.

Turn it off, or change how it shows

Each check can be shown as an error, warning, info or hint, or turned off. VS Code: "splitscreenme.lint.rules": { "no-dupe-else-if": "off" } in your settings. Notepad++: Plugins › Nucleus Co-op handlers › Settings. Command line: ncdev lint --rule no-dupe-else-if=off. Other editors: the lint.rules setting of ncdev lsp.

Is this right? Tell us what's wrong
Stuck, or not sure? Ask other handler authors: Discordr/nucleuscoop