noUndeclaredVariables
诊断类别:lint/correctness/noUndeclaredVariables
¥Diagnostic Category: lint/correctness/noUndeclaredVariables
自从:v1.0.0
来源:
¥Since: v1.0.0
Sources:
防止使用文档中未声明的变量。
¥Prevents the usage of variables that haven’t been declared inside the document.
如果你需要允许列出某些全局绑定,则可以使用 javascript.globals
配置。
¥If you need to allow-list some global bindings, you can use the javascript.globals
configuration.
¥Examples
¥Invalid
code-block.js:1:1 lint/correctness/noUndeclaredVariables ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ The foobar variable is undeclared.
> 1 │ foobar;
│ ^^^^^^
2 │
ℹ By default, Biome recognizes browser and Node.js globals.
You can ignore more globals using the javascript.globals configuration.
code-block.js:2:1 lint/correctness/noUndeclaredVariables ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ The PromiseLike variable is undeclared.
1 │ // throw diagnostic for JavaScript files
> 2 │ PromiseLike;
│ ^^^^^^^^^^^
3 │
ℹ By default, Biome recognizes browser and Node.js globals.
You can ignore more globals using the javascript.globals configuration.
¥Valid
¥Related links