跳转到内容

noUndeclaredVariables

Diagnostic Category: lint/correctness/noUndeclaredVariables

Since: v1.0.0 Sources:

Prevents the usage of variables that haven’t been declared inside the document.

If you need to allow-list some global bindings, you can use the javascript.globals configuration.

foobar;
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.

// throw diagnostic for JavaScript files
PromiseLike;
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.

type B<T> = PromiseLike<T>