Skip to content

VBC-052: single-letter-variables

warning

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

What it reports

Single-letter variable name detected at line {line}. Use more descriptive names.

Flagged

js
const p = loadProfile();

Not flagged

js
const profile = loadProfile();
js
for (const i of items) { use(i); }

Pattern

regex
\b(?:let|const|var)\s+(?!(?:i|j|k|n|x|y|z|e|t|_)\b)[a-z]\b

Released under the MIT License.