useSymbolDescription
Summary
Section titled “Summary”- Rule available since:
v2.0.0
- Diagnostic Category:
lint/nursery/useSymbolDescription
- This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
symbol-description
- Same as
Description
Section titled “Description”Require a description parameter for the Symbol()
.
Symbol
can have an optional description parameter which can be useful for
debugging and making the purpose of the symbol clearer.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”Symbol();
code-block.js:1:7 lint/nursery/useSymbolDescription ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Symbol() is missing a description parameter.
> 1 │ Symbol();
│ ^^
2 │
ℹ Add explicit description which can be useful in debugging and making the purpose of the symbol clearer.
Symbol('');
code-block.js:1:7 lint/nursery/useSymbolDescription ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Symbol() is missing a description parameter.
> 1 │ Symbol(”);
│ ^^^^
2 │
ℹ Add explicit description which can be useful in debugging and making the purpose of the symbol clearer.
Symbol(``);
code-block.js:1:8 lint/nursery/useSymbolDescription ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Symbol() is missing a description parameter.
> 1 │ Symbol(“);
│ ^^^^
2 │
ℹ Add explicit description which can be useful in debugging and making the purpose of the symbol clearer.
Symbol('description');
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useSymbolDescription": "error" } } }}