Nucleus handler tools › Docs › Checks

The same case twice

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

Why it matters

Only the first of two identical cases ever runs.

Example

✗ Wrong

var m = "a";
switch (m) {
  case "a": break;
  case "a": break;
}

✓ Right

var m = "a";
switch (m) {
  case "a": break;
  case "b": break;
}

How to fix it

Remove the second case or test another value.

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