marionebl/jogwheel

View on GitHub
tasks/watch.js

Summary

Maintainability
C
7 hrs
Test Coverage

Function exports has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (gulp, paths, options, cli) {
    var task = require('./helpers/task')(gulp);
    var build = require('./build')(gulp, paths, {fails: true, notifies: true}, cli);

    return function watch(cb) {
Severity: Major
Found in tasks/watch.js - About 2 hrs to fix

    Function watch has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        return function watch(cb) {
            /* @desc execute sequence after changes */
            var watchOptions = {fails: false, notifies: true, watch: true};
            var transpile = require('./transpile')(gulp, paths, watchOptions, cli);
            var documentation = require('./documentation')(gulp, paths, watchOptions, cli);
    Severity: Major
    Found in tasks/watch.js - About 2 hrs to fix

      Unexpected var, use let or const instead.
      Open

          var task = require('./helpers/task')(gulp);
      Severity: Minor
      Found in tasks/watch.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 function expression.
      Open

                  task(function () {
      Severity: Minor
      Found in tasks/watch.js by eslint

      Suggest using arrow functions as callbacks. (prefer-arrow-callback)

      Arrow functions are suited to callbacks, because:

      • this keywords in arrow functions bind to the upper scope's.
      • The notation of the arrow function is shorter than function expression's.

      Rule Details

      This rule is aimed to flag usage of function expressions in an argument list.

      The following patterns are considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      
      foo(function(a) { return a; });
      foo(function() { return this.a; }.bind(this));

      The following patterns are not considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      /*eslint-env es6*/
      
      foo(a => a);
      foo(function*() { yield; });
      
      // this is not a callback.
      var foo = function foo(a) { return a; };
      
      // using `this` without `.bind(this)`.
      foo(function() { return this.a; });
      
      // recursively.
      foo(function bar(n) { return n && n + bar(n - 1); });

      Options

      This rule takes one optional argument, an object which is an options object.

      allowNamedFunctions

      This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

      Examples of correct code for the { "allowNamedFunctions": true } option:

      /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
      
      foo(function bar() {});

      allowUnboundThis

      This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

      Examples of incorrect code for the { "allowUnboundThis": false } option:

      /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
      /*eslint-env es6*/
      
      foo(function() { this.a; });
      
      foo(function() { (() => this); });
      
      someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected var, use let or const instead.
      Open

      var sequence = require('gulp-sequence');
      Severity: Minor
      Found in tasks/watch.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 transpile = require('./transpile')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 css = require('./css')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 copy = require('./copy')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 excludeGlobs = flatten(values(paths.exclude)).map(function (glob) {
      Severity: Minor
      Found in tasks/watch.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 function expression.
      Open

              var excludeGlobs = flatten(values(paths.exclude)).map(function (glob) {
      Severity: Minor
      Found in tasks/watch.js by eslint

      Suggest using arrow functions as callbacks. (prefer-arrow-callback)

      Arrow functions are suited to callbacks, because:

      • this keywords in arrow functions bind to the upper scope's.
      • The notation of the arrow function is shorter than function expression's.

      Rule Details

      This rule is aimed to flag usage of function expressions in an argument list.

      The following patterns are considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      
      foo(function(a) { return a; });
      foo(function() { return this.a; }.bind(this));

      The following patterns are not considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      /*eslint-env es6*/
      
      foo(a => a);
      foo(function*() { yield; });
      
      // this is not a callback.
      var foo = function foo(a) { return a; };
      
      // using `this` without `.bind(this)`.
      foo(function() { return this.a; });
      
      // recursively.
      foo(function bar(n) { return n && n + bar(n - 1); });

      Options

      This rule takes one optional argument, an object which is an options object.

      allowNamedFunctions

      This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

      Examples of correct code for the { "allowNamedFunctions": true } option:

      /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
      
      foo(function bar() {});

      allowUnboundThis

      This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

      Examples of incorrect code for the { "allowUnboundThis": false } option:

      /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
      /*eslint-env es6*/
      
      foo(function() { this.a; });
      
      foo(function() { (() => this); });
      
      someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected var, use let or const instead.
      Open

              var watchGlobs = flatten(values(paths.source));
      Severity: Minor
      Found in tasks/watch.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 function expression.
      Open

                          function () {
      Severity: Minor
      Found in tasks/watch.js by eslint

      Suggest using arrow functions as callbacks. (prefer-arrow-callback)

      Arrow functions are suited to callbacks, because:

      • this keywords in arrow functions bind to the upper scope's.
      • The notation of the arrow function is shorter than function expression's.

      Rule Details

      This rule is aimed to flag usage of function expressions in an argument list.

      The following patterns are considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      
      foo(function(a) { return a; });
      foo(function() { return this.a; }.bind(this));

      The following patterns are not considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      /*eslint-env es6*/
      
      foo(a => a);
      foo(function*() { yield; });
      
      // this is not a callback.
      var foo = function foo(a) { return a; };
      
      // using `this` without `.bind(this)`.
      foo(function() { return this.a; });
      
      // recursively.
      foo(function bar(n) { return n && n + bar(n - 1); });

      Options

      This rule takes one optional argument, an object which is an options object.

      allowNamedFunctions

      This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

      Examples of correct code for the { "allowNamedFunctions": true } option:

      /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
      
      foo(function bar() {});

      allowUnboundThis

      This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

      Examples of incorrect code for the { "allowUnboundThis": false } option:

      /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
      /*eslint-env es6*/
      
      foo(function() { this.a; });
      
      foo(function() { (() => this); });
      
      someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected var, use let or const instead.
      Open

      var onError = require('./helpers/on-error');
      Severity: Minor
      Found in tasks/watch.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 named function 'watch'.
      Open

          return function watch(cb) {
      Severity: Minor
      Found in tasks/watch.js by eslint

      Require or disallow named function expressions (func-names)

      A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

      Foo.prototype.bar = function bar() {};

      Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

      Rule Details

      This rule can enforce or disallow the use of named function expressions.

      Options

      This rule has a string option:

      • "always" (default) requires function expressions to have a name
      • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
      • "never" disallows named function expressions, except in recursive functions, where a name is needed

      always

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

      /*eslint func-names: ["error", "always"]*/
      
      Foo.prototype.bar = function() {};
      
      (function() {
          // ...
      }())

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

      /*eslint func-names: ["error", "always"]*/
      
      Foo.prototype.bar = function bar() {};
      
      (function bar() {
          // ...
      }())

      as-needed

      ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

      Examples of incorrect code for this rule with the default "as-needed" option:

      /*eslint func-names: ["error", "as-needed"]*/
      
      Foo.prototype.bar = function() {};
      
      (function() {
          // ...
      }())

      Examples of correct code for this rule with the default "as-needed" option:

      /*eslint func-names: ["error", "as-needed"]*/
      
      var bar = function() {};
      
      (function bar() {
          // ...
      }())

      never

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

      /*eslint func-names: ["error", "never"]*/
      
      Foo.prototype.bar = function bar() {};
      
      (function bar() {
          // ...
      }())

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

      /*eslint func-names: ["error", "never"]*/
      
      Foo.prototype.bar = function() {};
      
      (function() {
          // ...
      }())

      Further Reading

      Compatibility

      Unexpected var, use let or const instead.
      Open

              var watchOptions = {fails: false, notifies: true, watch: true};
      Severity: Minor
      Found in tasks/watch.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 pack = require('./pack')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 flatten = require('lodash.flatten');
      Severity: Minor
      Found in tasks/watch.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 function expression.
      Open

              )(function (err) {
      Severity: Minor
      Found in tasks/watch.js by eslint

      Suggest using arrow functions as callbacks. (prefer-arrow-callback)

      Arrow functions are suited to callbacks, because:

      • this keywords in arrow functions bind to the upper scope's.
      • The notation of the arrow function is shorter than function expression's.

      Rule Details

      This rule is aimed to flag usage of function expressions in an argument list.

      The following patterns are considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      
      foo(function(a) { return a; });
      foo(function() { return this.a; }.bind(this));

      The following patterns are not considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      /*eslint-env es6*/
      
      foo(a => a);
      foo(function*() { yield; });
      
      // this is not a callback.
      var foo = function foo(a) { return a; };
      
      // using `this` without `.bind(this)`.
      foo(function() { return this.a; });
      
      // recursively.
      foo(function bar(n) { return n && n + bar(n - 1); });

      Options

      This rule takes one optional argument, an object which is an options object.

      allowNamedFunctions

      This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

      Examples of correct code for the { "allowNamedFunctions": true } option:

      /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
      
      foo(function bar() {});

      allowUnboundThis

      This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

      Examples of incorrect code for the { "allowUnboundThis": false } option:

      /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
      /*eslint-env es6*/
      
      foo(function() { this.a; });
      
      foo(function() { (() => this); });
      
      someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected function expression.
      Open

              .map(function (key) {
      Severity: Minor
      Found in tasks/watch.js by eslint

      Suggest using arrow functions as callbacks. (prefer-arrow-callback)

      Arrow functions are suited to callbacks, because:

      • this keywords in arrow functions bind to the upper scope's.
      • The notation of the arrow function is shorter than function expression's.

      Rule Details

      This rule is aimed to flag usage of function expressions in an argument list.

      The following patterns are considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      
      foo(function(a) { return a; });
      foo(function() { return this.a; }.bind(this));

      The following patterns are not considered problems:

      /*eslint prefer-arrow-callback: "error"*/
      /*eslint-env es6*/
      
      foo(a => a);
      foo(function*() { yield; });
      
      // this is not a callback.
      var foo = function foo(a) { return a; };
      
      // using `this` without `.bind(this)`.
      foo(function() { return this.a; });
      
      // recursively.
      foo(function bar(n) { return n && n + bar(n - 1); });

      Options

      This rule takes one optional argument, an object which is an options object.

      allowNamedFunctions

      This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

      Examples of correct code for the { "allowNamedFunctions": true } option:

      /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
      
      foo(function bar() {});

      allowUnboundThis

      This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

      Examples of incorrect code for the { "allowUnboundThis": false } option:

      /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
      /*eslint-env es6*/
      
      foo(function() { this.a; });
      
      foo(function() { (() => this); });
      
      someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

      When Not To Use It

      This rule should not be used in ES3/5 environments.

      In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

      Unexpected var, use let or const instead.
      Open

              var copyStatic = require('./static')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 util = require('gulp-util');
      Severity: Minor
      Found in tasks/watch.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 test = require('./test')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 build = require('./build')(gulp, paths, {fails: true, notifies: true}, cli);
      Severity: Minor
      Found in tasks/watch.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 documentation = require('./documentation')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 lint = require('./lint')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 copyExample = require('./copy-example')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 html = require('./html')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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 testCss = require('./test-css')(gulp, paths, watchOptions, cli);
      Severity: Minor
      Found in tasks/watch.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/

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                                  [
                                      task(copy),
                                      task(copyStatic, 'copy-static'),
                                      task(copyExample, 'copy-example'),
                                      task(lint),
      Severity: Major
      Found in tasks/watch.js and 1 other location - About 2 hrs to fix
      tasks/build.js on lines 25..47

      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 89.

      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