Nucleus handler tools › Docs › Checks

A loop that counts the wrong way

Warningfor-directionA general JavaScript mistake (ESLint's for-direction) · Probably wrong: Nucleus runs it, but not the way you meant.

Why it matters

The counter moves away from the end condition, so the loop never stops (or never runs).

Example

✗ Wrong

for (var i = 0; i < 4; i--) {
}

✓ Right

for (var i = 0; i < 4; i++) {
}

How to fix it

Count towards the end condition (i++ with <).

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": { "for-direction": "off" } in your settings. Notepad++: Plugins › Nucleus Co-op handlers › Settings. Command line: ncdev lint --rule for-direction=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