kubosho/kotori

View on GitHub

Showing 51 of 51 total issues

Function transformCore has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  transformCore(config, file, callback) {
    if (file.isNull()) {
      callback(null, file);
      return;
    }
Severity: Minor
Found in src/build.js - About 1 hr to fix

    Line 42 exceeds the maximum line length of 100.
    Open

          const paths = `${PERSONAL_CONFIG_PATH} and ${path.resolve(process.cwd(), LOCAL_CONFIG_FILENAME)}`;
    Severity: Minor
    Found in src/config.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/

    Line 42 exceeds the maximum line length of 100.
    Open

        const statsFileName = path.basename(this.statsTargetFilePath, path.extname(this.statsTargetFilePath));
    Severity: Minor
    Found in src/stats.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/

    Function writeStats has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      writeStats(statsData) {
        const statsFileName = path.basename(this.statsTargetFilePath, path.extname(this.statsTargetFilePath));
        const statsOutputDir = `${process.cwd()}/${this.statsConf.outputDir}`;
        const format = new Format(statsData);
        const formatData = selectFormat(this.statsConf.outputFormat);
    Severity: Minor
    Found in src/stats.js - About 1 hr to fix

      Function default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function(args) {
        let currentOptions;
      
        try {
          currentOptions = options.parse(args);
      Severity: Minor
      Found in src/cli/cli.js - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function activatePostCSSPlugins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function activatePostCSSPlugins(config) {
        const plugins = [];
      
        if (config.lintRules || config.lintRules !== "") {
          // TODO: Throw easy-to-understand error message
      Severity: Minor
      Found in src/build.js - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function parseConfigCore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function parseConfigCore(configItem) {
        if (isObject(configItem) || isJSON(configItem)) {
          try {
            configItem = JSON.parse(configItem);
          } catch (err) {
      Severity: Minor
      Found in src/config.js - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        load() {
          let configLoadErrors = [];
      
          try {
            this.config = loadConfigCore(this.filePath);
      Severity: Minor
      Found in src/config.js - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Expected line before comment.
      Open

          // do nothing
      Severity: Minor
      Found in src/config.js by eslint

      require empty lines around comments (lines-around-comment)

      Many style guides require empty lines before or after comments. The primary goal of these rules is to make the comments easier to read and improve readability of the code.

      Rule Details

      This rule requires empty lines before and/or after comments. It can be enabled separately for both block (/*) and line (//) comments. This rule does not apply to comments that appear on the same line as code and does not require empty lines at the beginning or end of a file.

      Options

      This rule has an object option:

      • "beforeBlockComment": true (default) requires an empty line before block comments
      • "afterBlockComment": true requires an empty line after block comments
      • "beforeLineComment": true requires an empty line before line comments
      • "afterLineComment": true requires an empty line after line comments
      • "allowBlockStart": true allows comments to appear at the start of block statements
      • "allowBlockEnd": true allows comments to appear at the end of block statements
      • "allowObjectStart": true allows comments to appear at the start of object literals
      • "allowObjectEnd": true allows comments to appear at the end of object literals
      • "allowArrayStart": true allows comments to appear at the start of array literals
      • "allowArrayEnd": true allows comments to appear at the end of array literals
      • "applyDefaultIgnorePatterns" enables or disables the default comment patterns to be ignored by the rule
      • "ignorePattern" custom patterns to be ignored by the rule

      beforeBlockComment

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

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/
      
      var night = "long";
      /* what a great and wonderful day */
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/
      
      var night = "long";
      
      /* what a great and wonderful day */
      var day = "great"

      afterBlockComment

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

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/
      
      var night = "long";
      
      /* what a great and wonderful day */
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/
      
      var night = "long";
      
      /* what a great and wonderful day */
      
      var day = "great"

      beforeLineComment

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

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/
      
      var night = "long";
      // what a great and wonderful day
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/
      
      var night = "long";
      
      // what a great and wonderful day
      var day = "great"

      afterLineComment

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

      /*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/
      
      var night = "long";
      // what a great and wonderful day
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/
      
      var night = "long";
      // what a great and wonderful day
      
      var day = "great"

      allowBlockStart

      Examples of correct code for this rule with the { "beforeLineComment": true, "allowBlockStart": true } options:

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowBlockStart": true }]*/
      
      function foo(){
          // what a great and wonderful day
          var day = "great"
          return day;
      }

      Examples of correct code for this rule with the { "beforeBlockComment": true, "allowBlockStart": true } options:

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowBlockStart": true }]*/
      
      function foo(){
          /* what a great and wonderful day */
          var day = "great"
          return day;
      }

      allowBlockEnd

      Examples of correct code for this rule with the { "afterLineComment": true, "allowBlockEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowBlockEnd": true }]*/
      
      function foo(){
          var day = "great"
          return day;
          // what a great and wonderful day
      }

      Examples of correct code for this rule with the { "afterBlockComment": true, "allowBlockEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowBlockEnd": true }]*/
      
      function foo(){
          var day = "great"
          return day;
      
          /* what a great and wonderful day */
      }

      allowObjectStart

      Examples of correct code for this rule with the { "beforeLineComment": true, "allowObjectStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowObjectStart": true }]*/
      
      var foo = {
          // what a great and wonderful day
          day: "great"
      };
      
      const {
          // what a great and wonderful day
          foo: someDay
      } = {foo: "great"};
      
      const {
          // what a great and wonderful day
          day
      } = {day: "great"};

      Examples of correct code for this rule with the { "beforeBlockComment": true, "allowObjectStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowObjectStart": true }]*/
      
      var foo = {
          /* what a great and wonderful day */
          day: "great"
      };
      
      const {
          /* what a great and wonderful day */
          foo: someDay
      } = {foo: "great"};
      
      const {
          /* what a great and wonderful day */
          day
      } = {day: "great"};

      allowObjectEnd

      Examples of correct code for this rule with the { "afterLineComment": true, "allowObjectEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowObjectEnd": true }]*/
      
      var foo = {
          day: "great"
          // what a great and wonderful day
      };
      
      const {
          foo: someDay
          // what a great and wonderful day
      } = {foo: "great"};
      
      const {
          day
          // what a great and wonderful day
      } = {day: "great"};

      Examples of correct code for this rule with the { "afterBlockComment": true, "allowObjectEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowObjectEnd": true }]*/
      
      var foo = {
          day: "great"
      
          /* what a great and wonderful day */
      };
      
      const {
          foo: someDay
      
          /* what a great and wonderful day */
      } = {foo: "great"};
      
      const {
          day
      
          /* what a great and wonderful day */
      } = {day: "great"};

      allowArrayStart

      Examples of correct code for this rule with the { "beforeLineComment": true, "allowArrayStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowArrayStart": true }]*/
      
      var day = [
          // what a great and wonderful day
          "great",
          "wonderful"
      ];
      
      const [
          // what a great and wonderful day
          someDay
      ] = ["great", "not great"];

      Examples of correct code for this rule with the { "beforeBlockComment": true, "allowArrayStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowArrayStart": true }]*/
      
      var day = [
          /* what a great and wonderful day */
          "great",
          "wonderful"
      ];
      
      const [
          /* what a great and wonderful day */
          someDay
      ] = ["great", "not great"];

      allowArrayEnd

      Examples of correct code for this rule with the { "afterLineComment": true, "allowArrayEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowArrayEnd": true }]*/
      
      var day = [
          "great",
          "wonderful"
          // what a great and wonderful day
      ];
      
      const [
          someDay
          // what a great and wonderful day
      ] = ["great", "not great"];

      Examples of correct code for this rule with the { "afterBlockComment": true, "allowArrayEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowArrayEnd": true }]*/
      
      var day = [
          "great",
          "wonderful"
      
          /* what a great and wonderful day */
      ];
      
      const [
          someDay
      
          /* what a great and wonderful day */
      ] = ["great", "not great"];

      ignorePattern

      By default this rule ignores comments starting with the following words: eslint, jshint, jslint, istanbul, global, exported, jscs. An alternative regular expression can be provided.

      Examples of correct code for the ignorePattern option:

      /*eslint lines-around-comment: ["error"]*/
      
      foo();
      /* eslint mentioned in this comment */,
      bar();
      
      
      /*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */
      
      foo();
      /* a valid comment using pragma in it */

      Examples of incorrect code for the ignorePattern option:

      /*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */
      
      1 + 1;
      /* something else */

      applyDefaultIgnorePatterns

      Default ignore patterns are applied even when ignorePattern is provided. If you want to omit default patterns, set this option to false.

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

      /*eslint lines-around-comment: ["error", { "ignorePattern": "pragma", applyDefaultIgnorePatterns: false }] */
      
      foo();
      /* a valid comment using pragma in it */

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

      /*eslint lines-around-comment: ["error", { "applyDefaultIgnorePatterns": false }] */
      
      foo();
      /* eslint mentioned in comment */

      When Not To Use It

      Many people enjoy a terser code style and don't mind comments bumping up against code. If you fall into that category this rule is not for you.

      Related Rules

      Identifier name 'activatePostCSSPlugins' is too long (> 16).
      Open

      function activatePostCSSPlugins(config) {
      Severity: Minor
      Found in src/build.js by eslint

      enforce minimum and maximum identifier lengths (id-length)

      Very short identifier names like e, x, _t or very long ones like hashGeneratorResultOutputContainerObject can make code harder to read and potentially less maintainable. To prevent this, one may enforce a minimum and/or maximum identifier length.

      var x = 5; // too short; difficult to understand its purpose without context

      Rule Details

      This rule enforces a minimum and/or maximum identifier length convention.

      Options

      Examples of incorrect code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var x = 5;
      obj.e = document.body;
      var foo = function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (a) => { a * a };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var num = 5;
      function _f() { return 42; }
      function _func() { return 42; }
      obj.el = document.body;
      var foo = function (evt) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (num) => { num * num };
      function foo(num = 0) { }
      class MyClass { }
      class Foo { method() {} }
      function foo(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.longName }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has a shorthand integer option for the "min" object property.

      Examples of incorrect code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has an object option:

      • "min" (default: 2) enforces a minimum identifier length
      • "max" (default: Infinity) enforces a maximum identifier length
      • "properties": always (default) enforces identifier length convention for property names
      • "properties": never ignores identifier length convention for property names
      • "exceptions" allows an array of specified identifier names

      min

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      max

      Examples of incorrect code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var reallyLongVarName = 5;
      function reallyLongFuncName() { return 42; }
      obj.reallyLongPropName = document.body;
      var foo = function (reallyLongArgName) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (reallyLongErrorName) {
          // ignore as many do
      }
      (reallyLongArgName) => { return !reallyLongArgName; };

      Examples of correct code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var varName = 5;
      function funcName() { return 42; }
      obj.propName = document.body;
      var foo = function (arg) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      (arg) => { return !arg; };

      properties

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

      /*eslint id-length: ["error", { "properties": "never" }]*/
      /*eslint-env es6*/
      
      var myObj = { a: 1 };
      ({ a: obj.x.y.z }) = {};
      ({ prop: obj.i }) = {};

      exceptions

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

      /*eslint id-length: ["error", { "exceptions": ["x"] }]*/
      /*eslint-env es6*/
      
      var x = 5;
      function x() { return 42; }
      obj.x = document.body;
      var foo = function (x) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (x) {
          // ignore as many do
      }
      (x) => { return x * x; };

      Related Rules

      Expected indentation of 4 spaces but found 6.
      Open

            break;
      Severity: Minor
      Found in src/stats.js by eslint

      enforce consistent indentation (indent)

      There are several common guidelines which require specific indentation of nested blocks and statements, like:

      function hello(indentSize, type) {
          if (indentSize === 4 && type !== 'tab') {
              console.log('Each next indentation will increase on 4 spaces');
          }
      }

      These are the most common scenarios recommended in different style guides:

      • Two spaces, not longer and no tabs: Google, npm, Node.js, Idiomatic, Felix
      • Tabs: jQuery
      • Four spaces: Crockford

      Rule Details

      This rule enforces a consistent indentation style. The default style is 4 spaces.

      Options

      This rule has a mixed option:

      For example, for 2-space indentation:

      {
          "indent": ["error", 2]
      }

      Or for tabbed indentation:

      {
          "indent": ["error", "tab"]
      }

      Examples of incorrect code for this rule with the default options:

      /*eslint indent: "error"*/
      
      if (a) {
        b=c;
        function foo(d) {
          e=f;
        }
      }

      Examples of correct code for this rule with the default options:

      /*eslint indent: "error"*/
      
      if (a) {
          b=c;
          function foo(d) {
              e=f;
          }
      }

      This rule has an object option:

      • "SwitchCase" (default: 0) enforces indentation level for case clauses in switch statements
      • "VariableDeclarator" (default: 1) enforces indentation level for var declarators; can also take an object to define separate rules for var, let and const declarations.
      • "outerIIFEBody" (default: 1) enforces indentation level for file-level IIFEs.
      • "MemberExpression" (off by default) enforces indentation level for multi-line property chains (except in variable declarations and assignments)
      • "FunctionDeclaration" takes an object to define rules for function declarations.
        • parameters (off by default) enforces indentation level for parameters in a function declaration. This can either be a number indicating indentation level, or the string "first" indicating that all parameters of the declaration must be aligned with the first parameter.
        • body (default: 1) enforces indentation level for the body of a function declaration.
      • "FunctionExpression" takes an object to define rules for function expressions.
        • parameters (off by default) enforces indentation level for parameters in a function expression. This can either be a number indicating indentation level, or the string "first" indicating that all parameters of the expression must be aligned with the first parameter.
        • body (default: 1) enforces indentation level for the body of a function expression.
      • "CallExpression" takes an object to define rules for function call expressions.
        • arguments (off by default) enforces indentation level for arguments in a call expression. This can either be a number indicating indentation level, or the string "first" indicating that all arguments of the expression must be aligned with the first argument.
      • "ArrayExpression" (default: 1) enforces indentation level for elements in arrays. It can also be set to the string "first", indicating that all the elements in the array should be aligned with the first element.
      • "ObjectExpression" (default: 1) enforces indentation level for properties in objects. It can be set to the string "first", indicating that all properties in the object should be aligned with the first property.

      Level of indentation denotes the multiple of the indent specified. Example:

      • Indent of 4 spaces with VariableDeclarator set to 2 will indent the multi-line variable declarations with 8 spaces.
      • Indent of 2 spaces with VariableDeclarator set to 2 will indent the multi-line variable declarations with 4 spaces.
      • Indent of 2 spaces with VariableDeclarator set to {"var": 2, "let": 2, "const": 3} will indent the multi-line variable declarations with 4 spaces for var and let, 6 spaces for const statements.
      • Indent of tab with VariableDeclarator set to 2 will indent the multi-line variable declarations with 2 tabs.
      • Indent of 2 spaces with SwitchCase set to 0 will not indent case clauses with respect to switch statements.
      • Indent of 2 spaces with SwitchCase set to 1 will indent case clauses with 2 spaces with respect to switch statements.
      • Indent of 2 spaces with SwitchCase set to 2 will indent case clauses with 4 spaces with respect to switch statements.
      • Indent of tab with SwitchCase set to 2 will indent case clauses with 2 tabs with respect to switch statements.
      • Indent of 2 spaces with MemberExpression set to 0 will indent the multi-line property chains with 0 spaces.
      • Indent of 2 spaces with MemberExpression set to 1 will indent the multi-line property chains with 2 spaces.
      • Indent of 2 spaces with MemberExpression set to 2 will indent the multi-line property chains with 4 spaces.
      • Indent of 4 spaces with MemberExpression set to 0 will indent the multi-line property chains with 0 spaces.
      • Indent of 4 spaces with MemberExpression set to 1 will indent the multi-line property chains with 4 spaces.
      • Indent of 4 spaces with MemberExpression set to 2 will indent the multi-line property chains with 8 spaces.

      tab

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

      /*eslint indent: ["error", "tab"]*/
      
      if (a) {
           b=c;
      function foo(d) {
                 e=f;
       }
      }

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

      /*eslint indent: ["error", "tab"]*/
      
      if (a) {
      /*tab*/b=c;
      /*tab*/function foo(d) {
      /*tab*//*tab*/e=f;
      /*tab*/}
      }

      SwitchCase

      Examples of incorrect code for this rule with the 2, { "SwitchCase": 1 } options:

      /*eslint indent: ["error", 2, { "SwitchCase": 1 }]*/
      
      switch(a){
      case "a":
          break;
      case "b":
          break;
      }

      Examples of correct code for this rule with the 2, { "SwitchCase": 1 } option:

      /*eslint indent: ["error", 2, { "SwitchCase": 1 }]*/
      
      switch(a){
        case "a":
          break;
        case "b":
          break;
      }

      VariableDeclarator

      Examples of incorrect code for this rule with the 2, { "VariableDeclarator": 1 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 1 }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
          b = 2,
          c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": 1 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 1 }]*/
      /*eslint-env es6*/
      
      var a,
        b,
        c;
      let a,
        b,
        c;
      const a = 1,
        b = 2,
        c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": 2 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 2 }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
          b = 2,
          c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
            b = 2,
            c = 3;

      outerIIFEBody

      Examples of incorrect code for this rule with the options 2, { "outerIIFEBody": 0 }:

      /*eslint indent: ["error", 2, { "outerIIFEBody": 0 }]*/
      
      (function() {
      
        function foo(x) {
          return x + 1;
        }
      
      })();
      
      
      if(y) {
      console.log('foo');
      }

      Examples of correct code for this rule with the options 2, {"outerIIFEBody": 0}:

      /*eslint indent: ["error", 2, { "outerIIFEBody": 0 }]*/
      
      (function() {
      
      function foo(x) {
        return x + 1;
      }
      
      })();
      
      
      if(y) {
         console.log('foo');
      }

      MemberExpression

      Examples of incorrect code for this rule with the 2, { "MemberExpression": 1 } options:

      /*eslint indent: ["error", 2, { "MemberExpression": 1 }]*/
      
      foo
      .bar
      .baz()

      Examples of correct code for this rule with the 2, { "MemberExpression": 1 } option:

      /*eslint indent: ["error", 2, { "MemberExpression": 1 }]*/
      
      foo
        .bar
        .baz();
      
      // Any indentation is permitted in variable declarations and assignments.
      var bip = aardvark.badger
                        .coyote;

      FunctionDeclaration

      Examples of incorrect code for this rule with the 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
      
      function foo(bar,
        baz,
        qux) {
          qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
      
      function foo(bar,
          baz,
          qux) {
        qux();
      }

      Examples of incorrect code for this rule with the 2, { "FunctionDeclaration": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
      
      function foo(bar, baz,
        qux, boop) {
        qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionDeclaration": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
      
      function foo(bar, baz,
                   qux, boop) {
        qux();
      }

      FunctionExpression

      Examples of incorrect code for this rule with the 2, { "FunctionExpression": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
      
      var foo = function(bar,
        baz,
        qux) {
          qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionExpression": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
      
      var foo = function(bar,
          baz,
          qux) {
        qux();
      }

      Examples of incorrect code for this rule with the 2, { "FunctionExpression": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
      
      var foo = function(bar, baz,
        qux, boop) {
        qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionExpression": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
      
      var foo = function(bar, baz,
                         qux, boop) {
        qux();
      }

      CallExpression

      Examples of incorrect code for this rule with the 2, { "CallExpression": {"arguments": 1} } option:

      /*eslint indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
      
      foo(bar,
          baz,
            qux
      );

      Examples of correct code for this rule with the 2, { "CallExpression": {"arguments": 1} } option:

      /*eslint indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
      
      foo(bar,
        baz,
        qux
      );

      Examples of incorrect code for this rule with the 2, { "CallExpression": {"arguments": "first"} } option:

      /*eslint indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
      
      foo(bar, baz,
        baz, boop, beep);

      Examples of correct code for this rule with the 2, { "CallExpression": {"arguments": "first"} } option:

      /*eslint indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
      
      foo(bar, baz,
          baz, boop, beep);

      ArrayExpression

      Examples of incorrect code for this rule with the 2, { "ArrayExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ArrayExpression": 1 }]*/
      
      var foo = [
          bar,
      baz,
            qux
      ];

      Examples of correct code for this rule with the 2, { "ArrayExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ArrayExpression": 1 }]*/
      
      var foo = [
        bar,
        baz,
        qux
      ];

      Examples of incorrect code for this rule with the 2, { "ArrayExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ArrayExpression": "first"}]*/
      
      var foo = [bar,
        baz,
        qux
      ];

      Examples of correct code for this rule with the 2, { "ArrayExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ArrayExpression": "first"}]*/
      
      var foo = [bar,
                 baz,
                 qux
      ];

      ObjectExpression

      Examples of incorrect code for this rule with the 2, { "ObjectExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ObjectExpression": 1 }]*/
      
      var foo = {
          bar: 1,
      baz: 2,
            qux: 3
      };

      Examples of correct code for this rule with the 2, { "ObjectExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ObjectExpression": 1 }]*/
      
      var foo = {
        bar: 1,
        baz: 2,
        qux: 3
      };

      Examples of incorrect code for this rule with the 2, { "ObjectExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
      
      var foo = { bar: 1,
        baz: 2 };

      Examples of correct code for this rule with the 2, { "ObjectExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
      
      var foo = { bar: 1,
                  baz: 2 };

      Compatibility

      Identifier name 'LOCAL_CONFIG_FILENAME' is too long (> 16).
      Open

      const LOCAL_CONFIG_FILENAME = ".kotorirc";
      Severity: Minor
      Found in src/config.js by eslint

      enforce minimum and maximum identifier lengths (id-length)

      Very short identifier names like e, x, _t or very long ones like hashGeneratorResultOutputContainerObject can make code harder to read and potentially less maintainable. To prevent this, one may enforce a minimum and/or maximum identifier length.

      var x = 5; // too short; difficult to understand its purpose without context

      Rule Details

      This rule enforces a minimum and/or maximum identifier length convention.

      Options

      Examples of incorrect code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var x = 5;
      obj.e = document.body;
      var foo = function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (a) => { a * a };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var num = 5;
      function _f() { return 42; }
      function _func() { return 42; }
      obj.el = document.body;
      var foo = function (evt) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (num) => { num * num };
      function foo(num = 0) { }
      class MyClass { }
      class Foo { method() {} }
      function foo(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.longName }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has a shorthand integer option for the "min" object property.

      Examples of incorrect code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has an object option:

      • "min" (default: 2) enforces a minimum identifier length
      • "max" (default: Infinity) enforces a maximum identifier length
      • "properties": always (default) enforces identifier length convention for property names
      • "properties": never ignores identifier length convention for property names
      • "exceptions" allows an array of specified identifier names

      min

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      max

      Examples of incorrect code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var reallyLongVarName = 5;
      function reallyLongFuncName() { return 42; }
      obj.reallyLongPropName = document.body;
      var foo = function (reallyLongArgName) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (reallyLongErrorName) {
          // ignore as many do
      }
      (reallyLongArgName) => { return !reallyLongArgName; };

      Examples of correct code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var varName = 5;
      function funcName() { return 42; }
      obj.propName = document.body;
      var foo = function (arg) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      (arg) => { return !arg; };

      properties

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

      /*eslint id-length: ["error", { "properties": "never" }]*/
      /*eslint-env es6*/
      
      var myObj = { a: 1 };
      ({ a: obj.x.y.z }) = {};
      ({ prop: obj.i }) = {};

      exceptions

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

      /*eslint id-length: ["error", { "exceptions": ["x"] }]*/
      /*eslint-env es6*/
      
      var x = 5;
      function x() { return 42; }
      obj.x = document.body;
      var foo = function (x) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (x) {
          // ignore as many do
      }
      (x) => { return x * x; };

      Related Rules

      Expected indentation of 2 spaces but found 4.
      Open

          default:
      Severity: Minor
      Found in src/stats.js by eslint

      enforce consistent indentation (indent)

      There are several common guidelines which require specific indentation of nested blocks and statements, like:

      function hello(indentSize, type) {
          if (indentSize === 4 && type !== 'tab') {
              console.log('Each next indentation will increase on 4 spaces');
          }
      }

      These are the most common scenarios recommended in different style guides:

      • Two spaces, not longer and no tabs: Google, npm, Node.js, Idiomatic, Felix
      • Tabs: jQuery
      • Four spaces: Crockford

      Rule Details

      This rule enforces a consistent indentation style. The default style is 4 spaces.

      Options

      This rule has a mixed option:

      For example, for 2-space indentation:

      {
          "indent": ["error", 2]
      }

      Or for tabbed indentation:

      {
          "indent": ["error", "tab"]
      }

      Examples of incorrect code for this rule with the default options:

      /*eslint indent: "error"*/
      
      if (a) {
        b=c;
        function foo(d) {
          e=f;
        }
      }

      Examples of correct code for this rule with the default options:

      /*eslint indent: "error"*/
      
      if (a) {
          b=c;
          function foo(d) {
              e=f;
          }
      }

      This rule has an object option:

      • "SwitchCase" (default: 0) enforces indentation level for case clauses in switch statements
      • "VariableDeclarator" (default: 1) enforces indentation level for var declarators; can also take an object to define separate rules for var, let and const declarations.
      • "outerIIFEBody" (default: 1) enforces indentation level for file-level IIFEs.
      • "MemberExpression" (off by default) enforces indentation level for multi-line property chains (except in variable declarations and assignments)
      • "FunctionDeclaration" takes an object to define rules for function declarations.
        • parameters (off by default) enforces indentation level for parameters in a function declaration. This can either be a number indicating indentation level, or the string "first" indicating that all parameters of the declaration must be aligned with the first parameter.
        • body (default: 1) enforces indentation level for the body of a function declaration.
      • "FunctionExpression" takes an object to define rules for function expressions.
        • parameters (off by default) enforces indentation level for parameters in a function expression. This can either be a number indicating indentation level, or the string "first" indicating that all parameters of the expression must be aligned with the first parameter.
        • body (default: 1) enforces indentation level for the body of a function expression.
      • "CallExpression" takes an object to define rules for function call expressions.
        • arguments (off by default) enforces indentation level for arguments in a call expression. This can either be a number indicating indentation level, or the string "first" indicating that all arguments of the expression must be aligned with the first argument.
      • "ArrayExpression" (default: 1) enforces indentation level for elements in arrays. It can also be set to the string "first", indicating that all the elements in the array should be aligned with the first element.
      • "ObjectExpression" (default: 1) enforces indentation level for properties in objects. It can be set to the string "first", indicating that all properties in the object should be aligned with the first property.

      Level of indentation denotes the multiple of the indent specified. Example:

      • Indent of 4 spaces with VariableDeclarator set to 2 will indent the multi-line variable declarations with 8 spaces.
      • Indent of 2 spaces with VariableDeclarator set to 2 will indent the multi-line variable declarations with 4 spaces.
      • Indent of 2 spaces with VariableDeclarator set to {"var": 2, "let": 2, "const": 3} will indent the multi-line variable declarations with 4 spaces for var and let, 6 spaces for const statements.
      • Indent of tab with VariableDeclarator set to 2 will indent the multi-line variable declarations with 2 tabs.
      • Indent of 2 spaces with SwitchCase set to 0 will not indent case clauses with respect to switch statements.
      • Indent of 2 spaces with SwitchCase set to 1 will indent case clauses with 2 spaces with respect to switch statements.
      • Indent of 2 spaces with SwitchCase set to 2 will indent case clauses with 4 spaces with respect to switch statements.
      • Indent of tab with SwitchCase set to 2 will indent case clauses with 2 tabs with respect to switch statements.
      • Indent of 2 spaces with MemberExpression set to 0 will indent the multi-line property chains with 0 spaces.
      • Indent of 2 spaces with MemberExpression set to 1 will indent the multi-line property chains with 2 spaces.
      • Indent of 2 spaces with MemberExpression set to 2 will indent the multi-line property chains with 4 spaces.
      • Indent of 4 spaces with MemberExpression set to 0 will indent the multi-line property chains with 0 spaces.
      • Indent of 4 spaces with MemberExpression set to 1 will indent the multi-line property chains with 4 spaces.
      • Indent of 4 spaces with MemberExpression set to 2 will indent the multi-line property chains with 8 spaces.

      tab

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

      /*eslint indent: ["error", "tab"]*/
      
      if (a) {
           b=c;
      function foo(d) {
                 e=f;
       }
      }

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

      /*eslint indent: ["error", "tab"]*/
      
      if (a) {
      /*tab*/b=c;
      /*tab*/function foo(d) {
      /*tab*//*tab*/e=f;
      /*tab*/}
      }

      SwitchCase

      Examples of incorrect code for this rule with the 2, { "SwitchCase": 1 } options:

      /*eslint indent: ["error", 2, { "SwitchCase": 1 }]*/
      
      switch(a){
      case "a":
          break;
      case "b":
          break;
      }

      Examples of correct code for this rule with the 2, { "SwitchCase": 1 } option:

      /*eslint indent: ["error", 2, { "SwitchCase": 1 }]*/
      
      switch(a){
        case "a":
          break;
        case "b":
          break;
      }

      VariableDeclarator

      Examples of incorrect code for this rule with the 2, { "VariableDeclarator": 1 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 1 }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
          b = 2,
          c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": 1 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 1 }]*/
      /*eslint-env es6*/
      
      var a,
        b,
        c;
      let a,
        b,
        c;
      const a = 1,
        b = 2,
        c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": 2 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 2 }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
          b = 2,
          c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
            b = 2,
            c = 3;

      outerIIFEBody

      Examples of incorrect code for this rule with the options 2, { "outerIIFEBody": 0 }:

      /*eslint indent: ["error", 2, { "outerIIFEBody": 0 }]*/
      
      (function() {
      
        function foo(x) {
          return x + 1;
        }
      
      })();
      
      
      if(y) {
      console.log('foo');
      }

      Examples of correct code for this rule with the options 2, {"outerIIFEBody": 0}:

      /*eslint indent: ["error", 2, { "outerIIFEBody": 0 }]*/
      
      (function() {
      
      function foo(x) {
        return x + 1;
      }
      
      })();
      
      
      if(y) {
         console.log('foo');
      }

      MemberExpression

      Examples of incorrect code for this rule with the 2, { "MemberExpression": 1 } options:

      /*eslint indent: ["error", 2, { "MemberExpression": 1 }]*/
      
      foo
      .bar
      .baz()

      Examples of correct code for this rule with the 2, { "MemberExpression": 1 } option:

      /*eslint indent: ["error", 2, { "MemberExpression": 1 }]*/
      
      foo
        .bar
        .baz();
      
      // Any indentation is permitted in variable declarations and assignments.
      var bip = aardvark.badger
                        .coyote;

      FunctionDeclaration

      Examples of incorrect code for this rule with the 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
      
      function foo(bar,
        baz,
        qux) {
          qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
      
      function foo(bar,
          baz,
          qux) {
        qux();
      }

      Examples of incorrect code for this rule with the 2, { "FunctionDeclaration": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
      
      function foo(bar, baz,
        qux, boop) {
        qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionDeclaration": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
      
      function foo(bar, baz,
                   qux, boop) {
        qux();
      }

      FunctionExpression

      Examples of incorrect code for this rule with the 2, { "FunctionExpression": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
      
      var foo = function(bar,
        baz,
        qux) {
          qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionExpression": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
      
      var foo = function(bar,
          baz,
          qux) {
        qux();
      }

      Examples of incorrect code for this rule with the 2, { "FunctionExpression": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
      
      var foo = function(bar, baz,
        qux, boop) {
        qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionExpression": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
      
      var foo = function(bar, baz,
                         qux, boop) {
        qux();
      }

      CallExpression

      Examples of incorrect code for this rule with the 2, { "CallExpression": {"arguments": 1} } option:

      /*eslint indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
      
      foo(bar,
          baz,
            qux
      );

      Examples of correct code for this rule with the 2, { "CallExpression": {"arguments": 1} } option:

      /*eslint indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
      
      foo(bar,
        baz,
        qux
      );

      Examples of incorrect code for this rule with the 2, { "CallExpression": {"arguments": "first"} } option:

      /*eslint indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
      
      foo(bar, baz,
        baz, boop, beep);

      Examples of correct code for this rule with the 2, { "CallExpression": {"arguments": "first"} } option:

      /*eslint indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
      
      foo(bar, baz,
          baz, boop, beep);

      ArrayExpression

      Examples of incorrect code for this rule with the 2, { "ArrayExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ArrayExpression": 1 }]*/
      
      var foo = [
          bar,
      baz,
            qux
      ];

      Examples of correct code for this rule with the 2, { "ArrayExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ArrayExpression": 1 }]*/
      
      var foo = [
        bar,
        baz,
        qux
      ];

      Examples of incorrect code for this rule with the 2, { "ArrayExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ArrayExpression": "first"}]*/
      
      var foo = [bar,
        baz,
        qux
      ];

      Examples of correct code for this rule with the 2, { "ArrayExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ArrayExpression": "first"}]*/
      
      var foo = [bar,
                 baz,
                 qux
      ];

      ObjectExpression

      Examples of incorrect code for this rule with the 2, { "ObjectExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ObjectExpression": 1 }]*/
      
      var foo = {
          bar: 1,
      baz: 2,
            qux: 3
      };

      Examples of correct code for this rule with the 2, { "ObjectExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ObjectExpression": 1 }]*/
      
      var foo = {
        bar: 1,
        baz: 2,
        qux: 3
      };

      Examples of incorrect code for this rule with the 2, { "ObjectExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
      
      var foo = { bar: 1,
        baz: 2 };

      Examples of correct code for this rule with the 2, { "ObjectExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
      
      var foo = { bar: 1,
                  baz: 2 };

      Compatibility

      Expected return with your callback function.
      Open

                callback(null, file);
      Severity: Minor
      Found in src/build.js by eslint

      Enforce Return After Callback (callback-return)

      The callback pattern is at the heart of most I/O and event-driven programming in JavaScript.

      function doSomething(err, callback) {
          if (err) {
              return callback(err);
          }
          callback();
      }

      To prevent calling the callback multiple times it is important to return anytime the callback is triggered outside of the main function body. Neglecting this technique often leads to issues where you do something more than once. For example, in the case of an HTTP request, you may try to send HTTP headers more than once leading Node.js to throw a Can't render headers after they are sent to the client. error.

      Rule Details

      This rule is aimed at ensuring that callbacks used outside of the main function block are always part-of or immediately preceding a return statement. This rule decides what is a callback based on the name of the function being called.

      Options

      The rule takes a single option - an array of possible callback names - which may include object methods. The default callback names are callback, cb, next.

      Default callback names

      Examples of incorrect code for this rule with the default ["callback", "cb", "next"] option:

      /*eslint callback-return: "error"*/
      
      function foo(err, callback) {
          if (err) {
              callback(err);
          }
          callback();
      }

      Examples of correct code for this rule with the default ["callback", "cb", "next"] option:

      /*eslint callback-return: "error"*/
      
      function foo(err, callback) {
          if (err) {
              return callback(err);
          }
          callback();
      }

      Supplied callback names

      Examples of incorrect code for this rule with the option ["done", "send.error", "send.success"]:

      /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
      
      function foo(err, done) {
          if (err) {
              done(err);
          }
          done();
      }
      
      function bar(err, send) {
          if (err) {
              send.error(err);
          }
          send.success();
      }

      Examples of correct code for this rule with the option ["done", "send.error", "send.success"]:

      /*eslint callback-return: ["error", ["done", "send.error", "send.success"]]*/
      
      function foo(err, done) {
          if (err) {
              return done(err);
          }
          done();
      }
      
      function bar(err, send) {
          if (err) {
              return send.error(err);
          }
          send.success();
      }

      Known Limitations

      Because it is difficult to understand the meaning of a program through static analysis, this rule has limitations:

      • false negatives when this rule reports correct code, but the program calls the callback more than one time (which is incorrect behavior)
      • false positives when this rule reports incorrect code, but the program calls the callback only one time (which is correct behavior)

      Passing the callback by reference

      The static analysis of this rule does not detect that the program calls the callback if it is an argument of a function (for example, setTimeout).

      Example of a false negative when this rule reports correct code:

      /*eslint callback-return: "error"*/
      
      function foo(err, callback) {
          if (err) {
              setTimeout(callback, 0); // this is bad, but WILL NOT warn
          }
          callback();
      }

      Triggering the callback within a nested function

      The static analysis of this rule does not detect that the program calls the callback from within a nested function or an immediately-invoked function expression (IIFE).

      Example of a false negative when this rule reports correct code:

      /*eslint callback-return: "error"*/
      
      function foo(err, callback) {
          if (err) {
              process.nextTick(function() {
                  return callback(); // this is bad, but WILL NOT warn
              });
          }
          callback();
      }

      If/else statements

      The static analysis of this rule does not detect that the program calls the callback only one time in each branch of an if statement.

      Example of a false positive when this rule reports incorrect code:

      /*eslint callback-return: "error"*/
      
      function foo(err, callback) {
          if (err) {
              callback(err); // this is fine, but WILL warn
          } else {
              callback();    // this is fine, but WILL warn
          }
      }

      When Not To Use It

      There are some cases where you might want to call a callback function more than once. In those cases this rule may lead to incorrect behavior. In those cases you may want to reserve a special name for those callbacks and not include that in the list of callbacks that trigger warnings.

      Further Reading

      Related Rules

      Identifier name 'KOTORI_CONFIG_DIR' is too long (> 16).
      Open

      const KOTORI_CONFIG_DIR = path.resolve(__dirname, "../conf/");
      Severity: Minor
      Found in src/config.js by eslint

      enforce minimum and maximum identifier lengths (id-length)

      Very short identifier names like e, x, _t or very long ones like hashGeneratorResultOutputContainerObject can make code harder to read and potentially less maintainable. To prevent this, one may enforce a minimum and/or maximum identifier length.

      var x = 5; // too short; difficult to understand its purpose without context

      Rule Details

      This rule enforces a minimum and/or maximum identifier length convention.

      Options

      Examples of incorrect code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var x = 5;
      obj.e = document.body;
      var foo = function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (a) => { a * a };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var num = 5;
      function _f() { return 42; }
      function _func() { return 42; }
      obj.el = document.body;
      var foo = function (evt) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (num) => { num * num };
      function foo(num = 0) { }
      class MyClass { }
      class Foo { method() {} }
      function foo(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.longName }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has a shorthand integer option for the "min" object property.

      Examples of incorrect code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has an object option:

      • "min" (default: 2) enforces a minimum identifier length
      • "max" (default: Infinity) enforces a maximum identifier length
      • "properties": always (default) enforces identifier length convention for property names
      • "properties": never ignores identifier length convention for property names
      • "exceptions" allows an array of specified identifier names

      min

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      max

      Examples of incorrect code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var reallyLongVarName = 5;
      function reallyLongFuncName() { return 42; }
      obj.reallyLongPropName = document.body;
      var foo = function (reallyLongArgName) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (reallyLongErrorName) {
          // ignore as many do
      }
      (reallyLongArgName) => { return !reallyLongArgName; };

      Examples of correct code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var varName = 5;
      function funcName() { return 42; }
      obj.propName = document.body;
      var foo = function (arg) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      (arg) => { return !arg; };

      properties

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

      /*eslint id-length: ["error", { "properties": "never" }]*/
      /*eslint-env es6*/
      
      var myObj = { a: 1 };
      ({ a: obj.x.y.z }) = {};
      ({ prop: obj.i }) = {};

      exceptions

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

      /*eslint id-length: ["error", { "exceptions": ["x"] }]*/
      /*eslint-env es6*/
      
      var x = 5;
      function x() { return 42; }
      obj.x = document.body;
      var foo = function (x) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (x) {
          // ignore as many do
      }
      (x) => { return x * x; };

      Related Rules

      Identifier name 'PERSONAL_CONFIG_PATH' is too long (> 16).
      Open

      const PERSONAL_CONFIG_PATH = userHome ? `${userHome}/${LOCAL_CONFIG_FILENAME}` : null;
      Severity: Minor
      Found in src/config.js by eslint

      enforce minimum and maximum identifier lengths (id-length)

      Very short identifier names like e, x, _t or very long ones like hashGeneratorResultOutputContainerObject can make code harder to read and potentially less maintainable. To prevent this, one may enforce a minimum and/or maximum identifier length.

      var x = 5; // too short; difficult to understand its purpose without context

      Rule Details

      This rule enforces a minimum and/or maximum identifier length convention.

      Options

      Examples of incorrect code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var x = 5;
      obj.e = document.body;
      var foo = function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (a) => { a * a };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with the default options:

      /*eslint id-length: "error"*/     // default is minimum 2-chars ({ "min": 2 })
      /*eslint-env es6*/
      
      var num = 5;
      function _f() { return 42; }
      function _func() { return 42; }
      obj.el = document.body;
      var foo = function (evt) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (num) => { num * num };
      function foo(num = 0) { }
      class MyClass { }
      class Foo { method() {} }
      function foo(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.longName }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has a shorthand integer option for the "min" object property.

      Examples of incorrect code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

      Examples of correct code for this rule with a minimum of 4:

      /*eslint id-length: ["error", 4]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      This rule has an object option:

      • "min" (default: 2) enforces a minimum identifier length
      • "max" (default: Infinity) enforces a maximum identifier length
      • "properties": always (default) enforces identifier length convention for property names
      • "properties": never ignores identifier length convention for property names
      • "exceptions" allows an array of specified identifier names

      min

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var val = 5;
      obj.e = document.body;
      function (e) { };
      try {
          dangerousStuff();
      } catch (e) {
          // ignore as many do
      }
      var myObj = { a: 1 };
      (val) => { val * val };
      class x { }
      class Foo { x() {} }
      function foo(...x) { }
      var { x } = {};
      var { x: a} = {};
      var { a: [x]} = {};
      ({ prop: obj.x }) = {};

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

      /*eslint id-length: ["error", { "min": 4 }]*/
      /*eslint-env es6*/
      
      var value = 5;
      function func() { return 42; }
      obj.element = document.body;
      var foo = function (event) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      var myObj = { apple: 1 };
      (value) => { value * value };
      function foobar(value = 0) { }
      class MyClass { }
      class Foobar { method() {} }
      function foobar(...args) { }
      var { prop } = {};
      var { prop: a } = {};
      var { prop: [x] } = {};
      ({ prop: obj.name }) = {};
      var data = { "x": 1 };  // excused because of quotes
      data["y"] = 3;  // excused because of calculated property access

      max

      Examples of incorrect code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var reallyLongVarName = 5;
      function reallyLongFuncName() { return 42; }
      obj.reallyLongPropName = document.body;
      var foo = function (reallyLongArgName) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (reallyLongErrorName) {
          // ignore as many do
      }
      (reallyLongArgName) => { return !reallyLongArgName; };

      Examples of correct code for this rule with the { "max": 10 } option:

      /*eslint id-length: ["error", { "max": "10" }]*/
      /*eslint-env es6*/
      
      var varName = 5;
      function funcName() { return 42; }
      obj.propName = document.body;
      var foo = function (arg) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (error) {
          // ignore as many do
      }
      (arg) => { return !arg; };

      properties

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

      /*eslint id-length: ["error", { "properties": "never" }]*/
      /*eslint-env es6*/
      
      var myObj = { a: 1 };
      ({ a: obj.x.y.z }) = {};
      ({ prop: obj.i }) = {};

      exceptions

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

      /*eslint id-length: ["error", { "exceptions": ["x"] }]*/
      /*eslint-env es6*/
      
      var x = 5;
      function x() { return 42; }
      obj.x = document.body;
      var foo = function (x) { /* do stuff */ };
      try {
          dangerousStuff();
      } catch (x) {
          // ignore as many do
      }
      (x) => { return x * x; };

      Related Rules

      Identifier 'KOTORI_CONFIG_DIR' does not match the pattern '^[a-z|A-Z]+([A-Z][a-z]+)*$'.
      Open

            this.config = loadConfigCore(`${KOTORI_CONFIG_DIR}/${LOCAL_CONFIG_FILENAME}`);
      Severity: Minor
      Found in src/config.js by eslint

      require identifiers to match a specified regular expression (id-match)

      "There are only two hard things in Computer Science: cache invalidation and naming things." — Phil Karlton

      Naming things consistently in a project is an often underestimated aspect of code creation. When done correctly, it can save your team hours of unnecessary head scratching and misdirections. This rule allows you to precisely define and enforce the variables and function names on your team should use. No more limiting yourself to camelCase, snake_case, PascalCase or oHungarianNotation. Id-match has all your needs covered!

      Rule Details

      This rule requires identifiers in assignments and function definitions to match a specified regular expression.

      Options

      This rule has a string option for the specified regular expression.

      For example, to enforce a camelcase naming convention:

      {
          "id-match": ["error", "^[a-z]+([A-Z][a-z]+)*$"]
      }

      Examples of correct code for this rule with the "^[a-z]+([A-Z][a-z]+)*$" option:

      /*eslint id-match: ["error", "^[a-z]+([A-Z][a-z]+)*$"]*/
      
      var myFavoriteColor   = "#112C85";
      var foo = bar.baz_boom;
      var foo = { qux: bar.baz_boom };
      do_something();
      var obj = {
          my_pref: 1
      };

      Examples of incorrect code for this rule with the "^[a-z]+([A-Z][a-z]+)*$" option:

      /*eslint id-match: ["error", "^[a-z]+([A-Z][a-z]+)*$"]*/
      
      var my_favorite_color = "#112C85";
      var _myFavoriteColor  = "#112C85";
      var myFavoriteColor_  = "#112C85";
      var MY_FAVORITE_COLOR = "#112C85";
      function do_something() {
          // ...
      }
      obj.do_something = function() {
          // ...
      };

      This rule has an object option:

      • "properties": true requires object properties to match the specified regular expression
      • "onlyDeclarations": true requires only var, function, and class declarations to match the specified regular expression

      properties

      Examples of incorrect code for this rule with the "^[a-z]+([A-Z][a-z]+)*$", { "properties": true } options:

      /*eslint id-match: ["error", "^[a-z]+([A-Z][a-z]+)*$", { "properties": true }]*/
      
      var obj = {
          my_pref: 1
      };

      onlyDeclarations

      Examples of correct code for this rule with the "^[a-z]+([A-Z][a-z]+)*$", { "onlyDeclarations": true } options:

      /*eslint id-match: [2, "^[a-z]+([A-Z][a-z]+)*$", { "onlyDeclarations": true }]*/
      
      do_something(__dirname);

      When Not To Use It

      If your rules are too complex, it is possible that you encounter performance issues due to the nature of the job. Source: http://eslint.org/docs/rules/

      Expected line before comment.
      Open

            // configItem is Object.
      Severity: Minor
      Found in src/config.js by eslint

      require empty lines around comments (lines-around-comment)

      Many style guides require empty lines before or after comments. The primary goal of these rules is to make the comments easier to read and improve readability of the code.

      Rule Details

      This rule requires empty lines before and/or after comments. It can be enabled separately for both block (/*) and line (//) comments. This rule does not apply to comments that appear on the same line as code and does not require empty lines at the beginning or end of a file.

      Options

      This rule has an object option:

      • "beforeBlockComment": true (default) requires an empty line before block comments
      • "afterBlockComment": true requires an empty line after block comments
      • "beforeLineComment": true requires an empty line before line comments
      • "afterLineComment": true requires an empty line after line comments
      • "allowBlockStart": true allows comments to appear at the start of block statements
      • "allowBlockEnd": true allows comments to appear at the end of block statements
      • "allowObjectStart": true allows comments to appear at the start of object literals
      • "allowObjectEnd": true allows comments to appear at the end of object literals
      • "allowArrayStart": true allows comments to appear at the start of array literals
      • "allowArrayEnd": true allows comments to appear at the end of array literals
      • "applyDefaultIgnorePatterns" enables or disables the default comment patterns to be ignored by the rule
      • "ignorePattern" custom patterns to be ignored by the rule

      beforeBlockComment

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

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/
      
      var night = "long";
      /* what a great and wonderful day */
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true }]*/
      
      var night = "long";
      
      /* what a great and wonderful day */
      var day = "great"

      afterBlockComment

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

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/
      
      var night = "long";
      
      /* what a great and wonderful day */
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true }]*/
      
      var night = "long";
      
      /* what a great and wonderful day */
      
      var day = "great"

      beforeLineComment

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

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/
      
      var night = "long";
      // what a great and wonderful day
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true }]*/
      
      var night = "long";
      
      // what a great and wonderful day
      var day = "great"

      afterLineComment

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

      /*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/
      
      var night = "long";
      // what a great and wonderful day
      var day = "great"

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

      /*eslint lines-around-comment: ["error", { "afterLineComment": true }]*/
      
      var night = "long";
      // what a great and wonderful day
      
      var day = "great"

      allowBlockStart

      Examples of correct code for this rule with the { "beforeLineComment": true, "allowBlockStart": true } options:

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowBlockStart": true }]*/
      
      function foo(){
          // what a great and wonderful day
          var day = "great"
          return day;
      }

      Examples of correct code for this rule with the { "beforeBlockComment": true, "allowBlockStart": true } options:

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowBlockStart": true }]*/
      
      function foo(){
          /* what a great and wonderful day */
          var day = "great"
          return day;
      }

      allowBlockEnd

      Examples of correct code for this rule with the { "afterLineComment": true, "allowBlockEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowBlockEnd": true }]*/
      
      function foo(){
          var day = "great"
          return day;
          // what a great and wonderful day
      }

      Examples of correct code for this rule with the { "afterBlockComment": true, "allowBlockEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowBlockEnd": true }]*/
      
      function foo(){
          var day = "great"
          return day;
      
          /* what a great and wonderful day */
      }

      allowObjectStart

      Examples of correct code for this rule with the { "beforeLineComment": true, "allowObjectStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowObjectStart": true }]*/
      
      var foo = {
          // what a great and wonderful day
          day: "great"
      };
      
      const {
          // what a great and wonderful day
          foo: someDay
      } = {foo: "great"};
      
      const {
          // what a great and wonderful day
          day
      } = {day: "great"};

      Examples of correct code for this rule with the { "beforeBlockComment": true, "allowObjectStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowObjectStart": true }]*/
      
      var foo = {
          /* what a great and wonderful day */
          day: "great"
      };
      
      const {
          /* what a great and wonderful day */
          foo: someDay
      } = {foo: "great"};
      
      const {
          /* what a great and wonderful day */
          day
      } = {day: "great"};

      allowObjectEnd

      Examples of correct code for this rule with the { "afterLineComment": true, "allowObjectEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowObjectEnd": true }]*/
      
      var foo = {
          day: "great"
          // what a great and wonderful day
      };
      
      const {
          foo: someDay
          // what a great and wonderful day
      } = {foo: "great"};
      
      const {
          day
          // what a great and wonderful day
      } = {day: "great"};

      Examples of correct code for this rule with the { "afterBlockComment": true, "allowObjectEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowObjectEnd": true }]*/
      
      var foo = {
          day: "great"
      
          /* what a great and wonderful day */
      };
      
      const {
          foo: someDay
      
          /* what a great and wonderful day */
      } = {foo: "great"};
      
      const {
          day
      
          /* what a great and wonderful day */
      } = {day: "great"};

      allowArrayStart

      Examples of correct code for this rule with the { "beforeLineComment": true, "allowArrayStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeLineComment": true, "allowArrayStart": true }]*/
      
      var day = [
          // what a great and wonderful day
          "great",
          "wonderful"
      ];
      
      const [
          // what a great and wonderful day
          someDay
      ] = ["great", "not great"];

      Examples of correct code for this rule with the { "beforeBlockComment": true, "allowArrayStart": true } option:

      /*eslint lines-around-comment: ["error", { "beforeBlockComment": true, "allowArrayStart": true }]*/
      
      var day = [
          /* what a great and wonderful day */
          "great",
          "wonderful"
      ];
      
      const [
          /* what a great and wonderful day */
          someDay
      ] = ["great", "not great"];

      allowArrayEnd

      Examples of correct code for this rule with the { "afterLineComment": true, "allowArrayEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterLineComment": true, "allowArrayEnd": true }]*/
      
      var day = [
          "great",
          "wonderful"
          // what a great and wonderful day
      ];
      
      const [
          someDay
          // what a great and wonderful day
      ] = ["great", "not great"];

      Examples of correct code for this rule with the { "afterBlockComment": true, "allowArrayEnd": true } option:

      /*eslint lines-around-comment: ["error", { "afterBlockComment": true, "allowArrayEnd": true }]*/
      
      var day = [
          "great",
          "wonderful"
      
          /* what a great and wonderful day */
      ];
      
      const [
          someDay
      
          /* what a great and wonderful day */
      ] = ["great", "not great"];

      ignorePattern

      By default this rule ignores comments starting with the following words: eslint, jshint, jslint, istanbul, global, exported, jscs. An alternative regular expression can be provided.

      Examples of correct code for the ignorePattern option:

      /*eslint lines-around-comment: ["error"]*/
      
      foo();
      /* eslint mentioned in this comment */,
      bar();
      
      
      /*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */
      
      foo();
      /* a valid comment using pragma in it */

      Examples of incorrect code for the ignorePattern option:

      /*eslint lines-around-comment: ["error", { "ignorePattern": "pragma" }] */
      
      1 + 1;
      /* something else */

      applyDefaultIgnorePatterns

      Default ignore patterns are applied even when ignorePattern is provided. If you want to omit default patterns, set this option to false.

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

      /*eslint lines-around-comment: ["error", { "ignorePattern": "pragma", applyDefaultIgnorePatterns: false }] */
      
      foo();
      /* a valid comment using pragma in it */

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

      /*eslint lines-around-comment: ["error", { "applyDefaultIgnorePatterns": false }] */
      
      foo();
      /* eslint mentioned in comment */

      When Not To Use It

      Many people enjoy a terser code style and don't mind comments bumping up against code. If you fall into that category this rule is not for you.

      Related Rules

      Expected indentation of 2 spaces but found 4.
      Open

          case "html":
      Severity: Minor
      Found in src/stats.js by eslint

      enforce consistent indentation (indent)

      There are several common guidelines which require specific indentation of nested blocks and statements, like:

      function hello(indentSize, type) {
          if (indentSize === 4 && type !== 'tab') {
              console.log('Each next indentation will increase on 4 spaces');
          }
      }

      These are the most common scenarios recommended in different style guides:

      • Two spaces, not longer and no tabs: Google, npm, Node.js, Idiomatic, Felix
      • Tabs: jQuery
      • Four spaces: Crockford

      Rule Details

      This rule enforces a consistent indentation style. The default style is 4 spaces.

      Options

      This rule has a mixed option:

      For example, for 2-space indentation:

      {
          "indent": ["error", 2]
      }

      Or for tabbed indentation:

      {
          "indent": ["error", "tab"]
      }

      Examples of incorrect code for this rule with the default options:

      /*eslint indent: "error"*/
      
      if (a) {
        b=c;
        function foo(d) {
          e=f;
        }
      }

      Examples of correct code for this rule with the default options:

      /*eslint indent: "error"*/
      
      if (a) {
          b=c;
          function foo(d) {
              e=f;
          }
      }

      This rule has an object option:

      • "SwitchCase" (default: 0) enforces indentation level for case clauses in switch statements
      • "VariableDeclarator" (default: 1) enforces indentation level for var declarators; can also take an object to define separate rules for var, let and const declarations.
      • "outerIIFEBody" (default: 1) enforces indentation level for file-level IIFEs.
      • "MemberExpression" (off by default) enforces indentation level for multi-line property chains (except in variable declarations and assignments)
      • "FunctionDeclaration" takes an object to define rules for function declarations.
        • parameters (off by default) enforces indentation level for parameters in a function declaration. This can either be a number indicating indentation level, or the string "first" indicating that all parameters of the declaration must be aligned with the first parameter.
        • body (default: 1) enforces indentation level for the body of a function declaration.
      • "FunctionExpression" takes an object to define rules for function expressions.
        • parameters (off by default) enforces indentation level for parameters in a function expression. This can either be a number indicating indentation level, or the string "first" indicating that all parameters of the expression must be aligned with the first parameter.
        • body (default: 1) enforces indentation level for the body of a function expression.
      • "CallExpression" takes an object to define rules for function call expressions.
        • arguments (off by default) enforces indentation level for arguments in a call expression. This can either be a number indicating indentation level, or the string "first" indicating that all arguments of the expression must be aligned with the first argument.
      • "ArrayExpression" (default: 1) enforces indentation level for elements in arrays. It can also be set to the string "first", indicating that all the elements in the array should be aligned with the first element.
      • "ObjectExpression" (default: 1) enforces indentation level for properties in objects. It can be set to the string "first", indicating that all properties in the object should be aligned with the first property.

      Level of indentation denotes the multiple of the indent specified. Example:

      • Indent of 4 spaces with VariableDeclarator set to 2 will indent the multi-line variable declarations with 8 spaces.
      • Indent of 2 spaces with VariableDeclarator set to 2 will indent the multi-line variable declarations with 4 spaces.
      • Indent of 2 spaces with VariableDeclarator set to {"var": 2, "let": 2, "const": 3} will indent the multi-line variable declarations with 4 spaces for var and let, 6 spaces for const statements.
      • Indent of tab with VariableDeclarator set to 2 will indent the multi-line variable declarations with 2 tabs.
      • Indent of 2 spaces with SwitchCase set to 0 will not indent case clauses with respect to switch statements.
      • Indent of 2 spaces with SwitchCase set to 1 will indent case clauses with 2 spaces with respect to switch statements.
      • Indent of 2 spaces with SwitchCase set to 2 will indent case clauses with 4 spaces with respect to switch statements.
      • Indent of tab with SwitchCase set to 2 will indent case clauses with 2 tabs with respect to switch statements.
      • Indent of 2 spaces with MemberExpression set to 0 will indent the multi-line property chains with 0 spaces.
      • Indent of 2 spaces with MemberExpression set to 1 will indent the multi-line property chains with 2 spaces.
      • Indent of 2 spaces with MemberExpression set to 2 will indent the multi-line property chains with 4 spaces.
      • Indent of 4 spaces with MemberExpression set to 0 will indent the multi-line property chains with 0 spaces.
      • Indent of 4 spaces with MemberExpression set to 1 will indent the multi-line property chains with 4 spaces.
      • Indent of 4 spaces with MemberExpression set to 2 will indent the multi-line property chains with 8 spaces.

      tab

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

      /*eslint indent: ["error", "tab"]*/
      
      if (a) {
           b=c;
      function foo(d) {
                 e=f;
       }
      }

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

      /*eslint indent: ["error", "tab"]*/
      
      if (a) {
      /*tab*/b=c;
      /*tab*/function foo(d) {
      /*tab*//*tab*/e=f;
      /*tab*/}
      }

      SwitchCase

      Examples of incorrect code for this rule with the 2, { "SwitchCase": 1 } options:

      /*eslint indent: ["error", 2, { "SwitchCase": 1 }]*/
      
      switch(a){
      case "a":
          break;
      case "b":
          break;
      }

      Examples of correct code for this rule with the 2, { "SwitchCase": 1 } option:

      /*eslint indent: ["error", 2, { "SwitchCase": 1 }]*/
      
      switch(a){
        case "a":
          break;
        case "b":
          break;
      }

      VariableDeclarator

      Examples of incorrect code for this rule with the 2, { "VariableDeclarator": 1 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 1 }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
          b = 2,
          c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": 1 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 1 }]*/
      /*eslint-env es6*/
      
      var a,
        b,
        c;
      let a,
        b,
        c;
      const a = 1,
        b = 2,
        c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": 2 } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": 2 }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
          b = 2,
          c = 3;

      Examples of correct code for this rule with the 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } } options:

      /*eslint indent: ["error", 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } }]*/
      /*eslint-env es6*/
      
      var a,
          b,
          c;
      let a,
          b,
          c;
      const a = 1,
            b = 2,
            c = 3;

      outerIIFEBody

      Examples of incorrect code for this rule with the options 2, { "outerIIFEBody": 0 }:

      /*eslint indent: ["error", 2, { "outerIIFEBody": 0 }]*/
      
      (function() {
      
        function foo(x) {
          return x + 1;
        }
      
      })();
      
      
      if(y) {
      console.log('foo');
      }

      Examples of correct code for this rule with the options 2, {"outerIIFEBody": 0}:

      /*eslint indent: ["error", 2, { "outerIIFEBody": 0 }]*/
      
      (function() {
      
      function foo(x) {
        return x + 1;
      }
      
      })();
      
      
      if(y) {
         console.log('foo');
      }

      MemberExpression

      Examples of incorrect code for this rule with the 2, { "MemberExpression": 1 } options:

      /*eslint indent: ["error", 2, { "MemberExpression": 1 }]*/
      
      foo
      .bar
      .baz()

      Examples of correct code for this rule with the 2, { "MemberExpression": 1 } option:

      /*eslint indent: ["error", 2, { "MemberExpression": 1 }]*/
      
      foo
        .bar
        .baz();
      
      // Any indentation is permitted in variable declarations and assignments.
      var bip = aardvark.badger
                        .coyote;

      FunctionDeclaration

      Examples of incorrect code for this rule with the 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
      
      function foo(bar,
        baz,
        qux) {
          qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionDeclaration": {"body": 1, "parameters": 2} }]*/
      
      function foo(bar,
          baz,
          qux) {
        qux();
      }

      Examples of incorrect code for this rule with the 2, { "FunctionDeclaration": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
      
      function foo(bar, baz,
        qux, boop) {
        qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionDeclaration": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionDeclaration": {"parameters": "first"}}]*/
      
      function foo(bar, baz,
                   qux, boop) {
        qux();
      }

      FunctionExpression

      Examples of incorrect code for this rule with the 2, { "FunctionExpression": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
      
      var foo = function(bar,
        baz,
        qux) {
          qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionExpression": {"body": 1, "parameters": 2} } option:

      /*eslint indent: ["error", 2, { "FunctionExpression": {"body": 1, "parameters": 2} }]*/
      
      var foo = function(bar,
          baz,
          qux) {
        qux();
      }

      Examples of incorrect code for this rule with the 2, { "FunctionExpression": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
      
      var foo = function(bar, baz,
        qux, boop) {
        qux();
      }

      Examples of correct code for this rule with the 2, { "FunctionExpression": {"parameters": "first"} } option:

      /*eslint indent: ["error", 2, {"FunctionExpression": {"parameters": "first"}}]*/
      
      var foo = function(bar, baz,
                         qux, boop) {
        qux();
      }

      CallExpression

      Examples of incorrect code for this rule with the 2, { "CallExpression": {"arguments": 1} } option:

      /*eslint indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
      
      foo(bar,
          baz,
            qux
      );

      Examples of correct code for this rule with the 2, { "CallExpression": {"arguments": 1} } option:

      /*eslint indent: ["error", 2, { "CallExpression": {"arguments": 1} }]*/
      
      foo(bar,
        baz,
        qux
      );

      Examples of incorrect code for this rule with the 2, { "CallExpression": {"arguments": "first"} } option:

      /*eslint indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
      
      foo(bar, baz,
        baz, boop, beep);

      Examples of correct code for this rule with the 2, { "CallExpression": {"arguments": "first"} } option:

      /*eslint indent: ["error", 2, {"CallExpression": {"arguments": "first"}}]*/
      
      foo(bar, baz,
          baz, boop, beep);

      ArrayExpression

      Examples of incorrect code for this rule with the 2, { "ArrayExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ArrayExpression": 1 }]*/
      
      var foo = [
          bar,
      baz,
            qux
      ];

      Examples of correct code for this rule with the 2, { "ArrayExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ArrayExpression": 1 }]*/
      
      var foo = [
        bar,
        baz,
        qux
      ];

      Examples of incorrect code for this rule with the 2, { "ArrayExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ArrayExpression": "first"}]*/
      
      var foo = [bar,
        baz,
        qux
      ];

      Examples of correct code for this rule with the 2, { "ArrayExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ArrayExpression": "first"}]*/
      
      var foo = [bar,
                 baz,
                 qux
      ];

      ObjectExpression

      Examples of incorrect code for this rule with the 2, { "ObjectExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ObjectExpression": 1 }]*/
      
      var foo = {
          bar: 1,
      baz: 2,
            qux: 3
      };

      Examples of correct code for this rule with the 2, { "ObjectExpression": 1 } option:

      /*eslint indent: ["error", 2, { "ObjectExpression": 1 }]*/
      
      var foo = {
        bar: 1,
        baz: 2,
        qux: 3
      };

      Examples of incorrect code for this rule with the 2, { "ObjectExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
      
      var foo = { bar: 1,
        baz: 2 };

      Examples of correct code for this rule with the 2, { "ObjectExpression": "first" } option:

      /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
      
      var foo = { bar: 1,
                  baz: 2 };

      Compatibility

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

          if (this.config.env !== void 0) {
      Severity: Minor
      Found in src/build.js by eslint

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

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

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

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

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

      foo = void 0;
      foo = undefined;

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

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

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

      Rule Details

      This rule aims to eliminate use of void operator.

      Examples of incorrect code for this rule:

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

      When Not To Use It

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

      Further Reading

      Related Rules

      Severity
      Category
      Status
      Source
      Language