From b072df82e87dfd9bbcaa2c3655d39df962799d34 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 8 Jan 2021 04:02:25 +0200 Subject: [PATCH] ESLint: enable `block-scoped-var` rule (#1631) --- .eslintrc.json | 5 +++-- lib/api/attributes.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index b552961207..e86d7b0dfe 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,13 +13,14 @@ "globals": { "Set": true, "Symbol": true }, "rules": { "array-callback-return": [ - "error", + 2, { "allowImplicit": true } ], + "block-scoped-var": 2, "eqeqeq": [ - "error", + 2, "always", { "null": "ignore" diff --git a/lib/api/attributes.js b/lib/api/attributes.js index 62bfcacaff..caed49116f 100644 --- a/lib/api/attributes.js +++ b/lib/api/attributes.js @@ -266,6 +266,7 @@ function readData(el, name) { var readAll = arguments.length === 1; var domNames; var jsNames; + var value; if (readAll) { domNames = Object.keys(el.attribs).filter(function (attrName) { @@ -282,7 +283,6 @@ function readData(el, name) { for (var idx = 0; idx < domNames.length; ++idx) { var domName = domNames[idx]; var jsName = jsNames[idx]; - var value; if (hasOwn.call(el.attribs, domName) && !hasOwn.call(el.data, jsName)) { value = el.attribs[domName];