Skip to content

Prevent Abbreviations

SuggestionAuto-fixable
small-rules/prevent-abbreviations

Prevent abbreviations.

Diagnostic Messages

replace
The {{nameTypeText}} `{{discouragedName}}` should be named `{{replacement}}`. A more descriptive name will do too.
suggestion
Please rename the {{nameTypeText}} `{{discouragedName}}`. Suggested names are: {{replacementsText}}. A more descriptive name will do too.

Configuration

This rule accepts one options object after the severity.

allowListOptional

Names that should be allowed even when they match a discouraged abbreviation.

allowPropertyAccessOptional

Property names that may keep abbreviated member access.

checkDefaultAndNamespaceImportsOptional

Whether default and namespace import local names should be checked.

checkFilenamesOptional

Whether file names should be checked for abbreviations.

checkPropertiesOptional

Whether object, member, and JSX property names should be checked.

checkShorthandImportsOptional

Whether renamed shorthand imports should be checked.

checkShorthandPropertiesOptional

Whether shorthand object property names should be checked.

checkVariablesOptional

Whether variable, function, class, and component names should be checked.

extendDefaultAllowListOptional

Merge configured allowList entries with the default allow list.

extendDefaultReplacementsOptional

Merge configured replacements with the default replacement map.

ignoreOptional

Names or regular expression patterns that should be ignored.

ignoreShorthandsOptional

Shorthand names that should not be reported.

replacementsOptional

Replacement suggestions for discouraged names.

shorthandsOptional

Shorthand names and the full names they should expand to.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/prevent-abbreviations": "error"
}
}

Examples

Abbreviated variable names
const err = new Error();

After auto-fix

const error = new Error();
Expanded variable names
const error = new Error();