diff --git a/.eslintrc.js b/.eslintrc.js index 2c8a11c26c3..79407c08654 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -116,6 +116,7 @@ module.exports = { 'sonarjs/no-unused-collection': 'error', 'sonarjs/no-extra-arguments': 'error', 'unicorn/no-useless-undefined': 'error', + 'no-var': 'error', // Strict Mode (http://eslint.org/docs/rules/#strict-mode) strict: 0, diff --git a/packages/graphiql/resources/renderExample.js b/packages/graphiql/resources/renderExample.js index 530795cfd24..011cc0dae0f 100644 --- a/packages/graphiql/resources/renderExample.js +++ b/packages/graphiql/resources/renderExample.js @@ -13,9 +13,9 @@ */ // Parse the search string to get url parameters. -var parameters = {}; +const parameters = {}; for (const entry of window.location.search.slice(1).split('&')) { - var eq = entry.indexOf('='); + const eq = entry.indexOf('='); if (eq >= 0) { parameters[decodeURIComponent(entry.slice(0, eq))] = decodeURIComponent( entry.slice(eq + 1), @@ -49,7 +49,7 @@ function onTabChange(tabsState) { } function updateURL() { - var newSearch = + const newSearch = '?' + Object.keys(parameters) .filter(function (key) {