no-use-before-define triggers for variables defined below a function even if variable will be defined when a function using that variable is called.
See original GitHub issueWhat version of ESLint are you using? 2.12.0
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration: https://github.com/AriaFallah/eslint-config-aria/blob/master/index.js
Specific line:
"no-use-before-define": [2, "nofunc"]
What did you do? Please include the actual source code causing the issue.
function x() {
return myFunc()
}
const myFunc = function() {
return 5
}
console.log(x())
What did you expect to happen?
No errors. This doesn’t result in myFunc
is undefined in console because the function is not called before myFunc is defined.
What actually happened? Please include the actual, raw output from ESLint.
error 'myFunc' was used before it was defined no-use-before-define
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
no-use-before-define - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >ESLint no-use-before-define - javascript - Stack Overflow
This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference...
Read more >Chapter 4. Variables, Functions, and Flow Control - O'Reilly
If you have defined a global variable with the same name, the function's assignment statement overwrites the value originally assigned to the global...
Read more >React Native development tools - Part 1: Linting tools - Pusher
no-use-before-define is a default rule implemented by ESLint. This rule prevents you from using variables that haven't previously been defined yet. In React ......
Read more >Documentation: 15: 43.10. Trigger Functions - PostgreSQL
PL/pgSQL can be used to define trigger functions on data changes or database ... variable holding the new database row for INSERT /...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vsemozhetbyt
Right, but that’s only if they’re in the same function scope. If you run the example code I provided in the babel REPL, you’ll get:
I see.