Skip to content

Commit

Permalink
docs: Update globals examples (#18805)
Browse files Browse the repository at this point in the history
* docs: Update globals examples

fixes #18803

* Fix example
  • Loading branch information
nzakas authored Aug 23, 2024
1 parent e112642 commit f61f40d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/src/use/configure/language-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,21 @@ export default [
}
];
```

You can include multiple different collections of globals in the same way. The following example includes globals both for web browsers and for [Jest](https://jestjs.io/):

```js
// eslint.config.js
import globals from "globals";

export default [
{
languageOptions: {
globals: {
...globals.browser,
...globals.jest
}
}
}
];
```
2 changes: 2 additions & 0 deletions docs/src/use/configure/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ For example, here's an eslintrc file with language options:
module.exports = {
env: {
browser: true,
node: true
},
globals: {
myCustomGlobal: "readonly",
Expand All @@ -340,6 +341,7 @@ export default [
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
myCustomGlobal: "readonly"
}
}
Expand Down

0 comments on commit f61f40d

Please sign in to comment.