Skip to content

no-shorthand-names

errorSuggestion

Reports identifiers that use configured shorthand words instead of fuller names.

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.

Incorrect
const plr = getPlayer();
const dt = 0.016;
const plrData = loadProfile();
const { args } = options;
Correct
const player = getPlayer();
const deltaTime = 0.016;
const playerData = loadProfile();
const model = entity.char;
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",
},
},
],
},
},
];