Skip to content

VBC-051: mixed-casing

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 style

What it reports

snake_case and camelCase mixed at line {line}. Pick one convention per file. Object keys are not reported: a wire format often dictates those names.

Flagged

js
const user_name = userName;

Not flagged

js
const userName = firstName;
js
max_tokens: Math.min(maxTokens, 1024),
js
const body = { used_tokens: usedTokens };

Pattern

regex
((?<![.'\"])\b[a-z]+_[a-z]+\b(?!\s*[:?]).{0,400}?\b[a-z]+[A-Z][a-z]+\b)|(\b[a-z]+[A-Z][a-z]+\b.{0,400}?(?<![.'\"])\b[a-z]+_[a-z]+\b(?!\s*[:?]))

Released under the MIT License.