Skip to content

symbolDescriptions

Reports Symbol() calls without description arguments.

✅ This rule is included in the ts stylistic preset.

Creating symbols without descriptions makes debugging difficult, as the symbol’s purpose isn’t clear when inspecting it. While the description doesn’t affect the symbol’s uniqueness, it appears in the symbol’s string representation and can be accessed via Symbol.prototype.description. Providing meaningful descriptions helps developers understand the purpose of each symbol during debugging and logging.

const uniqueId = Symbol();
const privateKey = Symbol();
class MyClass {
[Symbol()]() {
return "method";
}
}

This rule is not configurable.

If you’re working in a codebase where symbol descriptions aren’t important for debugging purposes, or if you dynamically create many anonymous symbols, you might choose to disable this rule.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.