Skip to main content

consistent-symbol-description

Require consistent kebab-case Symbol descriptions.

Targeted pattern scopeโ€‹

This rule inspects Symbol("...") calls where the description argument is a string literal.

Descriptions must match this kebab-style character set:

  • lowercase letters (a-z)
  • digits (0-9)
  • hyphen (-)
  • double underscore separator (__)

What this rule reportsโ€‹

This rule reports Symbol(...) descriptions that are not lower-case kebab-case (with optional double-underscore separators).

Why this rule existsโ€‹

Consistent symbol descriptions improve debugging output and cross-module symbol naming hygiene.

โŒ Incorrectโ€‹

const x = Symbol("PascalCase");
const y = Symbol("contains spaces");

โœ… Correctโ€‹

const x = Symbol("kebab-case__kebab-case");

Behavior and migration notesโ€‹

This rule reports only and does not provide an autofix.

Migrate by renaming descriptions to lowercase kebab-style tokens.

Optionsโ€‹

This rule has no options.

Additional examplesโ€‹

const id = Symbol("cache-key__v2");
// โœ… valid

const bad = Symbol("Cache_Key");
// โŒ reported

ESLint flat config exampleโ€‹

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/consistent-symbol-description": "error",
},
},
];

When not to use itโ€‹

Disable this rule if your codebase intentionally allows other naming styles for Symbol descriptions.

Package documentationโ€‹

Rule catalog ID: R010

Further readingโ€‹

Adoption resourcesโ€‹

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.