summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/curly.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-07-07 15:44:32 -0700
committerRich Trott <rtrott@gmail.com>2016-07-11 13:47:20 -0700
commite8a7003e940928e2d1684c12881dd2a39af2d7cc (patch)
tree92264eb4c317b287366e7774f6d4e15000856e06 /tools/eslint/lib/rules/curly.js
parentfcae5e2d9187b4a9c16cbce843c10e2087990946 (diff)
downloadnode-new-e8a7003e940928e2d1684c12881dd2a39af2d7cc.tar.gz
tools: update ESLint, fix unused vars bug
Update ESLint to 3.0.0. This includes an enhancement to `no-unused-vars` such that it finds a few instances in our code base that it did not find previously (fixed in previous commits readying this for landing). PR-URL: https://github.com/nodejs/node/pull/7601 Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'tools/eslint/lib/rules/curly.js')
-rw-r--r--tools/eslint/lib/rules/curly.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/eslint/lib/rules/curly.js b/tools/eslint/lib/rules/curly.js
index 0bc5fdb3de..257366fabe 100644
--- a/tools/eslint/lib/rules/curly.js
+++ b/tools/eslint/lib/rules/curly.js
@@ -58,6 +58,8 @@ module.exports = {
var multiOrNest = (context.options[0] === "multi-or-nest");
var consistent = (context.options[1] === "consistent");
+ var sourceCode = context.getSourceCode();
+
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
@@ -69,8 +71,8 @@ module.exports = {
* @private
*/
function isCollapsedOneLiner(node) {
- var before = context.getTokenBefore(node),
- last = context.getLastToken(node);
+ var before = sourceCode.getTokenBefore(node),
+ last = sourceCode.getLastToken(node);
return before.loc.start.line === last.loc.end.line;
}
@@ -82,8 +84,8 @@ module.exports = {
* @private
*/
function isOneLiner(node) {
- var first = context.getFirstToken(node),
- last = context.getLastToken(node);
+ var first = sourceCode.getFirstToken(node),
+ last = sourceCode.getLastToken(node);
return first.loc.start.line === last.loc.end.line;
}
@@ -94,7 +96,6 @@ module.exports = {
* @returns {Token} The `else` keyword token.
*/
function getElseKeyword(node) {
- var sourceCode = context.getSourceCode();
var token = sourceCode.getTokenAfter(node.consequent);
while (token.type !== "Keyword" || token.value !== "else") {