tenon-io/tenon-cli

View on GitHub
bin/tenon-cli.js

Summary

Maintainability
D
2 days
Test Coverage

Function parseFormat has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var parseFormat = function parseFormat(json) {
    switch (allOptions.format) {
      case 'json':
        // Tenon returns resuls in JSON, so it's already formatted correctly
        return new Promise(function (resolve) {
Severity: Minor
Found in bin/tenon-cli.js - About 1 hr to fix

    Unexpected var, use let or const instead.
    Open

    var _tenonNode = require('tenon-node');
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

    (0, _getStdin2.default)().then(function (pipedHTML) {
    Severity: Minor
    Found in bin/tenon-cli.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

    All 'var' declarations must be at the top of the function scope.
    Open

      var requiredFields = ['key'];
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected dangling '_' in '_tenonReporters2'.
    Open

    var _tenonReporters2 = _interopRequireDefault(_tenonReporters);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected unnamed function.
    Open

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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 _fs = require('fs');
    Severity: Minor
    Found in bin/tenon-cli.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 defaults = {
    Severity: Minor
    Found in bin/tenon-cli.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/

    All 'var' declarations must be at the top of the function scope.
    Open

      var options = {};
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected function expression.
    Open

      Object.keys(options).forEach(function (key) {
    Severity: Minor
    Found in bin/tenon-cli.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 string concatenation.
    Open

          console.log('\'' + field + '\' is required');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    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 string concatenation, you can safely disable this rule.

    Related Rules

    All 'var' declarations must be at the top of the function scope.
    Open

      var source = void 0;
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    All 'var' declarations must be at the top of the function scope.
    Open

      var parseFormat = function parseFormat(json) {
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected function expression.
    Open

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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/

    Newline required at end of file but not found.
    Open

    });
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    require or disallow newline at the end of files (eol-last)

    Trailing newlines in non-empty files are a common UNIX idiom. Benefits of trailing newlines include the ability to concatenate or append to files as well as output files to the terminal without interfering with shell prompts.

    Rule Details

    This rule enforces at least one newline (or absence thereof) at the end of non-empty files.

    Prior to v0.16.0 this rule also enforced that there was only a single line at the end of the file. If you still want this behaviour, consider enabling [no-multiple-empty-lines](no-multiple-empty-lines.md) with maxEOF and/or [no-trailing-spaces](no-trailing-spaces.md).

    Examples of incorrect code for this rule:

    /*eslint eol-last: ["error", "always"]*/
    
    function doSmth() {
      var foo = 2;
    }

    Examples of correct code for this rule:

    /*eslint eol-last: ["error", "always"]*/
    
    function doSmth() {
      var foo = 2;
    }\n

    Options

    This rule has a string option:

    • "always" (default) enforces that files end with a newline (LF)
    • "never" enforces that files do not end with a newline
    • "unix" (deprecated) is identical to "always"
    • "windows" (deprecated) is identical to "always", but will use a CRLF character when autofixing

    Deprecated: The options "unix" and "windows" are deprecated. If you need to enforce a specific linebreak style, use this rule in conjunction with linebreak-style. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

    var _ = require('./');
    Severity: Minor
    Found in bin/tenon-cli.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

    (0, _getStdin2.default)().then(function (pipedHTML) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

      Object.keys(defaults).forEach(function (key) {
    Severity: Minor
    Found in bin/tenon-cli.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

    'use strict' is unnecessary inside of modules.
    Open

    'use strict';
    Severity: Minor
    Found in bin/tenon-cli.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 function expression.
    Open

      Object.keys(defaults).forEach(function (key) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

      Object.keys(options).forEach(function (key) {
    Severity: Minor
    Found in bin/tenon-cli.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 tenonApi = new _tenonNode2.default({
    Severity: Minor
    Found in bin/tenon-cli.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/

    All 'var' declarations must be at the top of the function scope.
    Open

      var writeResultFile = function writeResultFile(result, file) {
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected unnamed function.
    Open

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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 dangling '_' in '_tenonReporters'.
    Open

    var _tenonReporters = require('tenon-reporters');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected dangling '_' in '_getStdin2'.
    Open

    var _getStdin2 = _interopRequireDefault(_getStdin);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected function expression.
    Open

              _tenonReporters2.default.CSV(json, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

              _tenonReporters2.default.HTML(json, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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 function expression.
    Open

              _tenonReporters2.default.HTML(json, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

              _tenonReporters2.default.XUnit(json, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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 function expression.
    Open

          parseFormat(result).then(function (formattedResult) {
    Severity: Minor
    Found in bin/tenon-cli.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

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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

              _tenonReporters2.default.XUnit(json, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

      tenonApi.analyze(source, options, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

          parseFormat(result).then(function (formattedResult) {
    Severity: Minor
    Found in bin/tenon-cli.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 command = program.commands[0].args[0];
    Severity: Minor
    Found in bin/tenon-cli.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/

    A constructor name should not start with a lowercase letter.
    Open

      var tenonApi = new _tenonNode2.default({
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    require constructor names to begin with a capital letter (new-cap)

    The new operator in JavaScript creates a new instance of a particular type of object. That type of object is represented by a constructor function. Since constructor functions are just regular functions, the only defining characteristic is that new is being used as part of the call. Native JavaScript functions begin with an uppercase letter to distinguish those functions that are to be used as constructors from functions that are not. Many style guides recommend following this pattern to more easily determine which functions are to be used as constructors.

    var friend = new Person();

    Rule Details

    This rule requires constructor names to begin with a capital letter. Certain built-in identifiers are exempt from this rule. These identifiers are:

    • Array
    • Boolean
    • Date
    • Error
    • Function
    • Number
    • Object
    • RegExp
    • String
    • Symbol

    Examples of correct code for this rule:

    /*eslint new-cap: "error"*/
    
    function foo(arg) {
        return Boolean(arg);
    }

    Options

    This rule has an object option:

    • "newIsCap": true (default) requires all new operators to be called with uppercase-started functions.
    • "newIsCap": false allows new operators to be called with lowercase-started or uppercase-started functions.
    • "capIsNew": true (default) requires all uppercase-started functions to be called with new operators.
    • "capIsNew": false allows uppercase-started functions to be called without new operators.
    • "newIsCapExceptions" allows specified lowercase-started function names to be called with the new operator.
    • "newIsCapExceptionPattern" allows any lowercase-started function names that match the specified regex pattern to be called with the new operator.
    • "capIsNewExceptions" allows specified uppercase-started function names to be called without the new operator.
    • "capIsNewExceptionPattern" allows any uppercase-started function names that match the specified regex pattern to be called without the new operator.
    • "properties": true (default) enables checks on object properties
    • "properties": false disables checks on object properties

    newIsCap

    Examples of incorrect code for this rule with the default { "newIsCap": true } option:

    /*eslint new-cap: ["error", { "newIsCap": true }]*/
    
    var friend = new person();

    Examples of correct code for this rule with the default { "newIsCap": true } option:

    /*eslint new-cap: ["error", { "newIsCap": true }]*/
    
    var friend = new Person();

    Examples of correct code for this rule with the { "newIsCap": false } option:

    /*eslint new-cap: ["error", { "newIsCap": false }]*/
    
    var friend = new person();

    capIsNew

    Examples of incorrect code for this rule with the default { "capIsNew": true } option:

    /*eslint new-cap: ["error", { "capIsNew": true }]*/
    
    var colleague = Person();

    Examples of correct code for this rule with the default { "capIsNew": true } option:

    /*eslint new-cap: ["error", { "capIsNew": true }]*/
    
    var colleague = new Person();

    Examples of correct code for this rule with the { "capIsNew": false } option:

    /*eslint new-cap: ["error", { "capIsNew": false }]*/
    
    var colleague = Person();

    newIsCapExceptions

    Examples of additional correct code for this rule with the { "newIsCapExceptions": ["events"] } option:

    /*eslint new-cap: ["error", { "newIsCapExceptions": ["events"] }]*/
    
    var events = require('events');
    
    var emitter = new events();

    newIsCapExceptionPattern

    Examples of additional correct code for this rule with the { "newIsCapExceptionPattern": "^person\.." } option:

    /*eslint new-cap: ["error", { "newIsCapExceptionPattern": "^person\.." }]*/
    
    var friend = new person.acquaintance();
    var bestFriend = new person.friend();

    capIsNewExceptions

    Examples of additional correct code for this rule with the { "capIsNewExceptions": ["Person"] } option:

    /*eslint new-cap: ["error", { "capIsNewExceptions": ["Person"] }]*/
    
    function foo(arg) {
        return Person(arg);
    }

    capIsNewExceptionPattern

    Examples of additional correct code for this rule with the { "capIsNewExceptionPattern": "^Person\.." } option:

    /*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^Person\.." }]*/
    
    var friend = person.Acquaintance();
    var bestFriend = person.Friend();

    properties

    Examples of incorrect code for this rule with the default { "properties": true } option:

    /*eslint new-cap: ["error", { "properties": true }]*/
    
    var friend = new person.acquaintance();

    Examples of correct code for this rule with the default { "properties": true } option:

    /*eslint new-cap: ["error", { "properties": true }]*/
    
    var friend = new person.Acquaintance();

    Examples of correct code for this rule with the { "properties": false } option:

    /*eslint new-cap: ["error", { "properties": false }]*/
    
    var friend = new person.acquaintance();

    When Not To Use It

    If you have conventions that don't require an uppercase letter for constructors, or don't require capitalized functions be only used as constructors, turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected string concatenation.
    Open

          console.log('Analysis complete, report at ' + file);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    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 string concatenation, you can safely disable this rule.

    Related Rules

    Unexpected dangling '_' in '_fs'.
    Open

    var _fs = require('fs');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

    var _tenonReporters = require('tenon-reporters');
    Severity: Minor
    Found in bin/tenon-cli.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 _tenonReporters2 = _interopRequireDefault(_tenonReporters);
    Severity: Minor
    Found in bin/tenon-cli.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/

    All 'var' declarations must be at the top of the function scope.
    Open

      var defaults = {
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected var, use let or const instead.
    Open

      var writeResultFile = function writeResultFile(result, file) {
    Severity: Minor
    Found in bin/tenon-cli.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 parseFormat = function parseFormat(json) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

              _tenonReporters2.default.CSV(json, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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

    Expected newline before "use strict" directive.
    Open

    'use strict';
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    require or disallow newlines around directives (lines-around-directive)

    Directives are used in JavaScript to indicate to the execution environment that a script would like to opt into a feature such as "strict mode". Directives are grouped together in a directive prologue at the top of either a file or function block and are applied to the scope in which they occur.

    // Strict mode is invoked for the entire script
    "use strict";
    
    var foo;
    
    function bar() {
      var baz;
    }
    var foo;
    
    function bar() {
      // Strict mode is only invoked within this function
      "use strict";
    
      var baz;
    }

    Rule Details

    This rule requires or disallows blank newlines around directive prologues. This rule does not enforce any conventions about blank newlines between the individual directives. In addition, it does not require blank newlines before directive prologues unless they are preceded by a comment. Please use the [padded-blocks](padded-blocks.md) rule if this is a style you would like to enforce.

    Options

    This rule has one option. It can either be a string or an object:

    • "always" (default) enforces blank newlines around directives.
    • "never" disallows blank newlines around directives.

    or

    {
      "before": "always" or "never"
      "after": "always" or "never",
    }

    always

    This is the default option.

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

    /* eslint lines-around-directive: ["error", "always"] */
    
    /* Top of file */
    "use strict";
    var foo;
    
    /* Top of file */
    // comment
    "use strict";
    "use asm";
    var foo;
    
    function foo() {
      "use strict";
      "use asm";
      var bar;
    }
    
    function foo() {
      // comment
      "use strict";
      var bar;
    }

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

    /* eslint lines-around-directive: ["error", "always"] */
    
    /* Top of file */
    "use strict";
    
    var foo;
    
    /* Top of file */
    // comment
    
    "use strict";
    "use asm";
    
    var foo;
    
    function foo() {
      "use strict";
      "use asm";
    
      var bar;
    }
    
    function foo() {
      // comment
    
      "use strict";
    
      var bar;
    }

    never

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

    /* eslint lines-around-directive: ["error", "never"] */
    
    /* Top of file */
    
    "use strict";
    
    var foo;
    
    
    /* Top of file */
    // comment
    
    "use strict";
    "use asm";
    
    var foo;
    
    
    function foo() {
      "use strict";
      "use asm";
    
      var bar;
    }
    
    
    function foo() {
      // comment
    
      "use strict";
    
      var bar;
    }

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

    /* eslint lines-around-directive: ["error", "never"] */
    
    /* Top of file */
    "use strict";
    var foo;
    
    /* Top of file */
    // comment
    "use strict";
    "use asm";
    var foo;
    
    function foo() {
      "use strict";
      "use asm";
      var bar;
    }
    
    function foo() {
      // comment
      "use strict";
      var bar;
    }

    before & after

    Examples of incorrect code for this rule with the { "before": "never", "after": "always" } option:

    /* eslint lines-around-directive: ["error", { "before": "never", "after": "always" }] */
    
    /* Top of file */
    
    "use strict";
    var foo;
    
    /* Top of file */
    // comment
    
    "use strict";
    "use asm";
    var foo;
    
    function foo() {
      "use strict";
      "use asm";
      var bar;
    }
    
    function foo() {
      // comment
    
      "use strict";
      var bar;
    }

    Examples of correct code for this rule with the { "before": "never", "after": "always" } option:

    /* eslint lines-around-directive: ["error", { "before": "never", "after": "always" }] */
    
    /* Top of file */
    "use strict";
    
    var foo;
    
    /* Top of file */
    // comment
    "use strict";
    "use asm";
    
    var foo;
    
    function foo() {
      "use strict";
      "use asm";
    
      var bar;
    }
    
    function foo() {
      // comment
      "use strict";
    
      var bar;
    }

    Examples of incorrect code for this rule with the { "before": "always", "after": "never" } option:

    /* eslint lines-around-directive: ["error", { "before": "always", "after": "never" }] */
    
    /* Top of file */
    "use strict";
    
    var foo;
    
    /* Top of file */
    // comment
    "use strict";
    "use asm";
    
    var foo;
    
    function foo() {
      "use strict";
      "use asm";
    
      var bar;
    }
    
    function foo() {
      // comment
      "use strict";
    
      var bar;
    }

    Examples of correct code for this rule with the { "before": "always", "after": "never" } option:

    /* eslint lines-around-directive: ["error", { "before": "always", "after": "never" }] */
    
    /* Top of file */
    "use strict";
    var foo;
    
    /* Top of file */
    // comment
    
    "use strict";
    "use asm";
    var foo;
    
    function foo() {
      "use strict";
      "use asm";
      var bar;
    }
    
    function foo() {
      // comment
    
      "use strict";
      var bar;
    }

    When Not To Use It

    You can safely disable this rule if you do not have any strict conventions about whether or not directive prologues should have blank newlines before or after them.

    Related Rules

    • [lines-around-comment](lines-around-comment.md)
    • [padded-blocks](padded-blocks.md)

    Compatibility

    Unexpected function expression.
    Open

      requiredFields.forEach(function (field) {
    Severity: Minor
    Found in bin/tenon-cli.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 dangling '_' in '__esModule'.
    Open

    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

      var tenonApi = new _tenonNode2.default({
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected function expression.
    Open

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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 allOptions = Object.assign({}, configuration, program.commands[0]);
    Severity: Minor
    Found in bin/tenon-cli.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 value = tenonOptions[key];
    Severity: Minor
    Found in bin/tenon-cli.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 _getStdin2 = _interopRequireDefault(_getStdin);
    Severity: Minor
    Found in bin/tenon-cli.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 tenonOptions = {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

      Object.keys(tenonOptions).forEach(function (key) {
    Severity: Minor
    Found in bin/tenon-cli.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 function expression.
    Open

      Object.keys(tenonOptions).forEach(function (key) {
    Severity: Minor
    Found in bin/tenon-cli.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 string concatenation.
    Open

          console.error('Failed to read input file, ' + allOptions.in);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    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 string concatenation, you can safely disable this rule.

    Related Rules

    Unexpected dangling '_' in '_tenonNode'.
    Open

    var _tenonNode = require('tenon-node');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected dangling '_' in '_getStdin'.
    Open

    var _getStdin = require('get-stdin');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

      var program = (0, _.parseCommand)(process.argv);
    Severity: Minor
    Found in bin/tenon-cli.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 bin/tenon-cli.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 source = void 0;
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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 _fs2 = _interopRequireDefault(_fs);
    Severity: Minor
    Found in bin/tenon-cli.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 dangling '_' in '_fs2'.
    Open

    var _fs2 = _interopRequireDefault(_fs);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

    var _tenonNode2 = _interopRequireDefault(_tenonNode);
    Severity: Minor
    Found in bin/tenon-cli.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/

    All 'var' declarations must be at the top of the function scope.
    Open

      var command = program.commands[0].args[0];
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected var, use let or const instead.
    Open

      var configuration = {};
    Severity: Minor
    Found in bin/tenon-cli.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/

    All 'var' declarations must be at the top of the function scope.
    Open

      var allOptions = Object.assign({}, configuration, program.commands[0]);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected var, use let or const instead.
    Open

      var requiredFields = ['key'];
    Severity: Minor
    Found in bin/tenon-cli.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 dangling '_' in '_tenonNode2'.
    Open

    var _tenonNode2 = _interopRequireDefault(_tenonNode);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected dangling '_' in '_interopRequireDefault'.
    Open

    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow dangling underscores in identifiers (no-underscore-dangle)

    As far as naming conventions for identifiers go, dangling underscores may be the most polarizing in JavaScript. Dangling underscores are underscores at either the beginning or end of an identifier, such as:

    var _foo;

    There is actually a long history of using dangling underscores to indicate "private" members of objects in JavaScript (though JavaScript doesn't have truly private members, this convention served as a warning). This began with SpiderMonkey adding nonstandard methods such as __defineGetter__(). The intent with the underscores was to make it obvious that this method was special in some way. Since that time, using a single underscore prefix has become popular as a way to indicate "private" members of objects.

    Whether or not you choose to allow dangling underscores in identifiers is purely a convention and has no effect on performance, readability, or complexity. It's purely a preference.

    Rule Details

    This rule disallows dangling underscores in identifiers.

    Examples of incorrect code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var foo_;
    var __proto__ = {};
    foo._bar();

    Examples of correct code for this rule:

    /*eslint no-underscore-dangle: "error"*/
    
    var _ = require('underscore');
    var obj = _.contains(items, item);
    obj.__proto__ = {};
    var file = __filename;

    Options

    This rule has an object option:

    • "allow" allows specified identifiers to have dangling underscores
    • "allowAfterThis": false (default) disallows dangling underscores in members of the this object
    • "allowAfterSuper": false (default) disallows dangling underscores in members of the super object

    allow

    Examples of additional correct code for this rule with the { "allow": ["foo_", "_bar"] } option:

    /*eslint no-underscore-dangle: ["error", { "allow": ["foo_", "_bar"] }]*/
    
    var foo_;
    foo._bar();

    allowAfterThis

    Examples of correct code for this rule with the { "allowAfterThis": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterThis": true }]*/
    
    var a = this.foo_;
    this._bar();

    allowAfterSuper

    Examples of correct code for this rule with the { "allowAfterSuper": true } option:

    /*eslint no-underscore-dangle: ["error", { "allowAfterSuper": true }]*/
    
    var a = super.foo_;
    super._bar();

    When Not To Use It

    If you want to allow dangling underscores in identifiers, then you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

      var tenonOptions = {
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected function expression.
    Open

      tenonApi.analyze(source, options, function (err, result) {
    Severity: Minor
    Found in bin/tenon-cli.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 _getStdin = require('get-stdin');
    Severity: Minor
    Found in bin/tenon-cli.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/

    All 'var' declarations must be at the top of the function scope.
    Open

      var configuration = {};
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected unnamed function.
    Open

      requiredFields.forEach(function (field) {
    Severity: Minor
    Found in bin/tenon-cli.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 unnamed function.
    Open

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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 function expression.
    Open

            return new Promise(function (resolve) {
    Severity: Minor
    Found in bin/tenon-cli.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 console statement.
    Open

                  console.error('Failed to parse Tenon response into XUnit format');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

                  console.error('Failed to parse Tenon response into CSV format');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

                  console.error(err);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

      console.log('Sending request to Tenon...');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

        console.error('No input HTML specified for analysis');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

          console.error(err);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

          console.error('Failed to read input file, ' + allOptions.in);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unreachable code.
    Open

            break;
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow unreachable code after return, throw, continue, and break statements (no-unreachable)

    Because the return, throw, break, and continue statements unconditionally exit a block of code, any statements after them cannot be executed. Unreachable statements are usually a mistake.

    function fn() {
        x = 1;
        return x;
        x = 3; // this will never execute
    }

    Rule Details

    This rule disallows unreachable code after return, throw, continue, and break statements.

    Examples of incorrect code for this rule:

    /*eslint no-unreachable: "error"*/
    
    function foo() {
        return true;
        console.log("done");
    }
    
    function bar() {
        throw new Error("Oops!");
        console.log("done");
    }
    
    while(value) {
        break;
        console.log("done");
    }
    
    throw new Error("Oops!");
    console.log("done");
    
    function baz() {
        if (Math.random() < 0.5) {
            return;
        } else {
            throw new Error();
        }
        console.log("done");
    }
    
    for (;;) {}
    console.log("done");

    Examples of correct code for this rule, because of JavaScript function and variable hoisting:

    /*eslint no-unreachable: "error"*/
    
    function foo() {
        return bar();
        function bar() {
            return 1;
        }
    }
    
    function bar() {
        return x;
        var x;
    }
    
    switch (foo) {
        case 1:
            break;
            var x;
    }

    Source: http://eslint.org/docs/rules/

    Unexpected console statement.
    Open

                  console.error('Failed to parse Tenon response into HTML format');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

            console.error(JSON.stringify(result, null, '\t'));
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

          console.error(e.message);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

          console.error('Failed to parse or read configuration file...');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

          console.error(e.message);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Missing trailing comma.
    Open

        format: 'json'
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    require or disallow trailing commas (comma-dangle)

    Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

    var foo = {
        bar: "baz",
        qux: "quux",
    };

    Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

    Less clear:

    var foo = {
    -    bar: "baz",
    -    qux: "quux"
    +    bar: "baz"
     };

    More clear:

    var foo = {
         bar: "baz",
    -    qux: "quux",
     };

    Rule Details

    This rule enforces consistent use of trailing commas in object and array literals.

    Options

    This rule has a string option or an object option:

    {
        "comma-dangle": ["error", "never"],
        // or
        "comma-dangle": ["error", {
            "arrays": "never",
            "objects": "never",
            "imports": "never",
            "exports": "never",
            "functions": "ignore",
        }]
    }
    • "never" (default) disallows trailing commas
    • "always" requires trailing commas
    • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
    • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

    Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

    You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

    • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
    • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
    • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
    • exports is for export declarations of ES Modules. (e.g. export {a,};)
    • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
      functions is set to "ignore" by default for consistency with the string option.

    never

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

    /*eslint comma-dangle: ["error", "never"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var arr = [1,2,];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

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

    /*eslint comma-dangle: ["error", "never"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var arr = [1,2];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

    always

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

    /*eslint comma-dangle: ["error", "always"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var arr = [1,2];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

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

    /*eslint comma-dangle: ["error", "always"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var arr = [1,2,];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

    always-multiline

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

    /*eslint comma-dangle: ["error", "always-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var foo = { bar: "baz", qux: "quux", };
    
    var arr = [1,2,];
    
    var arr = [1,
        2,];
    
    var arr = [
        1,
        2
    ];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

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

    /*eslint comma-dangle: ["error", "always-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var foo = {bar: "baz", qux: "quux"};
    var arr = [1,2];
    
    var arr = [1,
        2];
    
    var arr = [
        1,
        2,
    ];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

    only-multiline

    Examples of incorrect code for this rule with the "only-multiline" option:

    /*eslint comma-dangle: ["error", "only-multiline"]*/
    
    var foo = { bar: "baz", qux: "quux", };
    
    var arr = [1,2,];
    
    var arr = [1,
        2,];

    Examples of correct code for this rule with the "only-multiline" option:

    /*eslint comma-dangle: ["error", "only-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var foo = {bar: "baz", qux: "quux"};
    var arr = [1,2];
    
    var arr = [1,
        2];
    
    var arr = [
        1,
        2,
    ];
    
    var arr = [
        1,
        2
    ];
    
    foo({
      bar: "baz",
      qux: "quux",
    });
    
    foo({
      bar: "baz",
      qux: "quux"
    });

    functions

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

    /*eslint comma-dangle: ["error", {"functions": "never"}]*/
    
    function foo(a, b,) {
    }
    
    foo(a, b,);
    new foo(a, b,);

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

    /*eslint comma-dangle: ["error", {"functions": "never"}]*/
    
    function foo(a, b) {
    }
    
    foo(a, b);
    new foo(a, b);

    Examples of incorrect code for this rule with the {"functions": "always"} option:

    /*eslint comma-dangle: ["error", {"functions": "always"}]*/
    
    function foo(a, b) {
    }
    
    foo(a, b);
    new foo(a, b);

    Examples of correct code for this rule with the {"functions": "always"} option:

    /*eslint comma-dangle: ["error", {"functions": "always"}]*/
    
    function foo(a, b,) {
    }
    
    foo(a, b,);
    new foo(a, b,);

    When Not To Use It

    You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

    Unexpected console statement.
    Open

          console.log('Tenon analysis completed.');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

                console.error(e.message);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

          console.log('Analysis complete, report at ' + file);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

                  console.error(err);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

                console.error('Failed to write result to file...');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

        console.error('You have supplied too many arguments, for help type \'tenon --help\'');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Missing trailing comma.
    Open

        viewPortWidth: 'viewPortWidth'
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    require or disallow trailing commas (comma-dangle)

    Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

    var foo = {
        bar: "baz",
        qux: "quux",
    };

    Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

    Less clear:

    var foo = {
    -    bar: "baz",
    -    qux: "quux"
    +    bar: "baz"
     };

    More clear:

    var foo = {
         bar: "baz",
    -    qux: "quux",
     };

    Rule Details

    This rule enforces consistent use of trailing commas in object and array literals.

    Options

    This rule has a string option or an object option:

    {
        "comma-dangle": ["error", "never"],
        // or
        "comma-dangle": ["error", {
            "arrays": "never",
            "objects": "never",
            "imports": "never",
            "exports": "never",
            "functions": "ignore",
        }]
    }
    • "never" (default) disallows trailing commas
    • "always" requires trailing commas
    • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
    • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

    Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

    You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

    • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
    • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
    • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
    • exports is for export declarations of ES Modules. (e.g. export {a,};)
    • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
      functions is set to "ignore" by default for consistency with the string option.

    never

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

    /*eslint comma-dangle: ["error", "never"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var arr = [1,2,];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

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

    /*eslint comma-dangle: ["error", "never"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var arr = [1,2];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

    always

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

    /*eslint comma-dangle: ["error", "always"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var arr = [1,2];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

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

    /*eslint comma-dangle: ["error", "always"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var arr = [1,2,];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

    always-multiline

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

    /*eslint comma-dangle: ["error", "always-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var foo = { bar: "baz", qux: "quux", };
    
    var arr = [1,2,];
    
    var arr = [1,
        2,];
    
    var arr = [
        1,
        2
    ];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

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

    /*eslint comma-dangle: ["error", "always-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var foo = {bar: "baz", qux: "quux"};
    var arr = [1,2];
    
    var arr = [1,
        2];
    
    var arr = [
        1,
        2,
    ];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

    only-multiline

    Examples of incorrect code for this rule with the "only-multiline" option:

    /*eslint comma-dangle: ["error", "only-multiline"]*/
    
    var foo = { bar: "baz", qux: "quux", };
    
    var arr = [1,2,];
    
    var arr = [1,
        2,];

    Examples of correct code for this rule with the "only-multiline" option:

    /*eslint comma-dangle: ["error", "only-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var foo = {bar: "baz", qux: "quux"};
    var arr = [1,2];
    
    var arr = [1,
        2];
    
    var arr = [
        1,
        2,
    ];
    
    var arr = [
        1,
        2
    ];
    
    foo({
      bar: "baz",
      qux: "quux",
    });
    
    foo({
      bar: "baz",
      qux: "quux"
    });

    functions

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

    /*eslint comma-dangle: ["error", {"functions": "never"}]*/
    
    function foo(a, b,) {
    }
    
    foo(a, b,);
    new foo(a, b,);

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

    /*eslint comma-dangle: ["error", {"functions": "never"}]*/
    
    function foo(a, b) {
    }
    
    foo(a, b);
    new foo(a, b);

    Examples of incorrect code for this rule with the {"functions": "always"} option:

    /*eslint comma-dangle: ["error", {"functions": "always"}]*/
    
    function foo(a, b) {
    }
    
    foo(a, b);
    new foo(a, b);

    Examples of correct code for this rule with the {"functions": "always"} option:

    /*eslint comma-dangle: ["error", {"functions": "always"}]*/
    
    function foo(a, b,) {
    }
    
    foo(a, b,);
    new foo(a, b,);

    When Not To Use It

    You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

    Unexpected console statement.
    Open

              console.log('Writing results to file...');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

          console.log('\'' + field + '\' is required');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

                  console.error(err);
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

            console.error('Error occured, format not found');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Missing trailing comma.
    Open

        endPoint: allOptions.endpoint // or your private tenon instance
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    require or disallow trailing commas (comma-dangle)

    Trailing commas in object literals are valid according to the ECMAScript 5 (and ECMAScript 3!) spec. However, IE8 (when not in IE8 document mode) and below will throw an error when it encounters trailing commas in JavaScript.

    var foo = {
        bar: "baz",
        qux: "quux",
    };

    Trailing commas simplify adding and removing items to objects and arrays, since only the lines you are modifying must be touched. Another argument in favor of trailing commas is that it improves the clarity of diffs when an item is added or removed from an object or array:

    Less clear:

    var foo = {
    -    bar: "baz",
    -    qux: "quux"
    +    bar: "baz"
     };

    More clear:

    var foo = {
         bar: "baz",
    -    qux: "quux",
     };

    Rule Details

    This rule enforces consistent use of trailing commas in object and array literals.

    Options

    This rule has a string option or an object option:

    {
        "comma-dangle": ["error", "never"],
        // or
        "comma-dangle": ["error", {
            "arrays": "never",
            "objects": "never",
            "imports": "never",
            "exports": "never",
            "functions": "ignore",
        }]
    }
    • "never" (default) disallows trailing commas
    • "always" requires trailing commas
    • "always-multiline" requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }
    • "only-multiline" allows (but does not require) trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }

    Trailing commas in function declarations and function calls are valid syntax since ECMAScript 2017; however, the string option does not check these situations for backwards compatibility.

    You can also use an object option to configure this rule for each type of syntax. Each of the following options can be set to "never", "always", "always-multiline", "only-multiline", or "ignore". The default for each option is "never" unless otherwise specified.

    • arrays is for array literals and array patterns of destructuring. (e.g. let [a,] = [1,];)
    • objects is for object literals and object patterns of destructuring. (e.g. let {a,} = {a: 1};)
    • imports is for import declarations of ES Modules. (e.g. import {a,} from "foo";)
    • exports is for export declarations of ES Modules. (e.g. export {a,};)
    • functions is for function declarations and function calls. (e.g. (function(a,){ })(b,);)
      functions is set to "ignore" by default for consistency with the string option.

    never

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

    /*eslint comma-dangle: ["error", "never"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var arr = [1,2,];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

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

    /*eslint comma-dangle: ["error", "never"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var arr = [1,2];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

    always

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

    /*eslint comma-dangle: ["error", "always"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var arr = [1,2];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

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

    /*eslint comma-dangle: ["error", "always"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var arr = [1,2,];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

    always-multiline

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

    /*eslint comma-dangle: ["error", "always-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var foo = { bar: "baz", qux: "quux", };
    
    var arr = [1,2,];
    
    var arr = [1,
        2,];
    
    var arr = [
        1,
        2
    ];
    
    foo({
      bar: "baz",
      qux: "quux"
    });

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

    /*eslint comma-dangle: ["error", "always-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var foo = {bar: "baz", qux: "quux"};
    var arr = [1,2];
    
    var arr = [1,
        2];
    
    var arr = [
        1,
        2,
    ];
    
    foo({
      bar: "baz",
      qux: "quux",
    });

    only-multiline

    Examples of incorrect code for this rule with the "only-multiline" option:

    /*eslint comma-dangle: ["error", "only-multiline"]*/
    
    var foo = { bar: "baz", qux: "quux", };
    
    var arr = [1,2,];
    
    var arr = [1,
        2,];

    Examples of correct code for this rule with the "only-multiline" option:

    /*eslint comma-dangle: ["error", "only-multiline"]*/
    
    var foo = {
        bar: "baz",
        qux: "quux",
    };
    
    var foo = {
        bar: "baz",
        qux: "quux"
    };
    
    var foo = {bar: "baz", qux: "quux"};
    var arr = [1,2];
    
    var arr = [1,
        2];
    
    var arr = [
        1,
        2,
    ];
    
    var arr = [
        1,
        2
    ];
    
    foo({
      bar: "baz",
      qux: "quux",
    });
    
    foo({
      bar: "baz",
      qux: "quux"
    });

    functions

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

    /*eslint comma-dangle: ["error", {"functions": "never"}]*/
    
    function foo(a, b,) {
    }
    
    foo(a, b,);
    new foo(a, b,);

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

    /*eslint comma-dangle: ["error", {"functions": "never"}]*/
    
    function foo(a, b) {
    }
    
    foo(a, b);
    new foo(a, b);

    Examples of incorrect code for this rule with the {"functions": "always"} option:

    /*eslint comma-dangle: ["error", {"functions": "always"}]*/
    
    function foo(a, b) {
    }
    
    foo(a, b);
    new foo(a, b);

    Examples of correct code for this rule with the {"functions": "always"} option:

    /*eslint comma-dangle: ["error", {"functions": "always"}]*/
    
    function foo(a, b,) {
    }
    
    foo(a, b,);
    new foo(a, b,);

    When Not To Use It

    You can turn this rule off if you are not concerned with dangling commas. Source: http://eslint.org/docs/rules/

    Unexpected console statement.
    Open

          console.error('Failed to write file...');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

            console.error('Tenon reported an error:');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Unexpected console statement.
    Open

              console.log('Writing results to console...');
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    disallow the use of console (no-console)

    In JavaScript that is designed to be executed in the browser, it's considered a best practice to avoid using methods on console. Such messages are considered to be for debugging purposes and therefore not suitable to ship to the client. In general, calls using console should be stripped before being pushed to production.

    console.log("Made it here.");
    console.error("That shouldn't have happened.");

    Rule Details

    This rule disallows calls to methods of the console object.

    Examples of incorrect code for this rule:

    /*eslint no-console: "error"*/
    
    console.log("Log a debug level message.");
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    Examples of correct code for this rule:

    /*eslint no-console: "error"*/
    
    // custom console
    Console.log("Hello world!");

    Options

    This rule has an object option for exceptions:

    • "allow" has an array of strings which are allowed methods of the console object

    Examples of additional correct code for this rule with a sample { "allow": ["warn", "error"] } option:

    /*eslint no-console: ["error", { allow: ["warn", "error"] }] */
    
    console.warn("Log a warn level message.");
    console.error("Log an error level message.");

    When Not To Use It

    If you're using Node.js, however, console is used to output information to the user and so is not strictly used for debugging purposes. If you are developing for Node.js then you most likely do not want this rule enabled.

    Related Rules

    Expected 'undefined' and instead saw 'void'.
    Open

      var source = void 0;
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    Disallow use of the void operator. (no-void)

    The void operator takes an operand and returns undefined: void expression will evaluate expression and return undefined. It can be used to ignore any side effects expression may produce:

    The common case of using void operator is to get a "pure" undefined value as prior to ES5 the undefined variable was mutable:

    // will always return undefined
    (function(){
        return void 0;
    })();
    
    // will return 1 in ES3 and undefined in ES5+
    (function(){
        undefined = 1;
        return undefined;
    })();
    
    // will throw TypeError in ES5+
    (function(){
        'use strict';
        undefined = 1;
    })();

    Another common case is to minify code as void 0 is shorter than undefined:

    foo = void 0;
    foo = undefined;

    When used with IIFE (immediately-invoked function expression), void can be used to force the function keyword to be treated as an expression instead of a declaration:

    var foo = 1;
    void function(){ foo = 1; }() // will assign foo a value of 1
    +function(){ foo = 1; }() // same as above
    function(){ foo = 1; }() // will throw SyntaxError

    Some code styles prohibit void operator, marking it as non-obvious and hard to read.

    Rule Details

    This rule aims to eliminate use of void operator.

    Examples of incorrect code for this rule:

    /*eslint no-void: "error"*/
    
    void foo
    
    var foo = void bar();

    When Not To Use It

    If you intentionally use the void operator then you can disable this rule.

    Further Reading

    Related Rules

    '_interopRequireDefault' was used before it was defined.
    Open

    var _tenonNode2 = _interopRequireDefault(_tenonNode);
    Severity: Minor
    Found in bin/tenon-cli.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/

    '_interopRequireDefault' was used before it was defined.
    Open

    var _tenonReporters2 = _interopRequireDefault(_tenonReporters);
    Severity: Minor
    Found in bin/tenon-cli.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/

    '_interopRequireDefault' was used before it was defined.
    Open

    var _getStdin2 = _interopRequireDefault(_getStdin);
    Severity: Minor
    Found in bin/tenon-cli.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/

    '_interopRequireDefault' was used before it was defined.
    Open

    var _fs2 = _interopRequireDefault(_fs);
    Severity: Minor
    Found in bin/tenon-cli.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/

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

          parseFormat(result).then(function (formattedResult) {
            if (allOptions.out) {
              console.log('Writing results to file...');
              try {
                writeResultFile(formattedResult, allOptions.out);
    Severity: Major
    Found in bin/tenon-cli.js and 1 other location - About 4 hrs to fix
    tenon-cli.js on lines 206..220

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

    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 3 locations. Consider refactoring.
    Open

          case 'html':
            return new Promise(function (resolve) {
              _tenonReporters2.default.HTML(json, function (err, result) {
                if (err) {
                  console.error('Failed to parse Tenon response into HTML format');
    Severity: Major
    Found in bin/tenon-cli.js and 2 other locations - About 2 hrs to fix
    bin/tenon-cli.js on lines 161..172
    bin/tenon-cli.js on lines 185..196

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

    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 3 locations. Consider refactoring.
    Open

          case 'csv':
            return new Promise(function (resolve) {
              _tenonReporters2.default.CSV(json, function (err, result) {
                if (err) {
                  console.error('Failed to parse Tenon response into CSV format');
    Severity: Major
    Found in bin/tenon-cli.js and 2 other locations - About 2 hrs to fix
    bin/tenon-cli.js on lines 173..184
    bin/tenon-cli.js on lines 185..196

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

    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 3 locations. Consider refactoring.
    Open

          case 'xunit':
            return new Promise(function (resolve) {
              _tenonReporters2.default.XUnit(json, function (err, result) {
                if (err) {
                  console.error('Failed to parse Tenon response into XUnit format');
    Severity: Major
    Found in bin/tenon-cli.js and 2 other locations - About 2 hrs to fix
    bin/tenon-cli.js on lines 161..172
    bin/tenon-cli.js on lines 173..184

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

    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 2 locations. Consider refactoring.
    Open

      Object.keys(tenonOptions).forEach(function (key) {
        var value = tenonOptions[key];
        if (allOptions[key]) {
          if (key === 'store' || key === 'fragment') {
            allOptions[key] = +allOptions[key];
    Severity: Major
    Found in bin/tenon-cli.js and 1 other location - About 2 hrs to fix
    tenon-cli.js on lines 78..86

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

    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 2 locations. Consider refactoring.
    Open

      var tenonOptions = {
        waitFor: 'waitFor',
        level: 'level',
        certainty: 'certainty',
        importance: 'importance',
    Severity: Major
    Found in bin/tenon-cli.js and 1 other location - About 1 hr to fix
    tenon-cli.js on lines 61..74

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

    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

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

          if (result.status >= 400) {
            console.error('Tenon reported an error:');
            console.error(JSON.stringify(result, null, '\t'));
            process.exit(1);
          }
    Severity: Major
    Found in bin/tenon-cli.js and 1 other location - About 1 hr to fix
    tenon-cli.js on lines 199..203

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

    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

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

      if (program.commands[0].args.length > 1) {
        console.error('You have supplied too many arguments, for help type \'tenon --help\'');
        process.exit(1);
      }
    Severity: Minor
    Found in bin/tenon-cli.js and 1 other location - About 55 mins to fix
    tenon-cli.js on lines 15..18

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

    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

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

      requiredFields.forEach(function (field) {
        if (!allOptions[field]) {
          console.log('\'' + field + '\' is required');
          process.exit(1);
        }
    Severity: Minor
    Found in bin/tenon-cli.js and 1 other location - About 35 mins to fix
    tenon-cli.js on lines 97..102

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

    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

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

        try {
          configuration = _fs2.default.readFileSync(program.commands[0].config, 'utf8');
          configuration = JSON.parse(configuration);
        } catch (e) {
          // The json could not be parsed or read
    Severity: Minor
    Found in bin/tenon-cli.js and 1 other location - About 35 mins to fix
    tenon-cli.js on lines 26..34

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

    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

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

      if (process.env.TENON_API_KEY && !allOptions.key) {
        allOptions.key = process.env.TENON_API_KEY;
      }
    Severity: Minor
    Found in bin/tenon-cli.js and 1 other location - About 35 mins to fix
    tenon-cli.js on lines 56..58

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

    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

    npm ignores 'bin/tenon-cli.js'. Check 'files' field of 'package.json' or '.npmignore'.
    Open

    'use strict';
    Severity: Minor
    Found in bin/tenon-cli.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status