Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Remove readonly/writable global logic from no-undef (fixes #11963) #12053

Merged
merged 2 commits into from Aug 6, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 5 additions & 18 deletions docs/rules/no-undef.md
Expand Up @@ -11,33 +11,20 @@ Examples of **incorrect** code for this rule:
```js
/*eslint no-undef: "error"*/

var a = someFunction();
b = 10;
var foo = someFunction();
var bar = a + 1;
```

Examples of **correct** code for this rule with `global` declaration:

```js
/*global someFunction b:writable*/
/*global someFunction, a*/
/*eslint no-undef: "error"*/

var a = someFunction();
b = 10;
var foo = someFunction();
var bar = a + 1;
```

The `b:writable` syntax in `/*global */` indicates that assignment to `b` is correct.

Examples of **incorrect** code for this rule with `global` declaration:

```js
/*global b*/
/*eslint no-undef: "error"*/

b = 10;
```

By default, variables declared in `/*global */` are read-only, therefore assignment is incorrect.

## Options

* `typeof` set to true will warn for variables used inside typeof check (Default false).
Expand Down