Skip to content

Commit 85d2b30

Browse files
authored
docs: explain how to include predefined globals (#17261)
1 parent de4d3c1 commit 85d2b30

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/src/use/configure/configuration-files-new.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,23 @@ export default [
347347

348348
For historical reasons, the boolean value `false` and the string value `"readable"` are equivalent to `"readonly"`. Similarly, the boolean value `true` and the string value `"writeable"` are equivalent to `"writable"`. However, the use of older values is deprecated.
349349

350+
##### Predefined global variables
351+
352+
Apart from the ECMAScript standard built-in globals, which are automatically enabled based on the configured `languageOptions.ecmaVersion`, ESLint doesn't provide predefined sets of global variables. You can use the [`globals`](https://www.npmjs.com/package/globals) package to additionally enable all globals for a specific environment. For example, here is how you can add `console`, amongst other browser globals, into your configuration.
353+
354+
```js
355+
import globals from "globals";
356+
export default [
357+
{
358+
languageOptions: {
359+
globals: {
360+
...globals.browser
361+
}
362+
}
363+
}
364+
];
365+
```
366+
350367
### Using plugins in your configuration
351368

352369
Plugins are used to share rules, processors, configurations, parsers, and more across ESLint projects.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy