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: clarify variables option in no-use-before-define (fixes #12986) #13017

Merged
merged 6 commits into from Mar 23, 2020
Merged
10 changes: 8 additions & 2 deletions docs/rules/no-use-before-define.md
Expand Up @@ -76,13 +76,13 @@ function g() {
Class declarations are not hoisted, so it might be danger.
Default is `true`.
* `variables` (`boolean`) -
This flag determines whether or not the rule checks variable declarations in upper scopes.
This flag determines whether or not the rule checks variable and function (arrow functions) declarations in upper scopes.
anikethsaha marked this conversation as resolved.
Show resolved Hide resolved
If this is `true`, the rule warns every reference to a variable before the variable declaration.
Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration.
Default is `true`.

This rule accepts `"nofunc"` string as an option.
`"nofunc"` is the same as `{ "functions": false, "classes": true }`.
`"nofunc"` is the same as `{ "functions": false }`.
anikethsaha marked this conversation as resolved.
Show resolved Hide resolved

### functions

Expand Down Expand Up @@ -143,4 +143,10 @@ function baz() {
}

var foo = 1;


const a = () => b(); // ok

const b = () => {};

anikethsaha marked this conversation as resolved.
Show resolved Hide resolved
```