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
19 changes: 17 additions & 2 deletions docs/rules/no-use-before-define.md
Expand Up @@ -82,7 +82,7 @@ function g() {
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 @@ -131,6 +131,13 @@ Examples of **incorrect** code for the `{ "variables": false }` option:

console.log(foo);
var foo = 1;

f();
const f = () => {};

function a(){ return b() };
const c = () => b()
function b(){ }
anikethsaha marked this conversation as resolved.
Show resolved Hide resolved
```

Examples of **correct** code for the `{ "variables": false }` option:
Expand All @@ -141,6 +148,14 @@ Examples of **correct** code for the `{ "variables": false }` option:
function baz() {
console.log(foo);
}

var foo = 1;

const a = () => f();
function b() { return f(); }
const c = function() { return f(); }
const f = () => {};

const e = function() { return g(); }
const g = function() {}
```