From 91b9608ab1b07a888ecf2019b559806fa0d8403e Mon Sep 17 00:00:00 2001 From: Diana Whitten Date: Thu, 27 Aug 2015 17:00:44 -0700 Subject: [PATCH] Enable no-use-before-define Disallow Early Use (no-use-before-define) In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them. In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration. http://eslint.org/docs/rules/no-use-before-define Change-Id: Ia905b77e0938ac3e0279712bc6e5ccdb18a102e7 --- .eslintrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index 94a5b12..b2513ad 100644 --- a/.eslintrc +++ b/.eslintrc @@ -465,7 +465,9 @@ rules: # Disallow use of variables before they are defined # http://eslint.org/docs/rules/no-use-before-define - no-use-before-define: 0 # TODO(krotscheck): Discuss & Activate + no-use-before-define: + - 2 + - "nofunc" ############################################################################# # Node.js rules