From d70263ced8486bd3085a6bb30862adb9fe9b2a47 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 4 Nov 2017 13:50:58 +0100 Subject: [PATCH] Enable the `no-var` ESLint rule in the `/web` folder https://eslint.org/docs/rules/no-var Please note that two files were excluded: 1. `web/debugger.js`, since there's code in other files that currently depend on the global availability of code in `web/debugger.js`. Furthermore, since that file isn't used in production, doing a ES6 conversion probably isn't a priority. 2. `web/grab_to_pan.js`, since that file could be considered to be "external" code. We have made smaller changes to that file over the years, however doing a full ES6 `class` conversion might be a step too far!? --- .eslintrc | 1 + web/.eslintrc | 10 ++++++++++ web/debugger.js | 1 + web/grab_to_pan.js | 1 + 4 files changed, 13 insertions(+) create mode 100644 web/.eslintrc diff --git a/.eslintrc b/.eslintrc index 2fdfde807..03de9c912 100644 --- a/.eslintrc +++ b/.eslintrc @@ -166,6 +166,7 @@ "no-useless-computed-key": "error", "no-useless-constructor": "error", "no-useless-rename": "error", + "no-var": "off", "object-shorthand": ["error", "always", { "avoidQuotes": true, }], diff --git a/web/.eslintrc b/web/.eslintrc new file mode 100644 index 000000000..1c31729d5 --- /dev/null +++ b/web/.eslintrc @@ -0,0 +1,10 @@ +{ + "extends": [ + ../.eslintrc + ], + + "rules": { + // ECMAScript 6 + "no-var": "error", + }, +} diff --git a/web/debugger.js b/web/debugger.js index 925c32faf..72e9e1e05 100644 --- a/web/debugger.js +++ b/web/debugger.js @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* eslint-disable no-var */ 'use strict'; diff --git a/web/grab_to_pan.js b/web/grab_to_pan.js index 0fd24cbf8..6b18a0d89 100644 --- a/web/grab_to_pan.js +++ b/web/grab_to_pan.js @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* eslint-disable no-var */ /** * Construct a GrabToPan instance for a given HTML element.