Skip to content

Commit

Permalink
docs: mention about exported comment
Browse files Browse the repository at this point in the history
docs: add correct example
  • Loading branch information
sosukesuzuki committed Sep 23, 2022
1 parent 91fe194 commit 313a17b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/src/rules/no-implicit-globals.md
Expand Up @@ -5,6 +5,7 @@ rule_type: suggestion
related_rules:
- no-undef
- no-global-assign
- no-unused-vars
further_reading:
- https://benalman.com/news/2010/11/immediately-invoked-function-expression/
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Undeclared_var
Expand Down Expand Up @@ -255,6 +256,20 @@ window.MyGlobalFunction = (function() {

:::

### exported

You can use `/* exported variableName */` block comments in the same way as in [`no-unused-vars`](./no-unused-vars). See the [`no-unused-vars` exported section](./no-unused-vars#exported) for details.

Examples of **correct** code for `/* exported variableName */` operation:

::: correct

```js
/* exported global_var */

var global_var = 42;
```

## When Not To Use It

In the case of a browser script, if you want to be able to explicitly declare variables and functions in the global scope,
Expand Down

0 comments on commit 313a17b

Please sign in to comment.