From d117b3e0f9ab297b8868d258f141a362745c8371 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Fri, 6 Jan 2017 10:03:46 +0100 Subject: [PATCH] Eslint upgrade to 19.0.0 and configuration fixes (#1294) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original PR by @travnels, commit-message edited by @nknapp * Upgraded eslint to 19.0.0 * Cleaned up duplicate rules 'no-extra-parens', 'quote-props' * eslint rule 'no-empty-label' was replaced. Rule 'no-empty-label' was removed and replaced by: ‘no-labels’. ‘no-labels’ already in the project * eslint rule 'space-after-keywords' has been replaced Rules 'space-after-keywords' and 'space-return-throw-case' wer removed and replaced by ‘keyword-spacing’. * Added parsoer-option: sourceType='module' * Add unnecessary=false to 'quote-props' to remove warnings about unnecessarily quoted property. Code corrections * helpers.js: unused variable 'depthString' removed, detected by new eslint --- .eslintrc | 11 +++++------ lib/handlebars/compiler/helpers.js | 4 +--- package.json | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.eslintrc b/.eslintrc index 8cd3bd6f..b8cdd194 100644 --- a/.eslintrc +++ b/.eslintrc @@ -43,7 +43,6 @@ "no-empty-character-class": 2, "no-ex-assign": 2, "no-extra-boolean-cast": 2, - "no-extra-parens": 0, "no-extra-semi": 2, "no-func-assign": 0, @@ -55,7 +54,7 @@ "no-negated-in-lhs": 2, "no-obj-calls": 2, "no-regex-spaces": 2, - "quote-props": [2, "as-needed", {"keywords": true}], + "quote-props": [2, "as-needed", {"keywords": true, "unnecessary": false}], "no-sparse-arrays": 0, // Optimizer and coverage will handle/highlight this and can be useful for debugging @@ -80,7 +79,6 @@ "no-caller": 2, "no-div-regex": 1, "no-else-return": 0, - "no-empty-label": 2, "no-eq-null": 0, "no-eval": 2, "no-extend-native": 2, @@ -179,22 +177,23 @@ "one-var": 0, "operator-assignment": 0, "padded-blocks": 0, - "quote-props": 0, "quotes": [2, "single", "avoid-escape"], "semi": 2, "semi-spacing": [2, {"before": false, "after": true}], "sort-vars": 0, - "space-after-keywords": [2, "always"], + "keyword-spacing": 2, "space-before-blocks": [2, "always"], "space-before-function-paren": [2, {"anonymous": "never", "named": "never"}], "space-in-brackets": 0, "space-in-parens": [2, "never"], "space-infix-ops": 2, - "space-return-throw-case": 2, "space-unary-ops": 2, "spaced-comment": [2, "always", {"markers": [","]}], "wrap-regex": 1, "no-var": 1 + }, + "parserOptions": { + "sourceType": "module" } } \ No newline at end of file diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js index e09a08df..3c1a38fa 100644 --- a/lib/handlebars/compiler/helpers.js +++ b/lib/handlebars/compiler/helpers.js @@ -47,8 +47,7 @@ export function preparePath(data, parts, loc) { let original = data ? '@' : '', dig = [], - depth = 0, - depthString = ''; + depth = 0; for (let i = 0, l = parts.length; i < l; i++) { let part = parts[i].part, @@ -62,7 +61,6 @@ export function preparePath(data, parts, loc) { throw new Exception('Invalid path: ' + original, {loc}); } else if (part === '..') { depth++; - depthString += '../'; } } else { dig.push(part); diff --git a/package.json b/package.json index 68ad01ba..29fab88e 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "grunt-contrib-copy": "0.x", "grunt-contrib-uglify": "0.x", "grunt-contrib-watch": "0.x", - "grunt-eslint": "^17.1.0", + "grunt-eslint": "19.0.x", "grunt-saucelabs": "8.x", "grunt-webpack": "^1.0.8", "istanbul": "kpdecker/istanbul",