Skip to content

no-shorthand-names

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

By default, the rule replaces these shorthands:

ShorthandReplacement
argsparameters
charcharacter
dtdeltaTime
plrplayer

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;
OptionTypeDefaultNotes
allowPropertyAccessstring[]["char"]Allowed on member access like obj.char and type qualified names like React.PropsWithoutRef.
ignoreShorthandsstring[][]Shorthands or identifier patterns to skip completely. Supports exact values, globs, and /regex/flags.
shorthandsRecord<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 "eslint-plugin-cease-nonsense";
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",
},
},
],
},
},
];