no-shorthand-names
errorSuggestion
Reports identifiers that use configured shorthand words instead of fuller names.
Rule details Suggestion
Section titled “Rule details Suggestion ”By default, the rule replaces these shorthands:
| Shorthand | Replacement |
|---|---|
args |
parameters |
char |
character |
dt |
deltaTime |
plr |
player |
The rule also checks shorthand words inside larger identifiers, so playerData is fine but plrData is reported.
Identifiers are split at camelCase and number boundaries.
There is one special case: const plr = Players.LocalPlayer reports localPlayer instead of player.
Examples
Section titled “Examples”Incorrect
Shorthand names
Section titled “Shorthand names”const plr = getPlayer();const dt = 0.016;const plrData = loadProfile();const { args } = options;Correct
Full names
Section titled “Full names”const player = getPlayer();const deltaTime = 0.016;const playerData = loadProfile();const model = entity.char;Options
Section titled “Options”| Option | Type | Default | Notes |
|---|---|---|---|
allowPropertyAccess |
string[] |
["char"] |
Allowed on member access like obj.char and type qualified names like React.PropsWithoutRef. |
ignoreShorthands |
string[] |
[] |
Shorthands or identifier patterns to skip completely. Supports exact values, globs, and /regex/flags. |
shorthands |
Record<string, string> |
{ args: "parameters", char: "character", dt: "deltaTime", plr: "player" } |
Adds to, and can override, the default replacement map. Supports exact values, globs, and /regex/flags. |
import ceaseNonsense from "@pobammer-ts/eslint-cease-nonsense-rules";
export default [ { plugins: { "cease-nonsense": ceaseNonsense, }, rules: { "cease-nonsense/no-shorthand-names": [ "error", { allowPropertyAccess: ["char", "PropsWithoutRef"], ignoreShorthands: ["ComponentProps", "*Props"], shorthands: { ctx: "context", "*Btn*": "*Button*", "/^str(.*)$/": "string$1", }, }, ], }, },];Related rules
Section titled “Related rules”prevent-abbreviationsCatches a broader set of abbreviations
naming-conventionApplies naming style rules on top of word choice
