Skip to content

Commit

Permalink
docs: explicitly state why globals is necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
mlwyatt committed Apr 24, 2023
1 parent 0af67d3 commit 628f76c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/src/use/configure/configuration-files-new.md
Expand Up @@ -328,9 +328,9 @@ export default [

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.

#### Using native globals variables
##### Predefined global variables

To enable native variables, like `console` (browser) or `$` (jQuery), you must use the `globals` package directly. For example, here is how you can add `console`, amongst other browser globals, into your configuration.
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` 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.

```js
import globals from "globals";
Expand All @@ -339,7 +339,7 @@ export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.browser
}
}
}
Expand Down

0 comments on commit 628f76c

Please sign in to comment.