maestro-server/analytics-front

View on GitHub
docs/graph/main.js

Summary

Maintainability
D
2 days
Test Coverage

File main.js has 574 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require.config({
    paths: {
        bootstrap: './vendor/bootstrap.min',
        diffMatchPatch: './vendor/diff_match_patch.min',
        handlebars: './vendor/handlebars.min',
Severity: Major
Found in docs/graph/main.js - About 1 day to fix

    Function changeVersionCompareTo has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function changeVersionCompareTo(e) {
            e.preventDefault();
    
            var $root = $(this).parents('article');
            var selectedVersion = $(this).html();
    Severity: Major
    Found in docs/graph/main.js - About 2 hrs to fix

      Function add_nav has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function add_nav(nav, content, index) {
              var found_level1 = false;
              if ( ! content) {
                return found_level1;
              }
      Severity: Minor
      Found in docs/graph/main.js - About 1 hr to fix

        Function initDynamic has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function initDynamic() {
                // Bootstrap popover
                $('button[data-toggle="popover"]').popover().click(function(e) {
                    e.preventDefault();
                });
        Severity: Minor
        Found in docs/graph/main.js - About 1 hr to fix

          Use the global form of 'use strict'.
          Open

          require.config({
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require or disallow strict mode directives (strict)

          A strict mode directive is a "use strict" literal at the beginning of a script or function body. It enables strict mode semantics.

          When a directive occurs in global scope, strict mode applies to the entire script:

          "use strict";
          
          // strict mode
          
          function foo() {
              // strict mode
          }

          When a directive occurs at the beginning of a function body, strict mode applies only to that function, including all contained functions:

          function foo() {
              "use strict";
              // strict mode
          }
          
          function foo2() {
              // not strict mode
          };
          
          (function() {
              "use strict";
              function bar() {
                  // strict mode
              }
          }());

          In the CommonJS module system, a hidden function wraps each module and limits the scope of a "global" strict mode directive.

          In ECMAScript modules, which always have strict mode semantics, the directives are unnecessary.

          Rule Details

          This rule requires or disallows strict mode directives.

          This rule disallows strict mode directives, no matter which option is specified, if ESLint configuration specifies either of the following as [parser options](../user-guide/configuring#specifying-parser-options):

          • "sourceType": "module" that is, files are ECMAScript modules
          • "impliedStrict": true property in the ecmaFeatures object

          This rule disallows strict mode directives, no matter which option is specified, in functions with non-simple parameter lists (for example, parameter lists with default parameter values) because that is a syntax error in ECMAScript 2016 and later. See the examples of the function option.

          Options

          This rule has a string option:

          • "safe" (default) corresponds either of the following options:
            • "global" if ESLint considers a file to be a CommonJS module
            • "function" otherwise
          • "global" requires one strict mode directive in the global scope (and disallows any other strict mode directives)
          • "function" requires one strict mode directive in each top-level function declaration or expression (and disallows any other strict mode directives)
          • "never" disallows strict mode directives

          safe

          The "safe" option corresponds to the "global" option if ESLint considers a file to be a Node.js or CommonJS module because the configuration specifies either of the following:

          • node or commonjs [environments](../user-guide/configuring#specifying-environments)
          • "globalReturn": true property in the ecmaFeatures object of [parser options](../user-guide/configuring#specifying-parser-options)

          Otherwise the "safe" option corresponds to the "function" option.

          global

          Examples of incorrect code for this rule with the "global" option:

          /*eslint strict: ["error", "global"]*/
          
          function foo() {
          }
          /*eslint strict: ["error", "global"]*/
          
          function foo() {
              "use strict";
          }
          /*eslint strict: ["error", "global"]*/
          
          "use strict";
          
          function foo() {
              "use strict";
          }

          Examples of correct code for this rule with the "global" option:

          /*eslint strict: ["error", "global"]*/
          
          "use strict";
          
          function foo() {
          }

          function

          This option ensures that all function bodies are strict mode code, while global code is not. Particularly if a build step concatenates multiple scripts, a strict mode directive in global code of one script could unintentionally enable strict mode in another script that was not intended to be strict code.

          Examples of incorrect code for this rule with the "function" option:

          /*eslint strict: ["error", "function"]*/
          
          "use strict";
          
          function foo() {
          }
          /*eslint strict: ["error", "function"]*/
          
          function foo() {
          }
          
          (function() {
              function bar() {
                  "use strict";
              }
          }());
          /*eslint strict: ["error", "function"]*/
          /*eslint-env es6*/
          
          // Illegal "use strict" directive in function with non-simple parameter list.
          // This is a syntax error since ES2016.
          function foo(a = 1) {
              "use strict";
          }
          
          // We cannot write "use strict" directive in this function.
          // So we have to wrap this function with a function with "use strict" directive.
          function foo(a = 1) {
          }

          Examples of correct code for this rule with the "function" option:

          /*eslint strict: ["error", "function"]*/
          
          function foo() {
              "use strict";
          }
          
          (function() {
              "use strict";
          
              function bar() {
              }
          
              function baz(a = 1) {
              }
          }());
          
          var foo = (function() {
              "use strict";
          
              return function foo(a = 1) {
              };
          }());

          never

          Examples of incorrect code for this rule with the "never" option:

          /*eslint strict: ["error", "never"]*/
          
          "use strict";
          
          function foo() {
          }
          /*eslint strict: ["error", "never"]*/
          
          function foo() {
              "use strict";
          }

          Examples of correct code for this rule with the "never" option:

          /*eslint strict: ["error", "never"]*/
          
          function foo() {
          }

          earlier default (removed)

          (removed) The default option (that is, no string option specified) for this rule was removed in ESLint v1.0. The "function" option is most similar to the removed option.

          This option ensures that all functions are executed in strict mode. A strict mode directive must be present in global code or in every top-level function declaration or expression. It does not concern itself with unnecessary strict mode directives in nested functions that are already strict, nor with multiple strict mode directives at the same level.

          Examples of incorrect code for this rule with the earlier default option which has been removed:

          // "strict": "error"
          
          function foo() {
          }
          // "strict": "error"
          
          (function() {
              function bar() {
                  "use strict";
              }
          }());

          Examples of correct code for this rule with the earlier default option which has been removed:

          // "strict": "error"
          
          "use strict";
          
          function foo() {
          }
          // "strict": "error"
          
          function foo() {
              "use strict";
          }
          // "strict": "error"
          
          (function() {
              "use strict";
              function bar() {
                  "use strict";
              }
          }());

          When Not To Use It

          In a codebase that has both strict and non-strict code, either turn this rule off, or selectively disable it where necessary. For example, functions referencing arguments.callee are invalid in strict mode. A full list of strict mode differences is available on MDN. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateArticle        = Handlebars.compile( $('#template-article').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateProject        = Handlebars.compile( $('#template-project').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var description = '';
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var newList = [];
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var titles = [];
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                        var name = (entry_tags ? entry_tags[2] : null);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var found_level1 = add_nav(nav, apiProject.header.content, 0); // Add level 1 and 2 titles
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var articles = [];
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var fields = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var group = $(this).data('group');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var name = $(this).data('name');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var currentVersion = $root.data('version');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                              var parts = element.split(splitBy);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                        var group = (entry_tags ? entry_tags[1] : null);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var $compareToArticle = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + selectedVersion + '\']');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var $foundElement = null;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateGenerator      = Handlebars.compile( $('#template-generator').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var umlauts = { 'ä': 'ae', 'ü': 'ue', 'ö': 'oe', 'ß': 'ss' }; // TODO: remove in version 1.0
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                        var level = entry.substring(2,3);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var fields = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var id = window.location.hash;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var name = $root.data('name');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var entry = sourceEntry;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var $content = $root.next();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateHeader         = Handlebars.compile( $('#template-header').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateFooter         = Handlebars.compile( $('#template-footer').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateCompareArticle = Handlebars.compile( $('#template-compare-article').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var apiGroupTitles = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var oldName = '';
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var fields = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var $root = $(this).parents('article');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var apiGroups = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var version = $('#version strong').html();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var version = $(this).data('version');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var fields = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var api = apiData.api;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var apiVersions = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var found_level1 = false;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var group = $(this).data('group');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var content = templateCompareArticle(fields);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      for (var dot_count = 1; dot_count <= max_dot_count; dot_count++) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                              var parts = item.field.split(".");
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Missing semicolon.
          Open

                          $(window).scrollspy('refresh')
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require or disallow semicolons instead of ASI (semi)

          JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

          var name = "ESLint"
          var website = "eslint.org";

          On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

          In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

          However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

          return
          {
              name: "ESLint"
          };

          This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

          return;
          {
              name: "ESLint";
          }

          Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

          On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

          var globalCounter = { }
          
          (function () {
              var n = 0
              globalCounter.increment = function () {
                  return ++n
              }
          })()

          In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

          Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

          1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
          2. The line is -- or ++ (in which case it will decrement/increment the next token.)
          3. It is a for(), while(), do, if(), or else, and there is no {
          4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

          Rule Details

          This rule enforces consistent use of semicolons.

          Options

          This rule has two options, a string option and an object option.

          String option:

          • "always" (default) requires semicolons at the end of statements
          • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

          Object option:

          • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

          always

          Examples of incorrect code for this rule with the default "always" option:

          /*eslint semi: ["error", "always"]*/
          
          var name = "ESLint"
          
          object.method = function() {
              // ...
          }

          Examples of correct code for this rule with the default "always" option:

          /*eslint semi: "error"*/
          
          var name = "ESLint";
          
          object.method = function() {
              // ...
          };

          never

          Examples of incorrect code for this rule with the "never" option:

          /*eslint semi: ["error", "never"]*/
          
          var name = "ESLint";
          
          object.method = function() {
              // ...
          };

          Examples of correct code for this rule with the "never" option:

          /*eslint semi: ["error", "never"]*/
          
          var name = "ESLint"
          
          object.method = function() {
              // ...
          }
          
          var name = "ESLint"
          
          ;(function() {
              // ...
          })()

          omitLastInOneLineBlock

          Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

          /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
          
          if (foo) { bar() }
          
          if (foo) { bar(); baz() }

          When Not To Use It

          If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

          Further Reading

          Related Rules

          • [no-extra-semi](no-extra-semi.md)
          • [no-unexpected-multiline](no-unexpected-multiline.md)
          • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateSections       = Handlebars.compile( $('#template-sections').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var apiByGroupAndName = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var title = entries[0].title;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                          var name = $(this).data('name');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                          var length = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').length;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var name = '.' + $(this).attr('name') + '-fields';
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var endpointsList = new List('scrollingNav', options);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var templateSidenav        = Handlebars.compile( $('#template-sidenav').html() );
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var articleVersions = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var options = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var currentVersion = $button.find('strong').html();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var compareEntry = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Missing semicolon.
          Open

                      var reversed = fields.slice().reverse()
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require or disallow semicolons instead of ASI (semi)

          JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

          var name = "ESLint"
          var website = "eslint.org";

          On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

          In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

          However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

          return
          {
              name: "ESLint"
          };

          This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

          return;
          {
              name: "ESLint";
          }

          Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

          On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

          var globalCounter = { }
          
          (function () {
              var n = 0
              globalCounter.increment = function () {
                  return ++n
              }
          })()

          In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

          Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

          1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
          2. The line is -- or ++ (in which case it will decrement/increment the next token.)
          3. It is a for(), while(), do, if(), or else, and there is no {
          4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

          Rule Details

          This rule enforces consistent use of semicolons.

          Options

          This rule has two options, a string option and an object option.

          String option:

          • "always" (default) requires semicolons at the end of statements
          • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

          Object option:

          • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

          always

          Examples of incorrect code for this rule with the default "always" option:

          /*eslint semi: ["error", "always"]*/
          
          var name = "ESLint"
          
          object.method = function() {
              // ...
          }

          Examples of correct code for this rule with the default "always" option:

          /*eslint semi: "error"*/
          
          var name = "ESLint";
          
          object.method = function() {
              // ...
          };

          never

          Examples of incorrect code for this rule with the "never" option:

          /*eslint semi: ["error", "never"]*/
          
          var name = "ESLint";
          
          object.method = function() {
              // ...
          };

          Examples of correct code for this rule with the "never" option:

          /*eslint semi: ["error", "never"]*/
          
          var name = "ESLint"
          
          object.method = function() {
              // ...
          }
          
          var name = "ESLint"
          
          ;(function() {
              // ...
          })()

          omitLastInOneLineBlock

          Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

          /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
          
          if (foo) { bar() }
          
          if (foo) { bar(); baz() }

          When Not To Use It

          If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

          Further Reading

          Related Rules

          • [no-extra-semi](no-extra-semi.md)
          • [no-unexpected-multiline](no-unexpected-multiline.md)
          • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var key = values[1];
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var result = false;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var max_dot_count = Math.max.apply(null, reversed.map(function (item) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var apiByGroup = _.groupBy(api, function(entry) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var nav = [];
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var topics = content.match(/<h(1|2).*?>(.+?)<\/h(1|2)>/gi);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var oldName = '';
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var id = $(this).attr('href');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                          var group = $(this).data('group');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var selectedVersion = $(this).html();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var $root = $(this).parents('article');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var sourceEntry = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                              var key = parts[1]; // reference keep for sorting
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var values = name.split('#~#');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var fields = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Missing semicolon.
          Open

                      }))
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require or disallow semicolons instead of ASI (semi)

          JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

          var name = "ESLint"
          var website = "eslint.org";

          On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

          In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

          However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

          return
          {
              name: "ESLint"
          };

          This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

          return;
          {
              name: "ESLint";
          }

          Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

          On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

          var globalCounter = { }
          
          (function () {
              var n = 0
              globalCounter.increment = function () {
                  return ++n
              }
          })()

          In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

          Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

          1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
          2. The line is -- or ++ (in which case it will decrement/increment the next token.)
          3. It is a for(), while(), do, if(), or else, and there is no {
          4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

          Rule Details

          This rule enforces consistent use of semicolons.

          Options

          This rule has two options, a string option and an object option.

          String option:

          • "always" (default) requires semicolons at the end of statements
          • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

          Object option:

          • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

          always

          Examples of incorrect code for this rule with the default "always" option:

          /*eslint semi: ["error", "always"]*/
          
          var name = "ESLint"
          
          object.method = function() {
              // ...
          }

          Examples of correct code for this rule with the default "always" option:

          /*eslint semi: "error"*/
          
          var name = "ESLint";
          
          object.method = function() {
              // ...
          };

          never

          Examples of incorrect code for this rule with the "never" option:

          /*eslint semi: ["error", "never"]*/
          
          var name = "ESLint";
          
          object.method = function() {
              // ...
          };

          Examples of correct code for this rule with the "never" option:

          /*eslint semi: ["error", "never"]*/
          
          var name = "ESLint"
          
          object.method = function() {
              // ...
          }
          
          var name = "ESLint"
          
          ;(function() {
              // ...
          })()

          omitLastInOneLineBlock

          Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

          /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
          
          if (foo) { bar() }
          
          if (foo) { bar(); baz() }

          When Not To Use It

          If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

          Further Reading

          Related Rules

          • [no-extra-semi](no-extra-semi.md)
          • [no-unexpected-multiline](no-unexpected-multiline.md)
          • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var results = [];
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var id = window.location.hash;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var selectedVersion = $(this).html();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var compareVersion = $root.data('compare-version');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                        var title = entry.replace(/<.+?>/g, '');    // Remove all HTML tags for the title
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var content = '';
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var entry = compareEntry;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                                      var prefix = parts.slice(0, parts.length - 1).join(".");
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                                      var prefix_index = fields_names.indexOf(prefix);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var $root = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var content = renderArticle(group, name, version);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var $button = $root.find('.version');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                        var entry_tags = entry.match(/id="api-([^\-]+)(?:-(.+))?"/);    // Find the group and name in the id property
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var last_nav_index = nav.length;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var found_level1 = add_nav(nav, apiProject.footer.content, nav.length); // Add level 1 and 2 titles
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

              var title = apiProject.title ? apiProject.title : 'apiDoc: ' + apiProject.name + ' - ' + apiProject.version;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var title = groupEntry;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                          var index  = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').index($(this));
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var group = $root.data('group');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var version = $root.data('version');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                          var selectVersion = $(this).html();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                      var reversed = fields.slice().reverse()
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                                  var fields_names = fields.map(function (item) { return item.field; });
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var entry = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          Unexpected var, use let or const instead.
          Open

                  var $content = $root.next();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          require let or const instead of var (no-var)

          ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

          var count = people.length;
          var enoughFood = count > sandwiches.length;
          
          if (enoughFood) {
              var count = sandwiches.length; // accidentally overriding the count variable
              console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
          }
          
          // our count variable is no longer accurate
          console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

          Rule Details

          This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

          Examples

          Examples of incorrect code for this rule:

          /*eslint no-var: "error"*/
          
          var x = "y";
          var CONFIG = {};

          Examples of correct code for this rule:

          /*eslint no-var: "error"*/
          /*eslint-env es6*/
          
          let x = "y";
          const CONFIG = {};

          When Not To Use It

          In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

          'nav' is already declared in the upper scope.
          Open

              function add_nav(nav, content, index) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'fields' is already declared in the upper scope.
          Open

              function _hasTypeInFields(fields) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'content' is already declared in the upper scope.
          Open

                  var content = renderArticle(group, name, version);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'fields' is already declared in the upper scope.
          Open

                  var fields = {};
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'content' is already declared in the upper scope.
          Open

                      var content = templateCompareArticle(fields);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'fields' is already declared in the upper scope.
          Open

                  var fields = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'id' is already defined.
          Open

                      var id = window.location.hash;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable redeclaration (no-redeclare)

          In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

          Rule Details

          This rule is aimed at eliminating variables that have multiple declarations in the same scope.

          Examples of incorrect code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          var a = 10;

          Examples of correct code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          // ...
          a = 10;

          Options

          This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

          builtinGlobals

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          
          var Object = 0;

          Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          /*eslint-env browser*/
          
          var top = 0;

          The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

          'title' is already declared in the upper scope.
          Open

                  var title = groupEntry;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'fields' is already defined.
          Open

                  var fields = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable redeclaration (no-redeclare)

          In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

          Rule Details

          This rule is aimed at eliminating variables that have multiple declarations in the same scope.

          Examples of incorrect code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          var a = 10;

          Examples of correct code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          // ...
          a = 10;

          Options

          This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

          builtinGlobals

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          
          var Object = 0;

          Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          /*eslint-env browser*/
          
          var top = 0;

          The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

          'index' is defined but never used.
          Open

                          reversed.forEach(function (item, index) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Unused Variables (no-unused-vars)

          Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

          Rule Details

          This rule is aimed at eliminating unused variables, functions, and parameters of functions.

          A variable is considered to be used if any of the following are true:

          • It represents a function that is called (doSomething())
          • It is read (var y = x)
          • It is passed into a function as an argument (doSomething(x))
          • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

          A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

          Examples of incorrect code for this rule:

          /*eslint no-unused-vars: "error"*/
          /*global some_unused_var*/
          
          // It checks variables you have defined as global
          some_unused_var = 42;
          
          var x;
          
          // Write-only variables are not considered as used.
          var y = 10;
          y = 5;
          
          // A read for a modification of itself is not considered as used.
          var z = 0;
          z = z + 1;
          
          // By default, unused arguments cause warnings.
          (function(foo) {
              return 5;
          })();
          
          // Unused recursive functions also cause warnings.
          function fact(n) {
              if (n < 2) return 1;
              return n * fact(n - 1);
          }
          
          // When a function definition destructures an array, unused entries from the array also cause warnings.
          function getY([x, y]) {
              return y;
          }

          Examples of correct code for this rule:

          /*eslint no-unused-vars: "error"*/
          
          var x = 10;
          alert(x);
          
          // foo is considered used here
          myFunc(function foo() {
              // ...
          }.bind(this));
          
          (function(foo) {
              return foo;
          })();
          
          var myFunc;
          myFunc = setTimeout(function() {
              // myFunc is considered used
              myFunc();
          }, 50);
          
          // Only the second argument from the descructured array is used.
          function getY([, y]) {
              return y;
          }

          exported

          In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

          Note that /* exported */ has no effect for any of the following:

          • when the environment is node or commonjs
          • when parserOptions.sourceType is module
          • when ecmaFeatures.globalReturn is true

          The line comment // exported variableName will not work as exported is not line-specific.

          Examples of correct code for /* exported variableName */ operation:

          /* exported global_var */
          
          var global_var = 42;

          Options

          This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

          By default this rule is enabled with all option for variables and after-used for arguments.

          {
              "rules": {
                  "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
              }
          }

          vars

          The vars option has two settings:

          • all checks all variables for usage, including those in the global scope. This is the default setting.
          • local checks only that locally-declared variables are used but will allow global variables to be unused.

          vars: local

          Examples of correct code for the { "vars": "local" } option:

          /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
          /*global some_unused_var */
          
          some_unused_var = 42;

          varsIgnorePattern

          The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

          Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

          /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
          
          var firstVarIgnored = 1;
          var secondVar = 2;
          console.log(secondVar);

          args

          The args option has three settings:

          • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
          • all - all named arguments must be used.
          • none - do not check arguments.

          args: after-used

          Examples of incorrect code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
          
          // 1 error
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          Examples of correct code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
          
          (function(foo, bar, baz) {
              return baz;
          })();

          args: all

          Examples of incorrect code for the { "args": "all" } option:

          /*eslint no-unused-vars: ["error", { "args": "all" }]*/
          
          // 2 errors
          // "foo" is defined but never used
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          args: none

          Examples of correct code for the { "args": "none" } option:

          /*eslint no-unused-vars: ["error", { "args": "none" }]*/
          
          (function(foo, bar, baz) {
              return bar;
          })();

          ignoreRestSiblings

          The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

          Examples of correct code for the { "ignoreRestSiblings": true } option:

          /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
          // 'type' is ignored because it has a rest property sibling.
          var { type, ...coords } = data;

          argsIgnorePattern

          The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

          Examples of correct code for the { "argsIgnorePattern": "^_" } option:

          /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
          
          function foo(x, _y) {
              return x + 1;
          }
          foo();

          caughtErrors

          The caughtErrors option is used for catch block arguments validation.

          It has two settings:

          • none - do not check error objects. This is the default setting.
          • all - all named arguments must be used.

          caughtErrors: none

          Not specifying this rule is equivalent of assigning it to none.

          Examples of correct code for the { "caughtErrors": "none" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
          
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrors: all

          Examples of incorrect code for the { "caughtErrors": "all" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
          
          // 1 error
          // "err" is defined but never used
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrorsIgnorePattern

          The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

          Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
          
          try {
              //...
          } catch (ignoreErr) {
              console.error("errors");
          }

          When Not To Use It

          If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

          'index' is defined but never used.
          Open

                  $('article[data-version]').each(function(index) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Unused Variables (no-unused-vars)

          Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

          Rule Details

          This rule is aimed at eliminating unused variables, functions, and parameters of functions.

          A variable is considered to be used if any of the following are true:

          • It represents a function that is called (doSomething())
          • It is read (var y = x)
          • It is passed into a function as an argument (doSomething(x))
          • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

          A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

          Examples of incorrect code for this rule:

          /*eslint no-unused-vars: "error"*/
          /*global some_unused_var*/
          
          // It checks variables you have defined as global
          some_unused_var = 42;
          
          var x;
          
          // Write-only variables are not considered as used.
          var y = 10;
          y = 5;
          
          // A read for a modification of itself is not considered as used.
          var z = 0;
          z = z + 1;
          
          // By default, unused arguments cause warnings.
          (function(foo) {
              return 5;
          })();
          
          // Unused recursive functions also cause warnings.
          function fact(n) {
              if (n < 2) return 1;
              return n * fact(n - 1);
          }
          
          // When a function definition destructures an array, unused entries from the array also cause warnings.
          function getY([x, y]) {
              return y;
          }

          Examples of correct code for this rule:

          /*eslint no-unused-vars: "error"*/
          
          var x = 10;
          alert(x);
          
          // foo is considered used here
          myFunc(function foo() {
              // ...
          }.bind(this));
          
          (function(foo) {
              return foo;
          })();
          
          var myFunc;
          myFunc = setTimeout(function() {
              // myFunc is considered used
              myFunc();
          }, 50);
          
          // Only the second argument from the descructured array is used.
          function getY([, y]) {
              return y;
          }

          exported

          In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

          Note that /* exported */ has no effect for any of the following:

          • when the environment is node or commonjs
          • when parserOptions.sourceType is module
          • when ecmaFeatures.globalReturn is true

          The line comment // exported variableName will not work as exported is not line-specific.

          Examples of correct code for /* exported variableName */ operation:

          /* exported global_var */
          
          var global_var = 42;

          Options

          This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

          By default this rule is enabled with all option for variables and after-used for arguments.

          {
              "rules": {
                  "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
              }
          }

          vars

          The vars option has two settings:

          • all checks all variables for usage, including those in the global scope. This is the default setting.
          • local checks only that locally-declared variables are used but will allow global variables to be unused.

          vars: local

          Examples of correct code for the { "vars": "local" } option:

          /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
          /*global some_unused_var */
          
          some_unused_var = 42;

          varsIgnorePattern

          The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

          Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

          /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
          
          var firstVarIgnored = 1;
          var secondVar = 2;
          console.log(secondVar);

          args

          The args option has three settings:

          • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
          • all - all named arguments must be used.
          • none - do not check arguments.

          args: after-used

          Examples of incorrect code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
          
          // 1 error
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          Examples of correct code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
          
          (function(foo, bar, baz) {
              return baz;
          })();

          args: all

          Examples of incorrect code for the { "args": "all" } option:

          /*eslint no-unused-vars: ["error", { "args": "all" }]*/
          
          // 2 errors
          // "foo" is defined but never used
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          args: none

          Examples of correct code for the { "args": "none" } option:

          /*eslint no-unused-vars: ["error", { "args": "none" }]*/
          
          (function(foo, bar, baz) {
              return bar;
          })();

          ignoreRestSiblings

          The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

          Examples of correct code for the { "ignoreRestSiblings": true } option:

          /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
          // 'type' is ignored because it has a rest property sibling.
          var { type, ...coords } = data;

          argsIgnorePattern

          The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

          Examples of correct code for the { "argsIgnorePattern": "^_" } option:

          /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
          
          function foo(x, _y) {
              return x + 1;
          }
          foo();

          caughtErrors

          The caughtErrors option is used for catch block arguments validation.

          It has two settings:

          • none - do not check error objects. This is the default setting.
          • all - all named arguments must be used.

          caughtErrors: none

          Not specifying this rule is equivalent of assigning it to none.

          Examples of correct code for the { "caughtErrors": "none" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
          
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrors: all

          Examples of incorrect code for the { "caughtErrors": "all" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
          
          // 1 error
          // "err" is defined but never used
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrorsIgnorePattern

          The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

          Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
          
          try {
              //...
          } catch (ignoreErr) {
              console.error("errors");
          }

          When Not To Use It

          If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

          'item' is already declared in the upper scope.
          Open

                                  var fields_names = fields.map(function (item) { return item.field; });
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'fields' is already declared in the upper scope.
          Open

              function addArticleSettings(fields, entry) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'found_level1' is already defined.
          Open

                  var found_level1 = add_nav(nav, apiProject.footer.content, nav.length); // Add level 1 and 2 titles
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable redeclaration (no-redeclare)

          In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

          Rule Details

          This rule is aimed at eliminating variables that have multiple declarations in the same scope.

          Examples of incorrect code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          var a = 10;

          Examples of correct code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          // ...
          a = 10;

          Options

          This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

          builtinGlobals

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          
          var Object = 0;

          Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          /*eslint-env browser*/
          
          var top = 0;

          The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

          'e' is defined but never used.
          Open

                  $('.sample-request-switch').click(function (e) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Unused Variables (no-unused-vars)

          Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

          Rule Details

          This rule is aimed at eliminating unused variables, functions, and parameters of functions.

          A variable is considered to be used if any of the following are true:

          • It represents a function that is called (doSomething())
          • It is read (var y = x)
          • It is passed into a function as an argument (doSomething(x))
          • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

          A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

          Examples of incorrect code for this rule:

          /*eslint no-unused-vars: "error"*/
          /*global some_unused_var*/
          
          // It checks variables you have defined as global
          some_unused_var = 42;
          
          var x;
          
          // Write-only variables are not considered as used.
          var y = 10;
          y = 5;
          
          // A read for a modification of itself is not considered as used.
          var z = 0;
          z = z + 1;
          
          // By default, unused arguments cause warnings.
          (function(foo) {
              return 5;
          })();
          
          // Unused recursive functions also cause warnings.
          function fact(n) {
              if (n < 2) return 1;
              return n * fact(n - 1);
          }
          
          // When a function definition destructures an array, unused entries from the array also cause warnings.
          function getY([x, y]) {
              return y;
          }

          Examples of correct code for this rule:

          /*eslint no-unused-vars: "error"*/
          
          var x = 10;
          alert(x);
          
          // foo is considered used here
          myFunc(function foo() {
              // ...
          }.bind(this));
          
          (function(foo) {
              return foo;
          })();
          
          var myFunc;
          myFunc = setTimeout(function() {
              // myFunc is considered used
              myFunc();
          }, 50);
          
          // Only the second argument from the descructured array is used.
          function getY([, y]) {
              return y;
          }

          exported

          In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

          Note that /* exported */ has no effect for any of the following:

          • when the environment is node or commonjs
          • when parserOptions.sourceType is module
          • when ecmaFeatures.globalReturn is true

          The line comment // exported variableName will not work as exported is not line-specific.

          Examples of correct code for /* exported variableName */ operation:

          /* exported global_var */
          
          var global_var = 42;

          Options

          This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

          By default this rule is enabled with all option for variables and after-used for arguments.

          {
              "rules": {
                  "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
              }
          }

          vars

          The vars option has two settings:

          • all checks all variables for usage, including those in the global scope. This is the default setting.
          • local checks only that locally-declared variables are used but will allow global variables to be unused.

          vars: local

          Examples of correct code for the { "vars": "local" } option:

          /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
          /*global some_unused_var */
          
          some_unused_var = 42;

          varsIgnorePattern

          The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

          Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

          /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
          
          var firstVarIgnored = 1;
          var secondVar = 2;
          console.log(secondVar);

          args

          The args option has three settings:

          • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
          • all - all named arguments must be used.
          • none - do not check arguments.

          args: after-used

          Examples of incorrect code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
          
          // 1 error
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          Examples of correct code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
          
          (function(foo, bar, baz) {
              return baz;
          })();

          args: all

          Examples of incorrect code for the { "args": "all" } option:

          /*eslint no-unused-vars: ["error", { "args": "all" }]*/
          
          // 2 errors
          // "foo" is defined but never used
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          args: none

          Examples of correct code for the { "args": "none" } option:

          /*eslint no-unused-vars: ["error", { "args": "none" }]*/
          
          (function(foo, bar, baz) {
              return bar;
          })();

          ignoreRestSiblings

          The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

          Examples of correct code for the { "ignoreRestSiblings": true } option:

          /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
          // 'type' is ignored because it has a rest property sibling.
          var { type, ...coords } = data;

          argsIgnorePattern

          The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

          Examples of correct code for the { "argsIgnorePattern": "^_" } option:

          /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
          
          function foo(x, _y) {
              return x + 1;
          }
          foo();

          caughtErrors

          The caughtErrors option is used for catch block arguments validation.

          It has two settings:

          • none - do not check error objects. This is the default setting.
          • all - all named arguments must be used.

          caughtErrors: none

          Not specifying this rule is equivalent of assigning it to none.

          Examples of correct code for the { "caughtErrors": "none" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
          
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrors: all

          Examples of incorrect code for the { "caughtErrors": "all" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
          
          // 1 error
          // "err" is defined but never used
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrorsIgnorePattern

          The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

          Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
          
          try {
              //...
          } catch (ignoreErr) {
              console.error("errors");
          }

          When Not To Use It

          If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

          'fields' is already declared in the upper scope.
          Open

                  $.each(fields_object, function (key, fields) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          '$compareToArticle' is assigned a value but never used.
          Open

                      var $compareToArticle = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + selectedVersion + '\']');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Unused Variables (no-unused-vars)

          Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

          Rule Details

          This rule is aimed at eliminating unused variables, functions, and parameters of functions.

          A variable is considered to be used if any of the following are true:

          • It represents a function that is called (doSomething())
          • It is read (var y = x)
          • It is passed into a function as an argument (doSomething(x))
          • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

          A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

          Examples of incorrect code for this rule:

          /*eslint no-unused-vars: "error"*/
          /*global some_unused_var*/
          
          // It checks variables you have defined as global
          some_unused_var = 42;
          
          var x;
          
          // Write-only variables are not considered as used.
          var y = 10;
          y = 5;
          
          // A read for a modification of itself is not considered as used.
          var z = 0;
          z = z + 1;
          
          // By default, unused arguments cause warnings.
          (function(foo) {
              return 5;
          })();
          
          // Unused recursive functions also cause warnings.
          function fact(n) {
              if (n < 2) return 1;
              return n * fact(n - 1);
          }
          
          // When a function definition destructures an array, unused entries from the array also cause warnings.
          function getY([x, y]) {
              return y;
          }

          Examples of correct code for this rule:

          /*eslint no-unused-vars: "error"*/
          
          var x = 10;
          alert(x);
          
          // foo is considered used here
          myFunc(function foo() {
              // ...
          }.bind(this));
          
          (function(foo) {
              return foo;
          })();
          
          var myFunc;
          myFunc = setTimeout(function() {
              // myFunc is considered used
              myFunc();
          }, 50);
          
          // Only the second argument from the descructured array is used.
          function getY([, y]) {
              return y;
          }

          exported

          In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

          Note that /* exported */ has no effect for any of the following:

          • when the environment is node or commonjs
          • when parserOptions.sourceType is module
          • when ecmaFeatures.globalReturn is true

          The line comment // exported variableName will not work as exported is not line-specific.

          Examples of correct code for /* exported variableName */ operation:

          /* exported global_var */
          
          var global_var = 42;

          Options

          This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

          By default this rule is enabled with all option for variables and after-used for arguments.

          {
              "rules": {
                  "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
              }
          }

          vars

          The vars option has two settings:

          • all checks all variables for usage, including those in the global scope. This is the default setting.
          • local checks only that locally-declared variables are used but will allow global variables to be unused.

          vars: local

          Examples of correct code for the { "vars": "local" } option:

          /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
          /*global some_unused_var */
          
          some_unused_var = 42;

          varsIgnorePattern

          The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

          Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

          /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
          
          var firstVarIgnored = 1;
          var secondVar = 2;
          console.log(secondVar);

          args

          The args option has three settings:

          • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
          • all - all named arguments must be used.
          • none - do not check arguments.

          args: after-used

          Examples of incorrect code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
          
          // 1 error
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          Examples of correct code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
          
          (function(foo, bar, baz) {
              return baz;
          })();

          args: all

          Examples of incorrect code for the { "args": "all" } option:

          /*eslint no-unused-vars: ["error", { "args": "all" }]*/
          
          // 2 errors
          // "foo" is defined but never used
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          args: none

          Examples of correct code for the { "args": "none" } option:

          /*eslint no-unused-vars: ["error", { "args": "none" }]*/
          
          (function(foo, bar, baz) {
              return bar;
          })();

          ignoreRestSiblings

          The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

          Examples of correct code for the { "ignoreRestSiblings": true } option:

          /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
          // 'type' is ignored because it has a rest property sibling.
          var { type, ...coords } = data;

          argsIgnorePattern

          The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

          Examples of correct code for the { "argsIgnorePattern": "^_" } option:

          /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
          
          function foo(x, _y) {
              return x + 1;
          }
          foo();

          caughtErrors

          The caughtErrors option is used for catch block arguments validation.

          It has two settings:

          • none - do not check error objects. This is the default setting.
          • all - all named arguments must be used.

          caughtErrors: none

          Not specifying this rule is equivalent of assigning it to none.

          Examples of correct code for the { "caughtErrors": "none" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
          
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrors: all

          Examples of incorrect code for the { "caughtErrors": "all" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
          
          // 1 error
          // "err" is defined but never used
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrorsIgnorePattern

          The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

          Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
          
          try {
              //...
          } catch (ignoreErr) {
              console.error("errors");
          }

          When Not To Use It

          If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

          'fields' is already declared in the upper scope.
          Open

                      var fields = {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

          Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

          var a = 3;
          function b() {
              var a = 10;
          }

          In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

          Rule Details

          This rule aims to eliminate shadowed variable declarations.

          Examples of incorrect code for this rule:

          /*eslint no-shadow: "error"*/
          /*eslint-env es6*/
          
          var a = 3;
          function b() {
              var a = 10;
          }
          
          var b = function () {
              var a = 10;
          }
          
          function b(a) {
              a = 10;
          }
          b(a);
          
          if (true) {
              let a = 5;
          }

          Options

          This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

          {
              "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
          }

          builtinGlobals

          The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
          
          function foo() {
              var Object = 0;
          }

          hoist

          The hoist option has three settings:

          • functions (by default) - reports shadowing before the outer functions are defined.
          • all - reports all shadowing before the outer variables/functions are defined.
          • never - never report shadowing before the outer variables/functions are defined.

          hoist: functions

          Examples of incorrect code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let b = 6;
          }
          
          function b() {}

          Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

          Examples of correct code for the default { "hoist": "functions" } option:

          /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
          }
          
          let a = 5;

          Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

          hoist: all

          Examples of incorrect code for the { "hoist": "all" } option:

          /*eslint no-shadow: ["error", { "hoist": "all" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          hoist: never

          Examples of correct code for the { "hoist": "never" } option:

          /*eslint no-shadow: ["error", { "hoist": "never" }]*/
          /*eslint-env es6*/
          
          if (true) {
              let a = 3;
              let b = 6;
          }
          
          let a = 5;
          function b() {}

          Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

          allow

          The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

          Examples of correct code for the { "allow": ["done"] } option:

          /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
          /*eslint-env es6*/
          
          import async from 'async';
          
          function foo(done) {
            async.map([1, 2], function (e, done) {
              done(null, e * 2)
            }, done);
          }
          
          foo(function (err, result) {
            console.log({ err, result });
          });

          Further Reading

          Related Rules

          'entry' is already defined.
          Open

                      var entry = compareEntry;
          Severity: Minor
          Found in docs/graph/main.js by eslint

          disallow variable redeclaration (no-redeclare)

          In JavaScript, it's possible to redeclare the same variable name using var. This can lead to confusion as to where the variable is actually declared and initialized.

          Rule Details

          This rule is aimed at eliminating variables that have multiple declarations in the same scope.

          Examples of incorrect code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          var a = 10;

          Examples of correct code for this rule:

          /*eslint no-redeclare: "error"*/
          
          var a = 3;
          // ...
          a = 10;

          Options

          This rule takes one optional argument, an object with a boolean property "builtinGlobals". It defaults to false. If set to true, this rule also checks redeclaration of built-in globals, such as Object, Array, Number...

          builtinGlobals

          Examples of incorrect code for the { "builtinGlobals": true } option:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          
          var Object = 0;

          Examples of incorrect code for the { "builtinGlobals": true } option and the browser environment:

          /*eslint no-redeclare: ["error", { "builtinGlobals": true }]*/
          /*eslint-env browser*/
          
          var top = 0;

          The browser environment has many built-in global variables (for example, top). Some of built-in global variables cannot be redeclared. Source: http://eslint.org/docs/rules/

          'index' is defined but never used.
          Open

                  $('article[data-version]').each(function(index) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Unused Variables (no-unused-vars)

          Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

          Rule Details

          This rule is aimed at eliminating unused variables, functions, and parameters of functions.

          A variable is considered to be used if any of the following are true:

          • It represents a function that is called (doSomething())
          • It is read (var y = x)
          • It is passed into a function as an argument (doSomething(x))
          • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

          A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

          Examples of incorrect code for this rule:

          /*eslint no-unused-vars: "error"*/
          /*global some_unused_var*/
          
          // It checks variables you have defined as global
          some_unused_var = 42;
          
          var x;
          
          // Write-only variables are not considered as used.
          var y = 10;
          y = 5;
          
          // A read for a modification of itself is not considered as used.
          var z = 0;
          z = z + 1;
          
          // By default, unused arguments cause warnings.
          (function(foo) {
              return 5;
          })();
          
          // Unused recursive functions also cause warnings.
          function fact(n) {
              if (n < 2) return 1;
              return n * fact(n - 1);
          }
          
          // When a function definition destructures an array, unused entries from the array also cause warnings.
          function getY([x, y]) {
              return y;
          }

          Examples of correct code for this rule:

          /*eslint no-unused-vars: "error"*/
          
          var x = 10;
          alert(x);
          
          // foo is considered used here
          myFunc(function foo() {
              // ...
          }.bind(this));
          
          (function(foo) {
              return foo;
          })();
          
          var myFunc;
          myFunc = setTimeout(function() {
              // myFunc is considered used
              myFunc();
          }, 50);
          
          // Only the second argument from the descructured array is used.
          function getY([, y]) {
              return y;
          }

          exported

          In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

          Note that /* exported */ has no effect for any of the following:

          • when the environment is node or commonjs
          • when parserOptions.sourceType is module
          • when ecmaFeatures.globalReturn is true

          The line comment // exported variableName will not work as exported is not line-specific.

          Examples of correct code for /* exported variableName */ operation:

          /* exported global_var */
          
          var global_var = 42;

          Options

          This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

          By default this rule is enabled with all option for variables and after-used for arguments.

          {
              "rules": {
                  "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
              }
          }

          vars

          The vars option has two settings:

          • all checks all variables for usage, including those in the global scope. This is the default setting.
          • local checks only that locally-declared variables are used but will allow global variables to be unused.

          vars: local

          Examples of correct code for the { "vars": "local" } option:

          /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
          /*global some_unused_var */
          
          some_unused_var = 42;

          varsIgnorePattern

          The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

          Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

          /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
          
          var firstVarIgnored = 1;
          var secondVar = 2;
          console.log(secondVar);

          args

          The args option has three settings:

          • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
          • all - all named arguments must be used.
          • none - do not check arguments.

          args: after-used

          Examples of incorrect code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
          
          // 1 error
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          Examples of correct code for the default { "args": "after-used" } option:

          /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
          
          (function(foo, bar, baz) {
              return baz;
          })();

          args: all

          Examples of incorrect code for the { "args": "all" } option:

          /*eslint no-unused-vars: ["error", { "args": "all" }]*/
          
          // 2 errors
          // "foo" is defined but never used
          // "baz" is defined but never used
          (function(foo, bar, baz) {
              return bar;
          })();

          args: none

          Examples of correct code for the { "args": "none" } option:

          /*eslint no-unused-vars: ["error", { "args": "none" }]*/
          
          (function(foo, bar, baz) {
              return bar;
          })();

          ignoreRestSiblings

          The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

          Examples of correct code for the { "ignoreRestSiblings": true } option:

          /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
          // 'type' is ignored because it has a rest property sibling.
          var { type, ...coords } = data;

          argsIgnorePattern

          The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

          Examples of correct code for the { "argsIgnorePattern": "^_" } option:

          /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
          
          function foo(x, _y) {
              return x + 1;
          }
          foo();

          caughtErrors

          The caughtErrors option is used for catch block arguments validation.

          It has two settings:

          • none - do not check error objects. This is the default setting.
          • all - all named arguments must be used.

          caughtErrors: none

          Not specifying this rule is equivalent of assigning it to none.

          Examples of correct code for the { "caughtErrors": "none" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
          
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrors: all

          Examples of incorrect code for the { "caughtErrors": "all" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
          
          // 1 error
          // "err" is defined but never used
          try {
              //...
          } catch (err) {
              console.error("errors");
          }

          caughtErrorsIgnorePattern

          The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

          Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

          /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
          
          try {
              //...
          } catch (ignoreErr) {
              console.error("errors");
          }

          When Not To Use It

          If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

          'changeAllVersionCompareTo' was used before it was defined.
          Open

              $('#compareAllWithPredecessor').on('click', changeAllVersionCompareTo);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Early Use (no-use-before-define)

          In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

          In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

          Rule Details

          This rule will warn when it encounters a reference to an identifier that has not yet been declared.

          Examples of incorrect code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          alert(a);
          var a = 10;
          
          f();
          function f() {}
          
          function g() {
              return b;
          }
          var b = 1;
          
          // With blockBindings: true
          {
              alert(c);
              let c = 1;
          }

          Examples of correct code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          var a;
          a = 10;
          alert(a);
          
          function f() {}
          f(1);
          
          var b = 1;
          function g() {
              return b;
          }
          
          // With blockBindings: true
          {
              let C;
              c++;
          }

          Options

          {
              "no-use-before-define": ["error", { "functions": true, "classes": true }]
          }
          • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
          • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
          • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

          This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true }.

          functions

          Examples of correct code for the { "functions": false } option:

          /*eslint no-use-before-define: ["error", { "functions": false }]*/
          
          f();
          function f() {}

          classes

          Examples of incorrect code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          new A();
          class A {
          }

          Examples of correct code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          function foo() {
              return new A();
          }
          
          class A {
          }

          variables

          Examples of incorrect code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          console.log(foo);
          var foo = 1;

          Examples of correct code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          function baz() {
              console.log(foo);
          }
          
          var foo = 1;

          Source: http://eslint.org/docs/rules/

          'resetArticle' was used before it was defined.
          Open

                      resetArticle(group, name, version);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Early Use (no-use-before-define)

          In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

          In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

          Rule Details

          This rule will warn when it encounters a reference to an identifier that has not yet been declared.

          Examples of incorrect code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          alert(a);
          var a = 10;
          
          f();
          function f() {}
          
          function g() {
              return b;
          }
          var b = 1;
          
          // With blockBindings: true
          {
              alert(c);
              let c = 1;
          }

          Examples of correct code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          var a;
          a = 10;
          alert(a);
          
          function f() {}
          f(1);
          
          var b = 1;
          function g() {
              return b;
          }
          
          // With blockBindings: true
          {
              let C;
              c++;
          }

          Options

          {
              "no-use-before-define": ["error", { "functions": true, "classes": true }]
          }
          • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
          • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
          • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

          This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true }.

          functions

          Examples of correct code for the { "functions": false } option:

          /*eslint no-use-before-define: ["error", { "functions": false }]*/
          
          f();
          function f() {}

          classes

          Examples of incorrect code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          new A();
          class A {
          }

          Examples of correct code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          function foo() {
              return new A();
          }
          
          class A {
          }

          variables

          Examples of incorrect code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          console.log(foo);
          var foo = 1;

          Examples of correct code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          function baz() {
              console.log(foo);
          }
          
          var foo = 1;

          Source: http://eslint.org/docs/rules/

          'loadGoogleFontCss' was used before it was defined.
          Open

              loadGoogleFontCss();
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Early Use (no-use-before-define)

          In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

          In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

          Rule Details

          This rule will warn when it encounters a reference to an identifier that has not yet been declared.

          Examples of incorrect code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          alert(a);
          var a = 10;
          
          f();
          function f() {}
          
          function g() {
              return b;
          }
          var b = 1;
          
          // With blockBindings: true
          {
              alert(c);
              let c = 1;
          }

          Examples of correct code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          var a;
          a = 10;
          alert(a);
          
          function f() {}
          f(1);
          
          var b = 1;
          function g() {
              return b;
          }
          
          // With blockBindings: true
          {
              let C;
              c++;
          }

          Options

          {
              "no-use-before-define": ["error", { "functions": true, "classes": true }]
          }
          • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
          • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
          • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

          This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true }.

          functions

          Examples of correct code for the { "functions": false } option:

          /*eslint no-use-before-define: ["error", { "functions": false }]*/
          
          f();
          function f() {}

          classes

          Examples of incorrect code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          new A();
          class A {
          }

          Examples of correct code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          function foo() {
              return new A();
          }
          
          class A {
          }

          variables

          Examples of incorrect code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          console.log(foo);
          var foo = 1;

          Examples of correct code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          function baz() {
              console.log(foo);
          }
          
          var foo = 1;

          Source: http://eslint.org/docs/rules/

          'sortByOrder' was used before it was defined.
          Open

                      titles = sortByOrder(titles, apiProject.order, '#~#');
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Early Use (no-use-before-define)

          In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

          In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

          Rule Details

          This rule will warn when it encounters a reference to an identifier that has not yet been declared.

          Examples of incorrect code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          alert(a);
          var a = 10;
          
          f();
          function f() {}
          
          function g() {
              return b;
          }
          var b = 1;
          
          // With blockBindings: true
          {
              alert(c);
              let c = 1;
          }

          Examples of correct code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          var a;
          a = 10;
          alert(a);
          
          function f() {}
          f(1);
          
          var b = 1;
          function g() {
              return b;
          }
          
          // With blockBindings: true
          {
              let C;
              c++;
          }

          Options

          {
              "no-use-before-define": ["error", { "functions": true, "classes": true }]
          }
          • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
          • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
          • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

          This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true }.

          functions

          Examples of correct code for the { "functions": false } option:

          /*eslint no-use-before-define: ["error", { "functions": false }]*/
          
          f();
          function f() {}

          classes

          Examples of incorrect code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          new A();
          class A {
          }

          Examples of correct code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          function foo() {
              return new A();
          }
          
          class A {
          }

          variables

          Examples of incorrect code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          console.log(foo);
          var foo = 1;

          Examples of correct code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          function baz() {
              console.log(foo);
          }
          
          var foo = 1;

          Source: http://eslint.org/docs/rules/

          'sortByOrder' was used before it was defined.
          Open

                  apiGroups = sortByOrder(apiGroups, apiProject.order);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Early Use (no-use-before-define)

          In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

          In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

          Rule Details

          This rule will warn when it encounters a reference to an identifier that has not yet been declared.

          Examples of incorrect code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          alert(a);
          var a = 10;
          
          f();
          function f() {}
          
          function g() {
              return b;
          }
          var b = 1;
          
          // With blockBindings: true
          {
              alert(c);
              let c = 1;
          }

          Examples of correct code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          var a;
          a = 10;
          alert(a);
          
          function f() {}
          f(1);
          
          var b = 1;
          function g() {
              return b;
          }
          
          // With blockBindings: true
          {
              let C;
              c++;
          }

          Options

          {
              "no-use-before-define": ["error", { "functions": true, "classes": true }]
          }
          • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
          • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
          • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

          This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true }.

          functions

          Examples of correct code for the { "functions": false } option:

          /*eslint no-use-before-define: ["error", { "functions": false }]*/
          
          f();
          function f() {}

          classes

          Examples of incorrect code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          new A();
          class A {
          }

          Examples of correct code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          function foo() {
              return new A();
          }
          
          class A {
          }

          variables

          Examples of incorrect code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          console.log(foo);
          var foo = 1;

          Examples of correct code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          function baz() {
              console.log(foo);
          }
          
          var foo = 1;

          Source: http://eslint.org/docs/rules/

          'addArticleSettings' was used before it was defined.
          Open

                          addArticleSettings(fields, entry);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Early Use (no-use-before-define)

          In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

          In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

          Rule Details

          This rule will warn when it encounters a reference to an identifier that has not yet been declared.

          Examples of incorrect code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          alert(a);
          var a = 10;
          
          f();
          function f() {}
          
          function g() {
              return b;
          }
          var b = 1;
          
          // With blockBindings: true
          {
              alert(c);
              let c = 1;
          }

          Examples of correct code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          var a;
          a = 10;
          alert(a);
          
          function f() {}
          f(1);
          
          var b = 1;
          function g() {
              return b;
          }
          
          // With blockBindings: true
          {
              let C;
              c++;
          }

          Options

          {
              "no-use-before-define": ["error", { "functions": true, "classes": true }]
          }
          • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
          • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
          • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

          This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true }.

          functions

          Examples of correct code for the { "functions": false } option:

          /*eslint no-use-before-define: ["error", { "functions": false }]*/
          
          f();
          function f() {}

          classes

          Examples of incorrect code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          new A();
          class A {
          }

          Examples of correct code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          function foo() {
              return new A();
          }
          
          class A {
          }

          variables

          Examples of incorrect code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          console.log(foo);
          var foo = 1;

          Examples of correct code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          function baz() {
              console.log(foo);
          }
          
          var foo = 1;

          Source: http://eslint.org/docs/rules/

          Unexpected use of undefined.
          Open

                      if(title !== undefined) {
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Use of undefined Variable (no-undefined)

          The undefined variable is unique in JavaScript because it is actually a property of the global object. As such, in ECMAScript 3 it was possible to overwrite the value of undefined. While ECMAScript 5 disallows overwriting undefined, it's still possible to shadow undefined, such as:

          function doSomething(data) {
              var undefined = "hi";
          
              // doesn't do what you think it does
              if (data === undefined) {
                  // ...
              }
          
          }

          This represents a problem for undefined that doesn't exist for null, which is a keyword and primitive value that can neither be overwritten nor shadowed.

          All uninitialized variables automatically get the value of undefined:

          var foo;
          
          console.log(foo === undefined);     // true (assuming no shadowing)

          For this reason, it's not necessary to explicitly initialize a variable to undefined.

          Taking all of this into account, some style guides forbid the use of undefined, recommending instead:

          • Variables that should be undefined are simply left uninitialized.
          • Checking if a value is undefined should be done with typeof.
          • Using the void operator to generate the value of undefined if necessary.

          Rule Details

          This rule aims to eliminate the use of undefined, and as such, generates a warning whenever it is used.

          Examples of incorrect code for this rule:

          /*eslint no-undefined: "error"*/
          
          var foo = undefined;
          
          var undefined = "foo";
          
          if (foo === undefined) {
              // ...
          }
          
          function foo(undefined) {
              // ...
          }

          Examples of correct code for this rule:

          /*eslint no-undefined: "error"*/
          
          var foo = void 0;
          
          var Undefined = "foo";
          
          if (typeof foo === "undefined") {
              // ...
          }
          
          global.undefined = "foo";

          When Not To Use It

          If you want to allow the use of undefined in your code, then you can safely turn this rule off.

          Further Reading

          Related Rules

          'changeVersionCompareTo' was used before it was defined.
          Open

              $('article .versions li.version a').on('click', changeVersionCompareTo);
          Severity: Minor
          Found in docs/graph/main.js by eslint

          Disallow Early Use (no-use-before-define)

          In JavaScript, prior to ES6, variable and function declarations are hoisted to the top of a scope, so it's possible to use identifiers before their formal declarations in code. This can be confusing and some believe it is best to always declare variables and functions before using them.

          In ES6, block-level bindings (let and const) introduce a "temporal dead zone" where a ReferenceError will be thrown with any attempt to access the variable before its declaration.

          Rule Details

          This rule will warn when it encounters a reference to an identifier that has not yet been declared.

          Examples of incorrect code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          alert(a);
          var a = 10;
          
          f();
          function f() {}
          
          function g() {
              return b;
          }
          var b = 1;
          
          // With blockBindings: true
          {
              alert(c);
              let c = 1;
          }

          Examples of correct code for this rule:

          /*eslint no-use-before-define: "error"*/
          /*eslint-env es6*/
          
          var a;
          a = 10;
          alert(a);
          
          function f() {}
          f(1);
          
          var b = 1;
          function g() {
              return b;
          }
          
          // With blockBindings: true
          {
              let C;
              c++;
          }

          Options

          {
              "no-use-before-define": ["error", { "functions": true, "classes": true }]
          }
          • functions (boolean) - The flag which shows whether or not this rule checks function declarations. If this is true, this rule warns every reference to a function before the function declaration. Otherwise, ignores those references. Function declarations are hoisted, so it's safe. Default is true.
          • classes (boolean) - The flag which shows whether or not this rule checks class declarations of upper scopes. If this is true, this rule warns every reference to a class before the class declaration. Otherwise, ignores those references if the declaration is in upper function scopes. Class declarations are not hoisted, so it might be danger. Default is true.
          • variables (boolean) - This flag determines whether or not the rule checks variable declarations in upper scopes. If this is true, the rule warns every reference to a variable before the variable declaration. Otherwise, the rule ignores a reference if the declaration is in an upper scope, while still reporting the reference if it's in the same scope as the declaration. Default is true.

          This rule accepts "nofunc" string as an option. "nofunc" is the same as { "functions": false, "classes": true }.

          functions

          Examples of correct code for the { "functions": false } option:

          /*eslint no-use-before-define: ["error", { "functions": false }]*/
          
          f();
          function f() {}

          classes

          Examples of incorrect code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          new A();
          class A {
          }

          Examples of correct code for the { "classes": false } option:

          /*eslint no-use-before-define: ["error", { "classes": false }]*/
          /*eslint-env es6*/
          
          function foo() {
              return new A();
          }
          
          class A {
          }

          variables

          Examples of incorrect code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          console.log(foo);
          var foo = 1;

          Examples of correct code for the { "variables": false } option:

          /*eslint no-use-before-define: ["error", { "variables": false }]*/
          
          function baz() {
              console.log(foo);
          }
          
          var foo = 1;

          Source: http://eslint.org/docs/rules/

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (entry.error && entry.error.fields) {
                      sortFields(entry.error.fields);
                      fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields);
                  }
          Severity: Major
          Found in docs/graph/main.js and 3 other locations - About 35 mins to fix
          docs/graph/main.js on lines 714..717
          docs/graph/main.js on lines 719..722
          docs/graph/main.js on lines 729..732

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (entry.success && entry.success.fields) {
                      sortFields(entry.success.fields);
                      fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields);
                  }
          Severity: Major
          Found in docs/graph/main.js and 3 other locations - About 35 mins to fix
          docs/graph/main.js on lines 714..717
          docs/graph/main.js on lines 719..722
          docs/graph/main.js on lines 724..727

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (entry.header && entry.header.fields) {
                      sortFields(entry.header.fields);
                      fields._hasTypeInHeaderFields = _hasTypeInFields(entry.header.fields);
                  }
          Severity: Major
          Found in docs/graph/main.js and 3 other locations - About 35 mins to fix
          docs/graph/main.js on lines 719..722
          docs/graph/main.js on lines 724..727
          docs/graph/main.js on lines 729..732

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (entry.parameter && entry.parameter.fields) {
                      sortFields(entry.parameter.fields);
                      fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields);
                  }
          Severity: Major
          Found in docs/graph/main.js and 3 other locations - About 35 mins to fix
          docs/graph/main.js on lines 714..717
          docs/graph/main.js on lines 724..727
          docs/graph/main.js on lines 729..732

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 61.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status