Nucleus handler tools › Docs › Checks

An assignment where a comparison was meant?

Warningno-cond-assignA general JavaScript mistake (ESLint's no-cond-assign) · Probably wrong: Nucleus runs it, but not the way you meant.

Why it matters

A single = inside a condition assigns: the condition is the assigned value. To compare, write == (or ===).

Example

✗ Wrong

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

✓ Right

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

How to fix it

Use == (or ===) to compare.

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