Skip to main content

js/noSingleVarDeclarator

MISSING DOCUMENTATION

ESLint Equivalent: one-var

Examples

Invalid

let foo, bar;

 file.ts:1 lint/js/useSingleVarDeclarator  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━

  Declare variables separately.

    let foo, bar;
    ^^^^^^^^^^^^^

  Safe fix

    1  - let·foo,·bar;
      1+ let·foo;
      2+ let·bar;

Valid

for (let i = 0, x = 1; i < arr.length; i++) {}