Skip to content

VBC-005: use-var

error

Category: core
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .astro
Scope: source code only, ignoring anything inside strings and comments
Tags: best-practice

What it reports

Use of 'var' detected at line {line}. Use 'let' or 'const' instead.

Flagged

js
var total = 0;

Not flagged

js
  font-family: var(--font-serif);
js
  width: calc(100% - var(--gap));
js
const total = 0;
js
let total = 0;
ts
declare var sampleRate: number;

Pattern

regex
(?<!\bdeclare\s{1,4})\bvar\b(?!\s*\()

Released under the MIT License.