Skip to main content

js/noVar

require let or const instead of var

ESLint Equivalent: no-var

Examples

Invalid

var foobar;
foobar

 file.ts:1 lint/js/noVar ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  Variable declarations using var are disallowed.

  > 1var foobar;
     ^^^^^^^^^^^
    2foobar

  Use let or const instead.