Skip to content

useSymbolDescription

¥Summary

¥How to configure

biome.json
{
"linter": {
"rules": {
"style": {
"useSymbolDescription": "error"
}
}
}
}

¥Description

要求 Symbol() 指令包含描述参数。

¥Require a description parameter for the Symbol().

Symbol 可以有一个可选的描述参数,这有助于调试并更清晰地说明符号的用途。

¥Symbol can have an optional description parameter which can be useful for debugging and making the purpose of the symbol clearer.

¥Examples

¥Invalid

Symbol();
code-block.js:1:7 lint/style/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/style/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/style/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.

¥Valid

Symbol('description');

¥Related links