tenon-io/tenon-cli

View on GitHub
index.js

Summary

Maintainability
A
2 hrs
Test Coverage

Function parseCommand has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const parseCommand = function(passedArguments) {
  program
  .command('*')
  .description('A CLI for the Tenon Node')
  .option(
Severity: Major
Found in index.js - About 2 hrs to fix

    Line 70 exceeds the maximum line length of 100.
    Open

        // The 'source of truth' options object combining program and file configs, giving program priority
    Severity: Minor
    Found in index.js by eslint

    enforce a maximum line length (max-len)

    Very long lines of code in any language can be difficult to read. In order to aid in readability and maintainability many coders have developed a convention to limit lines of code to X number of characters (traditionally 80 characters).

    var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" }; // very long

    Rule Details

    This rule enforces a maximum line length to increase code readability and maintainability. The length of a line is defined as the number of Unicode characters in the line.

    Options

    This rule has a number or object option:

    • "code" (default 80) enforces a maximum line length
    • "tabWidth" (default 4) specifies the character width for tab characters
    • "comments" enforces a maximum line length for comments; defaults to value of code
    • "ignorePattern" ignores lines matching a regular expression; can only match a single line and need to be double escaped when written in YAML or JSON
    • "ignoreComments": true ignores all trailing comments and comments on their own line
    • "ignoreTrailingComments": true ignores only trailing comments
    • "ignoreUrls": true ignores lines that contain a URL
    • "ignoreStrings": true ignores lines that contain a double-quoted or single-quoted string
    • "ignoreTemplateLiterals": true ignores lines that contain a template literal
    • "ignoreRegExpLiterals": true ignores lines that contain a RegExp literal

    code

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

    /*eslint max-len: ["error", 80]*/
    
    var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" };

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

    /*eslint max-len: ["error", 80]*/
    
    var foo = {
      "bar": "This is a bar.",
      "baz": { "qux": "This is a qux" },
      "easier": "to read"
    };

    tabWidth

    Examples of incorrect code for this rule with the default { "tabWidth": 4 } option:

    /*eslint max-len: ["error", 80, 4]*/
    
    \t  \t  var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" } };

    Examples of correct code for this rule with the default { "tabWidth": 4 } option:

    /*eslint max-len: ["error", 80, 4]*/
    
    \t  \t  var foo = {
    \t  \t  \t  \t  "bar": "This is a bar.",
    \t  \t  \t  \t  "baz": { "qux": "This is a qux" }
    \t  \t  };

    comments

    Examples of incorrect code for this rule with the { "comments": 65 } option:

    /*eslint max-len: ["error", { "comments": 65 }]*/
    
    /**
     * This is a comment that violates the maximum line length we have specified
    **/

    ignoreComments

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

    /*eslint max-len: ["error", { "ignoreComments": true }]*/
    
    /**
     * This is a really really really really really really really really really long comment
    **/

    ignoreTrailingComments

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

    /*eslint max-len: ["error", { "ignoreTrailingComments": true }]*/
    
    var foo = 'bar'; // This is a really really really really really really really long comment

    ignoreUrls

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

    /*eslint max-len: ["error", { "ignoreUrls": true }]*/
    
    var url = 'https://www.example.com/really/really/really/really/really/really/really/long';

    ignoreStrings

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

    /*eslint max-len: ["error", { "ignoreStrings": true }]*/
    
    var longString = 'this is a really really really really really long string!';

    ignoreTemplateLiterals

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

    /*eslint max-len: ["error", { "ignoreTemplateLiterals": true }]*/
    
    var longTemplateLiteral = `this is a really really really really really long template literal!`;

    ignoreRegExpLiterals

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

    /*eslint max-len: ["error", { "ignoreRegExpLiterals": true }]*/
    
    var longRegExpLiteral = /this is a really really really really really long regular expression!/;

    ignorePattern

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

    /*eslint max-len: ["error", { "ignorePattern": "^\\s*var\\s.+=\\s*require\\s*\\(/" }]*/
    
    var dep = require('really/really/really/really/really/really/really/really/long/module');

    Related Rules

    • [complexity](complexity.md)
    • [max-depth](max-depth.md)
    • [max-nested-callbacks](max-nested-callbacks.md)
    • [max-params](max-params.md)
    • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

    Missing trailing comma.
    Open

        'Tenode API key'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'Input file'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'Tenon API endpoint'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'Output file'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        /^(json|html|xunit|csv)$/i
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'An optional value'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'A user-agent to be supplied during Tenode tests'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'Tenode configuration file'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        parseFloat
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        /^(A|AA|AAA)$/i
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        /^(0|20|40|60|80|100)$/i
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        parseFloat
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        /^(0|20|40|60|80|100)$/i
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'A string of text used to identify the page being tested'
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'A string you can supply to identify the tested document as part of a specific system'
    Severity: Minor
    Found in index.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/

    'command' is not defined.
    Open

        command = env;
    Severity: Minor
    Found in index.js by eslint

    Disallow Undeclared Variables (no-undef)

    This rule can help you locate potential ReferenceErrors resulting from misspellings of variable and parameter names, or accidental implicit globals (for example, from forgetting the var keyword in a for loop initializer).

    Rule Details

    Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/ comment.

    Examples of incorrect code for this rule:

    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    Examples of correct code for this rule with global declaration:

    /*global someFunction b:true*/
    /*eslint no-undef: "error"*/
    
    var a = someFunction();
    b = 10;

    The b:true syntax in /*global */ indicates that assignment to b is correct.

    Examples of incorrect code for this rule with global declaration:

    /*global b*/
    /*eslint no-undef: "error"*/
    
    b = 10;

    By default, variables declared in /*global */ are read-only, therefore assignment is incorrect.

    Options

    • typeof set to true will warn for variables used inside typeof check (Default false).

    typeof

    Examples of correct code for the default { "typeof": false } option:

    /*eslint no-undef: "error"*/
    
    if (typeof UndefinedIdentifier === "undefined") {
        // do something ...
    }

    You can use this option if you want to prevent typeof check on a variable which has not been declared.

    Examples of incorrect code for the { "typeof": true } option:

    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Examples of correct code for the { "typeof": true } option with global declaration:

    /*global a*/
    /*eslint no-undef: ["error", { "typeof": true }] */
    
    if(typeof a === "string"){}

    Environments

    For convenience, ESLint provides shortcuts that pre-define global variables exposed by popular libraries and runtime environments. This rule supports these environments, as listed in Specifying Environments. A few examples are given below.

    browser

    Examples of correct code for this rule with browser environment:

    /*eslint no-undef: "error"*/
    /*eslint-env browser*/
    
    setTimeout(function() {
        alert("Hello");
    });

    node

    Examples of correct code for this rule with node environment:

    /*eslint no-undef: "error"*/
    /*eslint-env node*/
    
    var fs = require("fs");
    module.exports = function() {
        console.log(fs);
    };

    When Not To Use It

    If explicit declaration of global variables is not to your taste.

    Compatibility

    This rule provides compatibility with treatment of global variables in JSHint and JSLint. Source: http://eslint.org/docs/rules/

    Missing trailing comma.
    Open

        parseFloat
    Severity: Minor
    Found in index.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/

    Missing trailing comma.
    Open

        'Should Tenode store the results or not?'
    Severity: Minor
    Found in index.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/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected unnamed function.
    Open

    export const parseCommand = function(passedArguments) {
    Severity: Minor
    Found in index.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 line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Missing space before function parentheses.
    Open

    export const parseCommand = function(passedArguments) {
    Severity: Minor
    Found in index.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

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

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

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

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

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

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

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

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

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

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

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

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Missing space before function parentheses.
    Open

      ).action(function(env) {
    Severity: Minor
    Found in index.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

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

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

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

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

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

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

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

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

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

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

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

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Unexpected unnamed function.
    Open

      ).action(function(env) {
    Severity: Minor
    Found in index.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 line break before .parse.
    Open

      }).parse(passedArguments);
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .action.
    Open

      ).action(function(env) {
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected line break before .option.
    Open

      ).option(
    Severity: Minor
    Found in index.js by eslint

    require a newline after each call in a method chain (newline-per-chained-call)

    Chained method calls on a single line without line breaks are harder to read, so some developers place a newline character after each method call in the chain to make it more readable and easy to maintain.

    Let's look at the following perfectly valid (but single line) code.

    d3.select("body").selectAll("p").data([4, 8, 15, 16, 23, 42 ]).enter().append("p").text(function(d) { return "I'm number " + d + "!"; });

    However, with appropriate new lines, it becomes easy to read and understand. Look at the same code written below with line breaks after each call.

    d3
        .select("body")
        .selectAll("p")
        .data([
            4,
            8,
            15,
            16,
            23,
            42
        ])
        .enter()
        .append("p")
        .text(function (d) {
            return "I'm number " + d + "!";
        });

    Another argument in favor of this style is that it improves the clarity of diffs when something in the method chain is changed:

    Less clear:

    -d3.select("body").selectAll("p").style("color", "white");
    +d3.select("body").selectAll("p").style("color", "blue");

    More clear:

    d3
        .select("body")
        .selectAll("p")
    -    .style("color", "white");
    +    .style("color", "blue");

    Rule Details

    This rule requires a newline after each call in a method chain or deep member access. Computed property accesses such as instance[something] are excluded.

    Options

    This rule has an object option:

    • "ignoreChainWithDepth" (default: 2) allows chains up to a specified depth.

    ignoreChainWithDepth

    Examples of incorrect code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _.chain({}).map(foo).filter(bar).value();
    
    // Or
    _.chain({}).map(foo).filter(bar);
    
    // Or
    _
      .chain({}).map(foo)
      .filter(bar);
    
    // Or
    obj.method().method2().method3();

    Examples of correct code for this rule with the default { "ignoreChainWithDepth": 2 } option:

    /*eslint newline-per-chained-call: ["error", { "ignoreChainWithDepth": 2 }]*/
    
    _
      .chain({})
      .map(foo)
      .filter(bar)
      .value();
    
    // Or
    _
      .chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    _.chain({})
      .map(foo)
      .filter(bar);
    
    // Or
    obj
      .prop
      .method().prop;
    
    // Or
    obj
      .prop.method()
      .method2()
      .method3().prop;

    When Not To Use It

    If you have conflicting rules or when you are fine with chained calls on one line, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Block must not be padded by blank lines.
    Open

    };
    Severity: Minor
    Found in index.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

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

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

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

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

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

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

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

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

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

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

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

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

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

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

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

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

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

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

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

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

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

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

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

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

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

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

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

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

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

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

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

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Unexpected function expression.
    Open

      ).action(function(env) {
    Severity: Minor
    Found in index.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/

    Import and Export Declarations are not supported yet on Node v4.
    Open

    import program from 'commander';
    Severity: Minor
    Found in index.js by eslint

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

    Trailing Commas in Function Syntax are not supported yet on Node v4.
    Open

      program
    Severity: Minor
    Found in index.js by eslint

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

    Prefer default export.
    Open

    export const parseCommand = function(passedArguments) {
    Severity: Minor
    Found in index.js by eslint

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

    Import and Export Declarations are not supported yet on Node v4.
    Open

    export const parseCommand = function(passedArguments) {
    Severity: Minor
    Found in index.js by eslint

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

    There are no issues that match your filters.

    Category
    Status