AutolabJS/AutolabJS

View on GitHub
main_server/admin.js

Summary

Maintainability
C
1 day
Test Coverage

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

module.exports = function(socket)
{


    if(socket.handshake.session.key)
Severity: Major
Found in main_server/admin.js - About 4 hrs to fix

    Line 130 exceeds the maximum line length of 100.
    Open

        // Continuously check the reval directory to check if the end file exists for 30 seconds, after which a link
    Severity: Minor
    Found in main_server/admin.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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function(socket)
    {
    
    
        if(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.js - About 1 hr 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

    'config' is assigned a value but never used.
    Open

    var config = require('/etc/main_server/conf.json');
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    'io' is assigned a value but never used.
    Open

    var io = require('socket.io');
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    'exec' is assigned a value but never used.
    Open

    var exec = require('child_process').exec
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
    Open

            for(var rev in data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Guarding for-in (guard-for-in)

    Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

    for (key in foo) {
        doSomething(key);
    }

    Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

    Rule Details

    This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

    Examples of incorrect code for this rule:

    /*eslint guard-for-in: "error"*/
    
    for (key in foo) {
        doSomething(key);
    }

    Examples of correct code for this rule:

    /*eslint guard-for-in: "error"*/
    
    for (key in foo) {
        if (Object.prototype.hasOwnProperty.call(foo, key)) {
            doSomething(key);
        }
        if ({}.hasOwnProperty.call(foo, key)) {
            doSomething(key);
        }
    }

    Related Rules

    • [no-prototype-builtins](no-prototype-builtins.md)

    Further Reading

    Assignment to property of function parameter 'socket'.
    Open

                socket.handshake.session.key = data.key;
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Reassignment of Function Parameters (no-param-reassign)

    Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments object. Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.

    This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.

    Rule Details

    This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.

    Examples of incorrect code for this rule:

    /*eslint no-param-reassign: "error"*/
    
    function foo(bar) {
        bar = 13;
    }
    
    function foo(bar) {
        bar++;
    }

    Examples of correct code for this rule:

    /*eslint no-param-reassign: "error"*/
    
    function foo(bar) {
        var baz = bar;
    }

    Options

    This rule takes one option, an object, with a boolean property "props" and an array "ignorePropertyModificationsFor". "props" is false by default. If "props" is set to true, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor", which is an empty array by default.

    props

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

    /*eslint no-param-reassign: ["error", { "props": false }]*/
    
    function foo(bar) {
        bar.prop = "value";
    }
    
    function foo(bar) {
        delete bar.aaa;
    }
    
    function foo(bar) {
        bar.aaa++;
    }

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

    /*eslint no-param-reassign: ["error", { "props": true }]*/
    
    function foo(bar) {
        bar.prop = "value";
    }
    
    function foo(bar) {
        delete bar.aaa;
    }
    
    function foo(bar) {
        bar.aaa++;
    }

    Examples of correct code for the { "props": true } option with "ignorePropertyModificationsFor" set:

    /*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
    
    function foo(bar) {
        bar.prop = "value";
    }
    
    function foo(bar) {
        delete bar.aaa;
    }
    
    function foo(bar) {
        bar.aaa++;
    }

    When Not To Use It

    If you want to allow assignment to function parameters, then you can safely disable this rule.

    Further Reading

    'data' is defined but never used.
    Open

        socket.on('send_reval_data',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.
    Open

            for(var rev in data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow specified syntax (no-restricted-syntax)

    JavaScript has a lot of language features, and not everyone likes all of them. As a result, some projects choose to disallow the use of certain language features altogether. For instance, you might decide to disallow the use of try-catch or class, or you might decide to disallow the use of the in operator.

    Rather than creating separate rules for every language feature you want to turn off, this rule allows you to configure the syntax elements you want to restrict use of. These elements are represented by their ESTree node types. For example, a function declaration is represented by FunctionDeclaration and the with statement is represented by WithStatement. You may find the full list of AST node names you can use on GitHub and use the online parser to see what type of nodes your code consists of.

    You can also specify [AST selectors](../developer-guide/selectors) to restrict, allowing much more precise control over syntax patterns.

    Rule Details

    This rule disallows specified (that is, user-defined) syntax.

    Options

    This rule takes a list of strings, where each string is an AST selector:

    {
        "rules": {
            "no-restricted-syntax": ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"]
        }
    }

    Alternatively, the rule also accepts objects, where the selector and an optional custom message are specified:

    {
        "rules": {
            "no-restricted-syntax": [
                "error",
                {
                    "selector": "FunctionExpression",
                    "message": "Function expressions are not allowed."
                },
                {
                    "selector": "CallExpression[callee.name='setTimeout'][arguments.length!=2]",
                    "message": "setTimeout must always be invoked with two arguments."
                }
            ]
        }
    }

    If a custom message is specified with the message property, ESLint will use that message when reporting occurrences of the syntax specified in the selector property.

    The string and object formats can be freely mixed in the configuration as needed.

    Examples of incorrect code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

    /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
    
    with (me) {
        dontMess();
    }
    
    var doSomething = function () {};
    
    foo in bar;

    Examples of correct code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

    /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
    
    me.dontMess();
    
    function doSomething() {};
    
    foo instanceof bar;

    When Not To Use It

    If you don't want to restrict your code from using any JavaScript features or syntax, you should not use this rule.

    Related Rules

    • [no-alert](no-alert.md)
    • [no-console](no-console.md)
    • [no-debugger](no-debugger.md)
    • [no-restricted-properties](no-restricted-properties.md) Source: http://eslint.org/docs/rules/

    'labs' is already declared in the upper scope.
    Open

                    var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

    Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

    var a = 3;
    function b() {
        var a = 10;
    }

    In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

    Rule Details

    This rule aims to eliminate shadowed variable declarations.

    Examples of incorrect code for this rule:

    /*eslint no-shadow: "error"*/
    /*eslint-env es6*/
    
    var a = 3;
    function b() {
        var a = 10;
    }
    
    var b = function () {
        var a = 10;
    }
    
    function b(a) {
        a = 10;
    }
    b(a);
    
    if (true) {
        let a = 5;
    }

    Options

    This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

    {
        "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
    }

    builtinGlobals

    The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

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

    /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
    
    function foo() {
        var Object = 0;
    }

    hoist

    The hoist option has three settings:

    • functions (by default) - reports shadowing before the outer functions are defined.
    • all - reports all shadowing before the outer variables/functions are defined.
    • never - never report shadowing before the outer variables/functions are defined.

    hoist: functions

    Examples of incorrect code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let b = 6;
    }
    
    function b() {}

    Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

    Examples of correct code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
    }
    
    let a = 5;

    Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

    hoist: all

    Examples of incorrect code for the { "hoist": "all" } option:

    /*eslint no-shadow: ["error", { "hoist": "all" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    hoist: never

    Examples of correct code for the { "hoist": "never" } option:

    /*eslint no-shadow: ["error", { "hoist": "never" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

    allow

    The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

    Examples of correct code for the { "allow": ["done"] } option:

    /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
    /*eslint-env es6*/
    
    import async from 'async';
    
    function foo(done) {
      async.map([1, 2], function (e, done) {
        done(null, e * 2)
      }, done);
    }
    
    foo(function (err, result) {
      console.log({ err, result });
    });

    Further Reading

    Related Rules

    Expected '!==' and instead saw '!='.
    Open

            if(APIKeys.indexOf(data.key) != -1 )
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require === and !== (eqeqeq)

    It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

    The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

    • [] == false
    • [] == ![]
    • 3 == "03"

    If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

    Rule Details

    This rule is aimed at eliminating the type-unsafe equality operators.

    Examples of incorrect code for this rule:

    /*eslint eqeqeq: "error"*/
    
    if (x == 42) { }
    
    if ("" == text) { }
    
    if (obj.getStuff() != undefined) { }

    The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

    Options

    always

    The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

    Examples of incorrect code for the "always" option:

    /*eslint eqeqeq: ["error", "always"]*/
    
    a == b
    foo == true
    bananas != 1
    value == undefined
    typeof foo == 'undefined'
    'hello' != 'world'
    0 == 0
    true == true
    foo == null

    Examples of correct code for the "always" option:

    /*eslint eqeqeq: ["error", "always"]*/
    
    a === b
    foo === true
    bananas !== 1
    value === undefined
    typeof foo === 'undefined'
    'hello' !== 'world'
    0 === 0
    true === true
    foo === null

    This rule optionally takes a second argument, which should be an object with the following supported properties:

    • "null": Customize how this rule treats null literals. Possible values:
      • always (default) - Always use === or !==.
      • never - Never use === or !== with null.
      • ignore - Do not apply this rule to null.

    smart

    The "smart" option enforces the use of === and !== except for these cases:

    • Comparing two literal values
    • Evaluating the value of typeof
    • Comparing against null

    Examples of incorrect code for the "smart" option:

    /*eslint eqeqeq: ["error", "smart"]*/
    
    // comparing two variables requires ===
    a == b
    
    // only one side is a literal
    foo == true
    bananas != 1
    
    // comparing to undefined requires ===
    value == undefined

    Examples of correct code for the "smart" option:

    /*eslint eqeqeq: ["error", "smart"]*/
    
    typeof foo == 'undefined'
    'hello' != 'world'
    0 == 0
    true == true
    foo == null

    allow-null

    Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

    ["error", "always", {"null": "ignore"}]

    When Not To Use It

    If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    'lab_names' is already declared in the upper scope.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

    Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

    var a = 3;
    function b() {
        var a = 10;
    }

    In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

    Rule Details

    This rule aims to eliminate shadowed variable declarations.

    Examples of incorrect code for this rule:

    /*eslint no-shadow: "error"*/
    /*eslint-env es6*/
    
    var a = 3;
    function b() {
        var a = 10;
    }
    
    var b = function () {
        var a = 10;
    }
    
    function b(a) {
        a = 10;
    }
    b(a);
    
    if (true) {
        let a = 5;
    }

    Options

    This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

    {
        "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
    }

    builtinGlobals

    The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

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

    /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
    
    function foo() {
        var Object = 0;
    }

    hoist

    The hoist option has three settings:

    • functions (by default) - reports shadowing before the outer functions are defined.
    • all - reports all shadowing before the outer variables/functions are defined.
    • never - never report shadowing before the outer variables/functions are defined.

    hoist: functions

    Examples of incorrect code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let b = 6;
    }
    
    function b() {}

    Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

    Examples of correct code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
    }
    
    let a = 5;

    Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

    hoist: all

    Examples of incorrect code for the { "hoist": "all" } option:

    /*eslint no-shadow: ["error", { "hoist": "all" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    hoist: never

    Examples of correct code for the { "hoist": "never" } option:

    /*eslint no-shadow: ["error", { "hoist": "never" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

    allow

    The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

    Examples of correct code for the { "allow": ["done"] } option:

    /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
    /*eslint-env es6*/
    
    import async from 'async';
    
    function foo(done) {
      async.map([1, 2], function (e, done) {
        done(null, e * 2)
      }, done);
    }
    
    foo(function (err, result) {
      console.log({ err, result });
    });

    Further Reading

    Related Rules

    Multiple spaces found before 'data'.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow multiple spaces (no-multi-spaces)

    Multiple spaces in a row that are not used for indentation are typically mistakes. For example:

    if(foo  === "bar") {}

    It's hard to tell, but there are two spaces between foo and ===. Multiple spaces such as this are generally frowned upon in favor of single spaces:

    if(foo === "bar") {}

    Rule Details

    This rule aims to disallow multiple whitespace around logical expressions, conditional expressions, declarations, array elements, object properties, sequences and function parameters.

    Examples of incorrect code for this rule:

    /*eslint no-multi-spaces: "error"*/
    
    var a =  1;
    
    if(foo   === "bar") {}
    
    a <<  b
    
    var arr = [1,  2];
    
    a ?  b: c

    Examples of correct code for this rule:

    /*eslint no-multi-spaces: "error"*/
    
    var a = 1;
    
    if(foo === "bar") {}
    
    a << b
    
    var arr = [1, 2];
    
    a ? b: c

    Options

    To avoid contradictions if some other rules require multiple spaces, this rule has an option to ignore certain node types in the abstract syntax tree (AST) of JavaScript code.

    exceptions

    The exceptions object expects property names to be AST node types as defined by ESTree. The easiest way to determine the node types for exceptions is to use the online demo.

    Only the Property node type is ignored by default, because for the [key-spacing](key-spacing.md) rule some alignment options require multiple spaces in properties of object literals.

    Examples of correct code for the default "exceptions": { "Property": true } option:

    /*eslint no-multi-spaces: "error"*/
    /*eslint key-spacing: ["error", { align: "value" }]*/
    
    var obj = {
        first:  "first",
        second: "second"
    };

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

    /*eslint no-multi-spaces: ["error", { exceptions: { "Property": false } }]*/
    /*eslint key-spacing: ["error", { align: "value" }]*/
    
    var obj = {
        first:  "first",
        second: "second"
    };

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

    /*eslint no-multi-spaces: ["error", { exceptions: { "BinaryExpression": true } }]*/
    
    var a = 1  *  2;

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

    /*eslint no-multi-spaces: ["error", { exceptions: { "VariableDeclarator": true } }]*/
    
    var someVar      = 'foo';
    var someOtherVar = 'barBaz';

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

    /*eslint no-multi-spaces: ["error", { exceptions: { "ImportDeclaration": true } }]*/
    
    import mod          from 'mod';
    import someOtherMod from 'some-other-mod';

    When Not To Use It

    If you don't want to check and disallow multiple spaces, then you should turn this rule off.

    Related Rules

    • [key-spacing](key-spacing.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Don't make functions within a loop.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Functions in Loops (no-loop-func)

    Writing functions within loops tends to result in errors due to the way the function creates a closure around the loop. For example:

    for (var i = 0; i < 10; i++) {
        funcs[i] = function() {
            return i;
        };
    }

    In this case, you would expect each function created within the loop to return a different number. In reality, each function returns 10, because that was the last value of i in the scope.

    let or const mitigate this problem.

    /*eslint-env es6*/
    
    for (let i = 0; i < 10; i++) {
        funcs[i] = function() {
            return i;
        };
    }

    In this case, each function created within the loop returns a different number as expected.

    Rule Details

    This error is raised to highlight a piece of code that may not work as you expect it to and could also indicate a misunderstanding of how the language works. Your code may run without any problems if you do not fix this error, but in some situations it could behave unexpectedly.

    Examples of incorrect code for this rule:

    /*eslint no-loop-func: "error"*/
    /*eslint-env es6*/
    
    for (var i=10; i; i--) {
        (function() { return i; })();
    }
    
    while(i) {
        var a = function() { return i; };
        a();
    }
    
    do {
        function a() { return i; };
        a();
    } while (i);
    
    let foo = 0;
    for (let i=10; i; i--) {
        // Bad, function is referencing block scoped variable in the outer scope.
        var a = function() { return foo; };
        a();
    }

    Examples of correct code for this rule:

    /*eslint no-loop-func: "error"*/
    /*eslint-env es6*/
    
    var a = function() {};
    
    for (var i=10; i; i--) {
        a();
    }
    
    for (var i=10; i; i--) {
        var a = function() {}; // OK, no references to variables in the outer scopes.
        a();
    }
    
    for (let i=10; i; i--) {
        var a = function() { return i; }; // OK, all references are referring to block scoped variables in the loop.
        a();
    }
    
    var foo = 100;
    for (let i=10; i; i--) {
        var a = function() { return foo; }; // OK, all references are referring to never modified variables.
        a();
    }
    //... no modifications of foo after this loop ...

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

    Expected '!==' and instead saw '!='.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require === and !== (eqeqeq)

    It is considered good practice to use the type-safe equality operators === and !== instead of their regular counterparts == and !=.

    The reason for this is that == and != do type coercion which follows the rather obscure Abstract Equality Comparison Algorithm. For instance, the following statements are all considered true:

    • [] == false
    • [] == ![]
    • 3 == "03"

    If one of those occurs in an innocent-looking statement such as a == b the actual problem is very difficult to spot.

    Rule Details

    This rule is aimed at eliminating the type-unsafe equality operators.

    Examples of incorrect code for this rule:

    /*eslint eqeqeq: "error"*/
    
    if (x == 42) { }
    
    if ("" == text) { }
    
    if (obj.getStuff() != undefined) { }

    The --fix option on the command line automatically fixes some problems reported by this rule. A problem is only fixed if one of the operands is a typeof expression, or if both operands are literals with the same type.

    Options

    always

    The "always" option (default) enforces the use of === and !== in every situation (except when you opt-in to more specific handling of null [see below]).

    Examples of incorrect code for the "always" option:

    /*eslint eqeqeq: ["error", "always"]*/
    
    a == b
    foo == true
    bananas != 1
    value == undefined
    typeof foo == 'undefined'
    'hello' != 'world'
    0 == 0
    true == true
    foo == null

    Examples of correct code for the "always" option:

    /*eslint eqeqeq: ["error", "always"]*/
    
    a === b
    foo === true
    bananas !== 1
    value === undefined
    typeof foo === 'undefined'
    'hello' !== 'world'
    0 === 0
    true === true
    foo === null

    This rule optionally takes a second argument, which should be an object with the following supported properties:

    • "null": Customize how this rule treats null literals. Possible values:
      • always (default) - Always use === or !==.
      • never - Never use === or !== with null.
      • ignore - Do not apply this rule to null.

    smart

    The "smart" option enforces the use of === and !== except for these cases:

    • Comparing two literal values
    • Evaluating the value of typeof
    • Comparing against null

    Examples of incorrect code for the "smart" option:

    /*eslint eqeqeq: ["error", "smart"]*/
    
    // comparing two variables requires ===
    a == b
    
    // only one side is a literal
    foo == true
    bananas != 1
    
    // comparing to undefined requires ===
    value == undefined

    Examples of correct code for the "smart" option:

    /*eslint eqeqeq: ["error", "smart"]*/
    
    typeof foo == 'undefined'
    'hello' != 'world'
    0 == 0
    true == true
    foo == null

    allow-null

    Deprecated: Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell eslint to always enforce strict equality except when comparing with the null literal.

    ["error", "always", {"null": "ignore"}]

    When Not To Use It

    If you don't want to enforce a style for using equality operators, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unary operator '++' used.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow the unary operators ++ and -- (no-plusplus)

    Because the unary ++ and -- operators are subject to automatic semicolon insertion, differences in whitespace can change semantics of source code.

    var i = 10;
    var j = 20;
    
    i ++
    j
    // i = 11, j = 20
    var i = 10;
    var j = 20;
    
    i
    ++
    j
    // i = 10, j = 21

    Rule Details

    This rule disallows the unary operators ++ and --.

    Examples of incorrect code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo++;
    
    var bar = 42;
    bar--;
    
    for (i = 0; i < l; i++) {
        return;
    }

    Examples of correct code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo += 1;
    
    var bar = 42;
    bar -= 1;
    
    for (i = 0; i < l; i += 1) {
        return;
    }

    Options

    This rule has an object option.

    • "allowForLoopAfterthoughts": true allows unary operators ++ and -- in the afterthought (final expression) of a for loop.

    allowForLoopAfterthoughts

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

    /*eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }]*/
    
    for (i = 0; i < l; i++) {
        return;
    }
    
    for (i = 0; i < l; i--) {
        return;
    }

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

    'i' is already declared in the upper scope.
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

    Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

    var a = 3;
    function b() {
        var a = 10;
    }

    In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

    Rule Details

    This rule aims to eliminate shadowed variable declarations.

    Examples of incorrect code for this rule:

    /*eslint no-shadow: "error"*/
    /*eslint-env es6*/
    
    var a = 3;
    function b() {
        var a = 10;
    }
    
    var b = function () {
        var a = 10;
    }
    
    function b(a) {
        a = 10;
    }
    b(a);
    
    if (true) {
        let a = 5;
    }

    Options

    This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

    {
        "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
    }

    builtinGlobals

    The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

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

    /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
    
    function foo() {
        var Object = 0;
    }

    hoist

    The hoist option has three settings:

    • functions (by default) - reports shadowing before the outer functions are defined.
    • all - reports all shadowing before the outer variables/functions are defined.
    • never - never report shadowing before the outer variables/functions are defined.

    hoist: functions

    Examples of incorrect code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let b = 6;
    }
    
    function b() {}

    Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

    Examples of correct code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
    }
    
    let a = 5;

    Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

    hoist: all

    Examples of incorrect code for the { "hoist": "all" } option:

    /*eslint no-shadow: ["error", { "hoist": "all" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    hoist: never

    Examples of correct code for the { "hoist": "never" } option:

    /*eslint no-shadow: ["error", { "hoist": "never" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

    allow

    The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

    Examples of correct code for the { "allow": ["done"] } option:

    /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
    /*eslint-env es6*/
    
    import async from 'async';
    
    function foo(done) {
      async.map([1, 2], function (e, done) {
        done(null, e * 2)
      }, done);
    }
    
    foo(function (err, result) {
      console.log({ err, result });
    });

    Further Reading

    Related Rules

    'labs' is already declared in the upper scope.
    Open

            var labs = require('/etc/main_server/labs.json').Labs;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

    Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

    var a = 3;
    function b() {
        var a = 10;
    }

    In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

    Rule Details

    This rule aims to eliminate shadowed variable declarations.

    Examples of incorrect code for this rule:

    /*eslint no-shadow: "error"*/
    /*eslint-env es6*/
    
    var a = 3;
    function b() {
        var a = 10;
    }
    
    var b = function () {
        var a = 10;
    }
    
    function b(a) {
        a = 10;
    }
    b(a);
    
    if (true) {
        let a = 5;
    }

    Options

    This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

    {
        "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
    }

    builtinGlobals

    The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

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

    /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
    
    function foo() {
        var Object = 0;
    }

    hoist

    The hoist option has three settings:

    • functions (by default) - reports shadowing before the outer functions are defined.
    • all - reports all shadowing before the outer variables/functions are defined.
    • never - never report shadowing before the outer variables/functions are defined.

    hoist: functions

    Examples of incorrect code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let b = 6;
    }
    
    function b() {}

    Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

    Examples of correct code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
    }
    
    let a = 5;

    Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

    hoist: all

    Examples of incorrect code for the { "hoist": "all" } option:

    /*eslint no-shadow: ["error", { "hoist": "all" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    hoist: never

    Examples of correct code for the { "hoist": "never" } option:

    /*eslint no-shadow: ["error", { "hoist": "never" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

    allow

    The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

    Examples of correct code for the { "allow": ["done"] } option:

    /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
    /*eslint-env es6*/
    
    import async from 'async';
    
    function foo(done) {
      async.map([1, 2], function (e, done) {
        done(null, e * 2)
      }, done);
    }
    
    foo(function (err, result) {
      console.log({ err, result });
    });

    Further Reading

    Related Rules

    Missing trailing comma.
    Open

                    admin_key : socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow trailing commas (comma-dangle)

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

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

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

    Less clear:

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

    More clear:

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

    Rule Details

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

    Options

    This rule has a string option or an object option:

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

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

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

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

    never

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

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

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

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

    always

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

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

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

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

    always-multiline

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

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

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

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

    only-multiline

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

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

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

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

    functions

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

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

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

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

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

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

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

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

    When Not To Use It

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

    The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Guarding for-in (guard-for-in)

    Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

    for (key in foo) {
        doSomething(key);
    }

    Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

    Rule Details

    This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

    Examples of incorrect code for this rule:

    /*eslint guard-for-in: "error"*/
    
    for (key in foo) {
        doSomething(key);
    }

    Examples of correct code for this rule:

    /*eslint guard-for-in: "error"*/
    
    for (key in foo) {
        if (Object.prototype.hasOwnProperty.call(foo, key)) {
            doSomething(key);
        }
        if ({}.hasOwnProperty.call(foo, key)) {
            doSomething(key);
        }
    }

    Related Rules

    • [no-prototype-builtins](no-prototype-builtins.md)

    Further Reading

    Don't make functions within a loop.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Functions in Loops (no-loop-func)

    Writing functions within loops tends to result in errors due to the way the function creates a closure around the loop. For example:

    for (var i = 0; i < 10; i++) {
        funcs[i] = function() {
            return i;
        };
    }

    In this case, you would expect each function created within the loop to return a different number. In reality, each function returns 10, because that was the last value of i in the scope.

    let or const mitigate this problem.

    /*eslint-env es6*/
    
    for (let i = 0; i < 10; i++) {
        funcs[i] = function() {
            return i;
        };
    }

    In this case, each function created within the loop returns a different number as expected.

    Rule Details

    This error is raised to highlight a piece of code that may not work as you expect it to and could also indicate a misunderstanding of how the language works. Your code may run without any problems if you do not fix this error, but in some situations it could behave unexpectedly.

    Examples of incorrect code for this rule:

    /*eslint no-loop-func: "error"*/
    /*eslint-env es6*/
    
    for (var i=10; i; i--) {
        (function() { return i; })();
    }
    
    while(i) {
        var a = function() { return i; };
        a();
    }
    
    do {
        function a() { return i; };
        a();
    } while (i);
    
    let foo = 0;
    for (let i=10; i; i--) {
        // Bad, function is referencing block scoped variable in the outer scope.
        var a = function() { return foo; };
        a();
    }

    Examples of correct code for this rule:

    /*eslint no-loop-func: "error"*/
    /*eslint-env es6*/
    
    var a = function() {};
    
    for (var i=10; i; i--) {
        a();
    }
    
    for (var i=10; i; i--) {
        var a = function() {}; // OK, no references to variables in the outer scopes.
        a();
    }
    
    for (let i=10; i; i--) {
        var a = function() { return i; }; // OK, all references are referring to block scoped variables in the loop.
        a();
    }
    
    var foo = 100;
    for (let i=10; i; i--) {
        var a = function() { return foo; }; // OK, all references are referring to never modified variables.
        a();
    }
    //... no modifications of foo after this loop ...

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

    for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow specified syntax (no-restricted-syntax)

    JavaScript has a lot of language features, and not everyone likes all of them. As a result, some projects choose to disallow the use of certain language features altogether. For instance, you might decide to disallow the use of try-catch or class, or you might decide to disallow the use of the in operator.

    Rather than creating separate rules for every language feature you want to turn off, this rule allows you to configure the syntax elements you want to restrict use of. These elements are represented by their ESTree node types. For example, a function declaration is represented by FunctionDeclaration and the with statement is represented by WithStatement. You may find the full list of AST node names you can use on GitHub and use the online parser to see what type of nodes your code consists of.

    You can also specify [AST selectors](../developer-guide/selectors) to restrict, allowing much more precise control over syntax patterns.

    Rule Details

    This rule disallows specified (that is, user-defined) syntax.

    Options

    This rule takes a list of strings, where each string is an AST selector:

    {
        "rules": {
            "no-restricted-syntax": ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"]
        }
    }

    Alternatively, the rule also accepts objects, where the selector and an optional custom message are specified:

    {
        "rules": {
            "no-restricted-syntax": [
                "error",
                {
                    "selector": "FunctionExpression",
                    "message": "Function expressions are not allowed."
                },
                {
                    "selector": "CallExpression[callee.name='setTimeout'][arguments.length!=2]",
                    "message": "setTimeout must always be invoked with two arguments."
                }
            ]
        }
    }

    If a custom message is specified with the message property, ESLint will use that message when reporting occurrences of the syntax specified in the selector property.

    The string and object formats can be freely mixed in the configuration as needed.

    Examples of incorrect code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

    /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
    
    with (me) {
        dontMess();
    }
    
    var doSomething = function () {};
    
    foo in bar;

    Examples of correct code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

    /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
    
    me.dontMess();
    
    function doSomething() {};
    
    foo instanceof bar;

    When Not To Use It

    If you don't want to restrict your code from using any JavaScript features or syntax, you should not use this rule.

    Related Rules

    • [no-alert](no-alert.md)
    • [no-console](no-console.md)
    • [no-debugger](no-debugger.md)
    • [no-restricted-properties](no-restricted-properties.md) Source: http://eslint.org/docs/rules/

    The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype.
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Guarding for-in (guard-for-in)

    Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected items in your for loop.

    for (key in foo) {
        doSomething(key);
    }

    Note that simply checking foo.hasOwnProperty(key) is likely to cause an error in some cases; see [no-prototype-builtins](no-prototype-builtins.md).

    Rule Details

    This rule is aimed at preventing unexpected behavior that could arise from using a for in loop without filtering the results in the loop. As such, it will warn when for in loops do not filter their results with an if statement.

    Examples of incorrect code for this rule:

    /*eslint guard-for-in: "error"*/
    
    for (key in foo) {
        doSomething(key);
    }

    Examples of correct code for this rule:

    /*eslint guard-for-in: "error"*/
    
    for (key in foo) {
        if (Object.prototype.hasOwnProperty.call(foo, key)) {
            doSomething(key);
        }
        if ({}.hasOwnProperty.call(foo, key)) {
            doSomething(key);
        }
    }

    Related Rules

    • [no-prototype-builtins](no-prototype-builtins.md)

    Further Reading

    'file' is defined but never used.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow specified syntax (no-restricted-syntax)

    JavaScript has a lot of language features, and not everyone likes all of them. As a result, some projects choose to disallow the use of certain language features altogether. For instance, you might decide to disallow the use of try-catch or class, or you might decide to disallow the use of the in operator.

    Rather than creating separate rules for every language feature you want to turn off, this rule allows you to configure the syntax elements you want to restrict use of. These elements are represented by their ESTree node types. For example, a function declaration is represented by FunctionDeclaration and the with statement is represented by WithStatement. You may find the full list of AST node names you can use on GitHub and use the online parser to see what type of nodes your code consists of.

    You can also specify [AST selectors](../developer-guide/selectors) to restrict, allowing much more precise control over syntax patterns.

    Rule Details

    This rule disallows specified (that is, user-defined) syntax.

    Options

    This rule takes a list of strings, where each string is an AST selector:

    {
        "rules": {
            "no-restricted-syntax": ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"]
        }
    }

    Alternatively, the rule also accepts objects, where the selector and an optional custom message are specified:

    {
        "rules": {
            "no-restricted-syntax": [
                "error",
                {
                    "selector": "FunctionExpression",
                    "message": "Function expressions are not allowed."
                },
                {
                    "selector": "CallExpression[callee.name='setTimeout'][arguments.length!=2]",
                    "message": "setTimeout must always be invoked with two arguments."
                }
            ]
        }
    }

    If a custom message is specified with the message property, ESLint will use that message when reporting occurrences of the syntax specified in the selector property.

    The string and object formats can be freely mixed in the configuration as needed.

    Examples of incorrect code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

    /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
    
    with (me) {
        dontMess();
    }
    
    var doSomething = function () {};
    
    foo in bar;

    Examples of correct code for this rule with the "FunctionExpression", "WithStatement", BinaryExpression[operator='in'] options:

    /* eslint no-restricted-syntax: ["error", "FunctionExpression", "WithStatement", "BinaryExpression[operator='in']"] */
    
    me.dontMess();
    
    function doSomething() {};
    
    foo instanceof bar;

    When Not To Use It

    If you don't want to restrict your code from using any JavaScript features or syntax, you should not use this rule.

    Related Rules

    • [no-alert](no-alert.md)
    • [no-console](no-console.md)
    • [no-debugger](no-debugger.md)
    • [no-restricted-properties](no-restricted-properties.md) Source: http://eslint.org/docs/rules/

    'checkLab' is defined but never used.
    Open

        function checkLab(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    'error' is not defined.
    Open

                         console.log(error);
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Undeclared Variables (no-undef)

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

    Rule Details

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

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule with global declaration:

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

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

    Examples of incorrect code for this rule with global declaration:

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

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

    Options

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

    typeof

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

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

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

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

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

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

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

    Environments

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

    browser

    Examples of correct code for this rule with browser environment:

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

    node

    Examples of correct code for this rule with node environment:

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

    When Not To Use It

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

    Compatibility

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

    Assignment to property of function parameter 'socket'.
    Open

            delete socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Reassignment of Function Parameters (no-param-reassign)

    Assignment to variables declared as function parameters can be misleading and lead to confusing behavior, as modifying function parameters will also mutate the arguments object. Often, assignment to function parameters is unintended and indicative of a mistake or programmer error.

    This rule can be also configured to fail when function parameters are modified. Side effects on parameters can cause counter-intuitive execution flow and make errors difficult to track down.

    Rule Details

    This rule aims to prevent unintended behavior caused by modification or reassignment of function parameters.

    Examples of incorrect code for this rule:

    /*eslint no-param-reassign: "error"*/
    
    function foo(bar) {
        bar = 13;
    }
    
    function foo(bar) {
        bar++;
    }

    Examples of correct code for this rule:

    /*eslint no-param-reassign: "error"*/
    
    function foo(bar) {
        var baz = bar;
    }

    Options

    This rule takes one option, an object, with a boolean property "props" and an array "ignorePropertyModificationsFor". "props" is false by default. If "props" is set to true, this rule warns against the modification of parameter properties unless they're included in "ignorePropertyModificationsFor", which is an empty array by default.

    props

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

    /*eslint no-param-reassign: ["error", { "props": false }]*/
    
    function foo(bar) {
        bar.prop = "value";
    }
    
    function foo(bar) {
        delete bar.aaa;
    }
    
    function foo(bar) {
        bar.aaa++;
    }

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

    /*eslint no-param-reassign: ["error", { "props": true }]*/
    
    function foo(bar) {
        bar.prop = "value";
    }
    
    function foo(bar) {
        delete bar.aaa;
    }
    
    function foo(bar) {
        bar.aaa++;
    }

    Examples of correct code for the { "props": true } option with "ignorePropertyModificationsFor" set:

    /*eslint no-param-reassign: ["error", { "props": true, "ignorePropertyModificationsFor": ["bar"] }]*/
    
    function foo(bar) {
        bar.prop = "value";
    }
    
    function foo(bar) {
        delete bar.aaa;
    }
    
    function foo(bar) {
        bar.aaa++;
    }

    When Not To Use It

    If you want to allow assignment to function parameters, then you can safely disable this rule.

    Further Reading

    Unary operator '++' used.
    Open

                        time++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow the unary operators ++ and -- (no-plusplus)

    Because the unary ++ and -- operators are subject to automatic semicolon insertion, differences in whitespace can change semantics of source code.

    var i = 10;
    var j = 20;
    
    i ++
    j
    // i = 11, j = 20
    var i = 10;
    var j = 20;
    
    i
    ++
    j
    // i = 10, j = 21

    Rule Details

    This rule disallows the unary operators ++ and --.

    Examples of incorrect code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo++;
    
    var bar = 42;
    bar--;
    
    for (i = 0; i < l; i++) {
        return;
    }

    Examples of correct code for this rule:

    /*eslint no-plusplus: "error"*/
    
    var foo = 0;
    foo += 1;
    
    var bar = 42;
    bar -= 1;
    
    for (i = 0; i < l; i += 1) {
        return;
    }

    Options

    This rule has an object option.

    • "allowForLoopAfterthoughts": true allows unary operators ++ and -- in the afterthought (final expression) of a for loop.

    allowForLoopAfterthoughts

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

    /*eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }]*/
    
    for (i = 0; i < l; i++) {
        return;
    }
    
    for (i = 0; i < l; i--) {
        return;
    }

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

    'err' is already declared in the upper scope.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow variable declarations from shadowing variables declared in the outer scope (no-shadow)

    Shadowing is the process by which a local variable shares the same name as a variable in its containing scope. For example:

    var a = 3;
    function b() {
        var a = 10;
    }

    In this case, the variable a inside of b() is shadowing the variable a in the global scope. This can cause confusion while reading the code and it's impossible to access the global variable.

    Rule Details

    This rule aims to eliminate shadowed variable declarations.

    Examples of incorrect code for this rule:

    /*eslint no-shadow: "error"*/
    /*eslint-env es6*/
    
    var a = 3;
    function b() {
        var a = 10;
    }
    
    var b = function () {
        var a = 10;
    }
    
    function b(a) {
        a = 10;
    }
    b(a);
    
    if (true) {
        let a = 5;
    }

    Options

    This rule takes one option, an object, with properties "builtinGlobals", "hoist" and "allow".

    {
        "no-shadow": ["error", { "builtinGlobals": false, "hoist": "functions", "allow": [] }]
    }

    builtinGlobals

    The builtinGlobals option is false by default. If it is true, the rule prevents shadowing of built-in global variables: Object, Array, Number, and so on.

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

    /*eslint no-shadow: ["error", { "builtinGlobals": true }]*/
    
    function foo() {
        var Object = 0;
    }

    hoist

    The hoist option has three settings:

    • functions (by default) - reports shadowing before the outer functions are defined.
    • all - reports all shadowing before the outer variables/functions are defined.
    • never - never report shadowing before the outer variables/functions are defined.

    hoist: functions

    Examples of incorrect code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let b = 6;
    }
    
    function b() {}

    Although let b in the if statement is before the function declaration in the outer scope, it is incorrect.

    Examples of correct code for the default { "hoist": "functions" } option:

    /*eslint no-shadow: ["error", { "hoist": "functions" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
    }
    
    let a = 5;

    Because let a in the if statement is before the variable declaration in the outer scope, it is correct.

    hoist: all

    Examples of incorrect code for the { "hoist": "all" } option:

    /*eslint no-shadow: ["error", { "hoist": "all" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    hoist: never

    Examples of correct code for the { "hoist": "never" } option:

    /*eslint no-shadow: ["error", { "hoist": "never" }]*/
    /*eslint-env es6*/
    
    if (true) {
        let a = 3;
        let b = 6;
    }
    
    let a = 5;
    function b() {}

    Because let a and let b in the if statement are before the declarations in the outer scope, they are correct.

    allow

    The allow option is an array of identifier names for which shadowing is allowed. For example, "resolve", "reject", "done", "cb".

    Examples of correct code for the { "allow": ["done"] } option:

    /*eslint no-shadow: ["error", { "allow": ["done"] }]*/
    /*eslint-env es6*/
    
    import async from 'async';
    
    function foo(done) {
      async.map([1, 2], function (e, done) {
        done(null, e * 2)
      }, done);
    }
    
    foo(function (err, result) {
      console.log({ err, result });
    });

    Further Reading

    Related Rules

    'data' is defined but never used.
    Open

        socket.on('logout',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    'stat' is defined but never used.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    'err' is defined but never used.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow Unused Variables (no-unused-vars)

    Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.

    Rule Details

    This rule is aimed at eliminating unused variables, functions, and parameters of functions.

    A variable is considered to be used if any of the following are true:

    • It represents a function that is called (doSomething())
    • It is read (var y = x)
    • It is passed into a function as an argument (doSomething(x))
    • It is read inside of a function that is passed to another function (doSomething(function() { foo(); }))

    A variable is not considered to be used if it is only ever assigned to (var x = 5) or declared.

    Examples of incorrect code for this rule:

    /*eslint no-unused-vars: "error"*/
    /*global some_unused_var*/
    
    // It checks variables you have defined as global
    some_unused_var = 42;
    
    var x;
    
    // Write-only variables are not considered as used.
    var y = 10;
    y = 5;
    
    // A read for a modification of itself is not considered as used.
    var z = 0;
    z = z + 1;
    
    // By default, unused arguments cause warnings.
    (function(foo) {
        return 5;
    })();
    
    // Unused recursive functions also cause warnings.
    function fact(n) {
        if (n < 2) return 1;
        return n * fact(n - 1);
    }
    
    // When a function definition destructures an array, unused entries from the array also cause warnings.
    function getY([x, y]) {
        return y;
    }

    Examples of correct code for this rule:

    /*eslint no-unused-vars: "error"*/
    
    var x = 10;
    alert(x);
    
    // foo is considered used here
    myFunc(function foo() {
        // ...
    }.bind(this));
    
    (function(foo) {
        return foo;
    })();
    
    var myFunc;
    myFunc = setTimeout(function() {
        // myFunc is considered used
        myFunc();
    }, 50);
    
    // Only the second argument from the descructured array is used.
    function getY([, y]) {
        return y;
    }

    exported

    In environments outside of CommonJS or ECMAScript modules, you may use var to create a global variable that may be used by other scripts. You can use the /* exported variableName */ comment block to indicate that this variable is being exported and therefore should not be considered unused.

    Note that /* exported */ has no effect for any of the following:

    • when the environment is node or commonjs
    • when parserOptions.sourceType is module
    • when ecmaFeatures.globalReturn is true

    The line comment // exported variableName will not work as exported is not line-specific.

    Examples of correct code for /* exported variableName */ operation:

    /* exported global_var */
    
    var global_var = 42;

    Options

    This rule takes one argument which can be a string or an object. The string settings are the same as those of the vars property (explained below).

    By default this rule is enabled with all option for variables and after-used for arguments.

    {
        "rules": {
            "no-unused-vars": ["error", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }]
        }
    }

    vars

    The vars option has two settings:

    • all checks all variables for usage, including those in the global scope. This is the default setting.
    • local checks only that locally-declared variables are used but will allow global variables to be unused.

    vars: local

    Examples of correct code for the { "vars": "local" } option:

    /*eslint no-unused-vars: ["error", { "vars": "local" }]*/
    /*global some_unused_var */
    
    some_unused_var = 42;

    varsIgnorePattern

    The varsIgnorePattern option specifies exceptions not to check for usage: variables whose names match a regexp pattern. For example, variables whose names contain ignored or Ignored.

    Examples of correct code for the { "varsIgnorePattern": "[iI]gnored" } option:

    /*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
    
    var firstVarIgnored = 1;
    var secondVar = 2;
    console.log(secondVar);

    args

    The args option has three settings:

    • after-used - only the last argument must be used. This allows you, for instance, to have two named parameters to a function and as long as you use the second argument, ESLint will not warn you about the first. This is the default setting.
    • all - all named arguments must be used.
    • none - do not check arguments.

    args: after-used

    Examples of incorrect code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", { "args": "after-used" }]*/
    
    // 1 error
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    Examples of correct code for the default { "args": "after-used" } option:

    /*eslint no-unused-vars: ["error", {"args": "after-used"}]*/
    
    (function(foo, bar, baz) {
        return baz;
    })();

    args: all

    Examples of incorrect code for the { "args": "all" } option:

    /*eslint no-unused-vars: ["error", { "args": "all" }]*/
    
    // 2 errors
    // "foo" is defined but never used
    // "baz" is defined but never used
    (function(foo, bar, baz) {
        return bar;
    })();

    args: none

    Examples of correct code for the { "args": "none" } option:

    /*eslint no-unused-vars: ["error", { "args": "none" }]*/
    
    (function(foo, bar, baz) {
        return bar;
    })();

    ignoreRestSiblings

    The ignoreRestSiblings option is a boolean (default: false). Using a Rest Property it is possible to "omit" properties from an object, but by default the sibling properties are marked as "unused". With this option enabled the rest property's siblings are ignored.

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

    /*eslint no-unused-vars: ["error", { "ignoreRestSiblings": true }]*/
    // 'type' is ignored because it has a rest property sibling.
    var { type, ...coords } = data;

    argsIgnorePattern

    The argsIgnorePattern option specifies exceptions not to check for usage: arguments whose names match a regexp pattern. For example, variables whose names begin with an underscore.

    Examples of correct code for the { "argsIgnorePattern": "^_" } option:

    /*eslint no-unused-vars: ["error", { "argsIgnorePattern": "^_" }]*/
    
    function foo(x, _y) {
        return x + 1;
    }
    foo();

    caughtErrors

    The caughtErrors option is used for catch block arguments validation.

    It has two settings:

    • none - do not check error objects. This is the default setting.
    • all - all named arguments must be used.

    caughtErrors: none

    Not specifying this rule is equivalent of assigning it to none.

    Examples of correct code for the { "caughtErrors": "none" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "none" }]*/
    
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrors: all

    Examples of incorrect code for the { "caughtErrors": "all" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrors": "all" }]*/
    
    // 1 error
    // "err" is defined but never used
    try {
        //...
    } catch (err) {
        console.error("errors");
    }

    caughtErrorsIgnorePattern

    The caughtErrorsIgnorePattern option specifies exceptions not to check for usage: catch arguments whose names match a regexp pattern. For example, variables whose names begin with a string 'ignore'.

    Examples of correct code for the { "caughtErrorsIgnorePattern": "^ignore" } option:

    /*eslint no-unused-vars: ["error", { "caughtErrorsIgnorePattern": "^ignore" }]*/
    
    try {
        //...
    } catch (ignoreErr) {
        console.error("errors");
    }

    When Not To Use It

    If you don't want to be notified about unused variables or function arguments, you can safely turn this rule off. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.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

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

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

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

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

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

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

                var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

    Rule Details

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

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    Further Reading

    Unexpected tab character.
    Open

                labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected var, use let or const instead.
    Open

    var path = require('path')
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Expected space(s) after "if".
    Open

        if(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

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

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

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

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

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

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

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

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

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

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

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

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected unnamed function.
    Open

                labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

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

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

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

    Rule Details

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

    Options

    This rule has a string option:

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

    always

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

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

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

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

    as-needed

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

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

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

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

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

    never

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

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

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

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

    Further Reading

    Compatibility

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected require().
    Open

                var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforce require() on the top-level module scope (global-require)

    In Node.js, module dependencies are included using the require() function, such as:

    var fs = require("fs");

    While require() may be called anywhere in code, some style guides prescribe that it should be called only in the top level of a module to make it easier to identify dependencies. For instance, it's arguably harder to identify dependencies when they are deeply nested inside of functions and other statements:

    function foo() {
    
        if (condition) {
            var fs = require("fs");
        }
    }

    Since require() does a synchronous load, it can cause performance problems when used in other locations.

    Further, ES6 modules mandate that import and export statements can only occur in the top level of the module's body.

    Rule Details

    This rule requires all calls to require() to be at the top level of the module, similar to ES6 import and export statements, which also can occur only at the top level.

    Examples of incorrect code for this rule:

    /*eslint global-require: "error"*/
    /*eslint-env es6*/
    
    // calling require() inside of a function is not allowed
    function readFile(filename, callback) {
        var fs = require('fs');
        fs.readFile(filename, callback)
    }
    
    // conditional requires like this are also not allowed
    if (DEBUG) { require('debug'); }
    
    // a require() in a switch statement is also flagged
    switch(x) { case '1': require('1'); break; }
    
    // you may not require() inside an arrow function body
    var getModule = (name) => require(name);
    
    // you may not require() inside of a function body as well
    function getModule(name) { return require(name); }
    
    // you may not require() inside of a try/catch block
    try {
        require(unsafeModule);
    } catch(e) {
        console.log(e);
    }

    Examples of correct code for this rule:

    /*eslint global-require: "error"*/
    
    // all these variations of require() are ok
    require('x');
    var y = require('y');
    var z;
    z = require('z').initialize();
    
    // requiring a module and using it in a function is ok
    var fs = require('fs');
    function readFile(filename, callback) {
        fs.readFile(filename, callback)
    }
    
    // you can use a ternary to determine which module to require
    var logger = DEBUG ? require('dev-logger') : require('logger');
    
    // if you want you can require() at the end of your module
    function doSomethingA() {}
    function doSomethingB() {}
    var x = require("x"),
        z = require("z");

    When Not To Use It

    If you have a module that must be initialized with information that comes from the file-system or if a module is only used in very rare situations and will cause significant overhead to load it may make sense to disable the rule. If you need to require() an optional dependency inside of a try/catch, you can disable this rule for just that dependency using the // eslint-disable-line global-require comment. Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    Block must not be padded by blank lines.
    Open

    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

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

    if (a) {
    
        b();
    
    }

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

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    blocks

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

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

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

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

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

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

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

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

    classes

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

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

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

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

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

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

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

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

    switches

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

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

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

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

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

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

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

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

    When Not To Use It

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

    Unexpected tab character.
    Open

        if(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected function expression.
    Open

                labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

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

    Arrow functions are suited to callbacks, because:

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

    Rule Details

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

    The following patterns are considered problems:

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

    The following patterns are not considered problems:

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

    Options

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

    allowNamedFunctions

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

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

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

    allowUnboundThis

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

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

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

    When Not To Use It

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

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

    Unexpected tab character.
    Open

                    lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing space before value for key 'Labs'.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing between keys and values in object literal properties (key-spacing)

    This rule enforces spacing around the colon in object literal properties. It can verify each property individually, or it can ensure horizontal alignment of adjacent properties in an object literal.

    Rule Details

    This rule enforces consistent spacing between keys and values in object literal properties. In the case of long lines, it is acceptable to add a new line wherever whitespace is allowed.

    Options

    This rule has an object option:

    • "beforeColon": false (default) disallows spaces between the key and the colon in object literals.
    • "beforeColon": true requires at least one space between the key and the colon in object literals.
    • "afterColon": true (default) requires at least one space between the colon and the value in object literals.
    • "afterColon": false disallows spaces between the colon and the value in object literals.
    • "mode": "strict" (default) enforces exactly one space before or after colons in object literals.
    • "mode": "minimum" enforces one or more spaces before or after colons in object literals.
    • "align": "value" enforces horizontal alignment of values in object literals.
    • "align": "colon" enforces horizontal alignment of both colons and values in object literals.
    • "align" with an object value allows for fine-grained spacing when values are being aligned in object literals.
    • "singleLine" specifies a spacing style for single-line object literals.
    • "multiLine" specifies a spacing style for multi-line object literals.

    Please note that you can either use the top-level options or the grouped options (singleLine and multiLine) but not both.

    beforeColon

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

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo" : 42 };

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

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo": 42 };

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

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo": 42 };

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

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo" : 42 };

    afterColon

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

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo":42 };

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

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo": 42 };

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

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo":42 };

    mode

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

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

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

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat: 2 * 2
    });

    Examples of correct code for this rule with the { "mode": "minimum" } option:

    /*eslint key-spacing: ["error", { "mode": "minimum" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    align

    Examples of incorrect code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a: value,
        bcde:  42,
        fg :   foo()
    };

    Examples of correct code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a:    value,
        bcde: 42,
    
        fg: foo(),
        h:  function() {
            return this.a;
        },
        ijkl: 'Non-consecutive lines form a new group'
    };
    
    var obj = { a: "foo", longPropertyName: "bar" };

    Examples of incorrect code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat   : 2 * 2
    });

    align

    The align option can take additional configuration through the beforeColon, afterColon, mode, and on options.

    If align is defined as an object, but not all of the parameters are provided, undefined parameters will default to the following:

    // Defaults
    align: {
        "beforeColon": false,
        "afterColon": true,
        "on": "colon",
        "mode": "strict"
    }

    Examples of correct code for this rule with sample { "align": { } } options:

    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "one"   : 1,
        "seven" : 7
    }
    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": false,
            "afterColon": false,
            "on": "value"
        }
    }]*/
    
    var obj = {
        "one":  1,
        "seven":7
    }

    align and multiLine

    The multiLine and align options can differ, which allows for fine-tuned control over the key-spacing of your files. align will not inherit from multiLine if align is configured as an object.

    multiLine is used any time an object literal spans multiple lines. The align configuration is used when there is a group of properties in the same object. For example:

    var myObj = {
      key1: 1, // uses multiLine
    
      key2: 2, // uses align (when defined)
      key3: 3, // uses align (when defined)
    
      key4: 4 // uses multiLine
    }

    Examples of incorrect code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon":true
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
        },
        "one"             : 1,
        "seven"           : 7
    }

    Examples of correct code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon": true
    
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
            //
        }, // These are two separate groups, so no alignment between `myObjectFuction` and `one`
        "one"   : 1,
        "seven" : 7 // `one` and `seven` are in their own group, and therefore aligned
    }

    singleLine and multiLine

    Examples of correct code for this rule with sample { "singleLine": { }, "multiLine": { } } options:

    /*eslint "key-spacing": [2, {
        "singleLine": {
            "beforeColon": false,
            "afterColon": true
        },
        "multiLine": {
            "beforeColon": true,
            "afterColon": true,
            "align": "colon"
        }
    }]*/
    var obj = { one: 1, "two": 2, three: 3 };
    var obj2 = {
        "two" : 2,
        three : 3
    };

    When Not To Use It

    If you have another convention for property spacing that might not be consistent with the available options, or if you want to permit multiple styles concurrently you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

    var io = require('socket.io');
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                var lab_names =[]
    Severity: Minor
    Found in main_server/admin.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

    A space is required after ','.
    Open

                socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    A space is required after '{'.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing inside braces (object-curly-spacing)

    While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

    // simple object literals
    var obj = { foo: "bar" };
    
    // nested object literals
    var obj = { foo: { zoo: "bar" } };
    
    // destructuring assignment (EcmaScript 6)
    var { x, y } = y;
    
    // import/export declarations (EcmaScript 6)
    import { foo } from "bar";
    export { foo };

    Rule Details

    This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

    Options

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

    String option:

    • "never" (default) disallows spacing inside of braces
    • "always" requires spacing inside of braces (except {})

    Object option:

    • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
    • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
    • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
    • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

    never

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

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = { 'foo': 'bar' };
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux'}, bar};
    var {x } = y;
    import { foo } from 'bar';

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

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
    var obj = {
      'foo': 'bar'
    };
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var obj = {};
    var {x} = y;
    import {foo} from 'bar';

    always

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

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux' }, bar};
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var {x} = y;
    import {foo } from 'bar';

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

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {};
    var obj = { 'foo': 'bar' };
    var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
    var obj = {
      'foo': 'bar'
    };
    var { x } = y;
    import { foo } from 'bar';

    arraysInObjects

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

    /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
    
    var obj = {"foo": [ 1, 2 ] };
    var obj = {"foo": [ "baz", "bar" ] };

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

    /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
    
    var obj = { "foo": [ 1, 2 ]};
    var obj = { "foo": [ "baz", "bar" ]};

    objectsInObjects

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

    /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
    
    var obj = {"foo": {"baz": 1, "bar": 2} };

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

    /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
    
    var obj = { "foo": { "baz": 1, "bar": 2 }};

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

    Related Rules

    A space is required before '}'.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing inside braces (object-curly-spacing)

    While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

    // simple object literals
    var obj = { foo: "bar" };
    
    // nested object literals
    var obj = { foo: { zoo: "bar" } };
    
    // destructuring assignment (EcmaScript 6)
    var { x, y } = y;
    
    // import/export declarations (EcmaScript 6)
    import { foo } from "bar";
    export { foo };

    Rule Details

    This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

    Options

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

    String option:

    • "never" (default) disallows spacing inside of braces
    • "always" requires spacing inside of braces (except {})

    Object option:

    • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
    • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
    • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
    • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

    never

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

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = { 'foo': 'bar' };
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux'}, bar};
    var {x } = y;
    import { foo } from 'bar';

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

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
    var obj = {
      'foo': 'bar'
    };
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var obj = {};
    var {x} = y;
    import {foo} from 'bar';

    always

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

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux' }, bar};
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var {x} = y;
    import {foo } from 'bar';

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

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {};
    var obj = { 'foo': 'bar' };
    var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
    var obj = {
      'foo': 'bar'
    };
    var { x } = y;
    import { foo } from 'bar';

    arraysInObjects

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

    /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
    
    var obj = {"foo": [ 1, 2 ] };
    var obj = {"foo": [ "baz", "bar" ] };

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

    /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
    
    var obj = { "foo": [ 1, 2 ]};
    var obj = { "foo": [ "baz", "bar" ]};

    objectsInObjects

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

    /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
    
    var obj = {"foo": {"baz": 1, "bar": 2} };

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

    /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
    
    var obj = { "foo": { "baz": 1, "bar": 2 }};

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

    Related Rules

    Unexpected var, use let or const instead.
    Open

    var APIKeys = require('/etc/main_server/APIKeys.json').keys
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Unexpected tab character.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

    var path = require('path')
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    Opening curly brace does not appear on the same line as controlling statement.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

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

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

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

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected var, use let or const instead.
    Open

                var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Unexpected var, use let or const instead.
    Open

    var config = require('/etc/main_server/conf.json');
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Identifier 'lab_names' is not in camel case.
    Open

                var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

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

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

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

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

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

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    Expected to return a value in function.
    Open

                labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces return statements in callbacks of array's methods (array-callback-return)

    Array has several methods for filtering, mapping, and folding. If we forget to write return statement in a callback of those, it's probably a mistake.

    // example: convert ['a', 'b', 'c'] --> {a: 0, b: 1, c: 2}
    var indexMap = myArray.reduce(function(memo, item, index) {
      memo[item] = index;
    }, {}); // Error: cannot set property 'b' of undefined

    This rule enforces usage of return statement in callbacks of array's methods.

    Rule Details

    This rule finds callback functions of the following methods, then checks usage of return statement.

    Examples of incorrect code for this rule:

    /*eslint array-callback-return: "error"*/
    
    var indexMap = myArray.reduce(function(memo, item, index) {
        memo[item] = index;
    }, {});
    
    var foo = Array.from(nodes, function(node) {
        if (node.tagName === "DIV") {
            return true;
        }
    });
    
    var bar = foo.filter(function(x) {
        if (x) {
            return true;
        } else {
            return;
        }
    });

    Examples of correct code for this rule:

    /*eslint array-callback-return: "error"*/
    
    var indexMap = myArray.reduce(function(memo, item, index) {
        memo[item] = index;
        return memo;
    }, {});
    
    var foo = Array.from(nodes, function(node) {
        if (node.tagName === "DIV") {
            return true;
        }
        return false;
    });
    
    var bar = foo.map(node => node.getAttribute("id"));

    Known Limitations

    This rule checks callback functions of methods with the given names, even if the object which has the method is not an array.

    When Not To Use It

    If you don't want to warn about usage of return statement in callbacks of array's methods, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

    var exec = require('child_process').exec
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    Unexpected tab character.
    Open

                var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    ["Lab_No"] is better written in dot notation.
    Open

                    lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Dot Notation (dot-notation)

    In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

    foo["bar"];

    Rule Details

    This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

    Examples of incorrect code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo["bar"];

    Examples of correct code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo.bar;
    
    var x = foo[bar];    // Property name is a variable, square-bracket notation required

    Options

    This rule accepts a single options argument:

    • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
    • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

    allowKeywords

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

    /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
    
    var foo = { "class": "CS 101" }
    var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

    allowPattern

    For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

    Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

    /*eslint camelcase: "error"*/
    /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
    
    var data = {};
    data.foo_bar = 42;
    
    var data = {};
    data["fooBar"] = 42;
    
    var data = {};
    data["foo_bar"] = 42; // no warning

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

    Expected indentation of 0 spaces but found 3 tabs.
    Open

                })
    Severity: Minor
    Found in main_server/admin.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

    Missing space before function parentheses.
    Open

    module.exports = function(socket)
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

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

    Rule Details

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

    Options

    This rule has a string option or an object option:

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

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

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

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

    "always"

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

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

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

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

    "never"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    When Not To Use It

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

    Related Rules

    Opening curly brace does not appear on the same line as controlling statement.
    Open

    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

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

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

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

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Expected indentation of 2 spaces but found 1 tab.
    Open

        if(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected var, use let or const instead.
    Open

                var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Infix operators must be spaced.
    Open

                var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

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

    Missing semicolon.
    Open

                var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    Strings must use singlequote.
    Open

                    lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

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

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

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

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

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

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

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

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

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

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

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

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

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

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

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

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

    var APIKeys = require('/etc/main_server/APIKeys.json').keys
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    Unexpected var, use let or const instead.
    Open

    var fs = require('fs');
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Missing space before function parentheses.
    Open

                labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

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

    Rule Details

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

    Options

    This rule has a string option or an object option:

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

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

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

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

    "always"

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

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

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

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

    "never"

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    When Not To Use It

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

    Related Rules

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.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 indentation of 0 spaces but found 2 tabs.
    Open

            }
    Severity: Minor
    Found in main_server/admin.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

    Unexpected var, use let or const instead.
    Open

    var exec = require('child_process').exec
    Severity: Minor
    Found in main_server/admin.js by eslint

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

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

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

    Rule Details

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

    Examples

    Examples of incorrect code for this rule:

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

    Examples of correct code for this rule:

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

    When Not To Use It

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

    Unexpected unnamed function.
    Open

    module.exports = function(socket)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

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

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

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

    Rule Details

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

    Options

    This rule has a string option:

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

    always

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

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

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

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

    as-needed

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

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

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

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

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

    never

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

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

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

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

    Further Reading

    Compatibility

    Unexpected tab character.
    Open

                var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

                })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.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

    Strings must use singlequote.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

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

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

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

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

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

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

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

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

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

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

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

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

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

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

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

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

                socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        socket.on('authorize',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    A space is required after ','.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Strings must use singlequote.
    Open

                        lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

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

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

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

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

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

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

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

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

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

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

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

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

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

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

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

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Strings must use singlequote.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

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

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

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

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

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

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

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

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

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

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

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

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

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

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

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

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    A space is required before '}'.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing inside braces (object-curly-spacing)

    While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

    // simple object literals
    var obj = { foo: "bar" };
    
    // nested object literals
    var obj = { foo: { zoo: "bar" } };
    
    // destructuring assignment (EcmaScript 6)
    var { x, y } = y;
    
    // import/export declarations (EcmaScript 6)
    import { foo } from "bar";
    export { foo };

    Rule Details

    This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

    Options

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

    String option:

    • "never" (default) disallows spacing inside of braces
    • "always" requires spacing inside of braces (except {})

    Object option:

    • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
    • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
    • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
    • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

    never

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

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = { 'foo': 'bar' };
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux'}, bar};
    var {x } = y;
    import { foo } from 'bar';

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

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
    var obj = {
      'foo': 'bar'
    };
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var obj = {};
    var {x} = y;
    import {foo} from 'bar';

    always

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

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux' }, bar};
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var {x} = y;
    import {foo } from 'bar';

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

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {};
    var obj = { 'foo': 'bar' };
    var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
    var obj = {
      'foo': 'bar'
    };
    var { x } = y;
    import { foo } from 'bar';

    arraysInObjects

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

    /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
    
    var obj = {"foo": [ 1, 2 ] };
    var obj = {"foo": [ "baz", "bar" ] };

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

    /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
    
    var obj = { "foo": [ 1, 2 ]};
    var obj = { "foo": [ "baz", "bar" ]};

    objectsInObjects

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

    /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
    
    var obj = {"foo": {"baz": 1, "bar": 2} };

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

    /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
    
    var obj = { "foo": { "baz": 1, "bar": 2 }};

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

    Related Rules

    A space is required after ','.
    Open

        socket.on('revaluate',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            var lab_revaluation = [];
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

            var labs = require('/etc/main_server/labs.json').Labs;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Block must not be padded by blank lines.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

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

    if (a) {
    
        b();
    
    }

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

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    blocks

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

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

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

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

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

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

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

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

    classes

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

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

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

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

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

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

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

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

    switches

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

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

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

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

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

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

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

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

    When Not To Use It

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

    Closing curly brace does not appear on the same line as the subsequent block.
    Open

            }
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

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

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

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

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            else socket.emit("login failed");
    Severity: Minor
    Found in main_server/admin.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

    There should be no spaces inside this paren.
    Open

            if(APIKeys.indexOf(data.key) != -1 )
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow or enforce spaces inside of parentheses (space-in-parens)

    Some style guides require or disallow spaces inside of parentheses:

    foo( 'bar' );
    var x = ( 1 + 2 ) * 3;
    
    foo('bar');
    var x = (1 + 2) * 3;

    Rule Details

    This rule will enforce consistency of spacing directly inside of parentheses, by disallowing or requiring one or more spaces to the right of ( and to the left of ). In either case, () will still be allowed.

    Options

    There are two options for this rule:

    • "never" (default) enforces zero spaces inside of parentheses
    • "always" enforces a space inside of parentheses

    Depending on your coding conventions, you can choose either option by specifying it in your configuration:

    "space-in-parens": ["error", "always"]

    "never"

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

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo( 'bar');
    foo('bar' );
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

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

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo();
    
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

    "always"

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

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo( 'bar');
    foo('bar' );
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

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

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo();
    
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

    Exceptions

    An object literal may be used as a third array item to specify exceptions, with the key "exceptions" and an array as the value. These exceptions work in the context of the first option. That is, if "always" is set to enforce spacing, then any "exception" will disallow spacing. Conversely, if "never" is set to disallow spacing, then any "exception" will enforce spacing.

    The following exceptions are available: ["{}", "[]", "()", "empty"].

    Examples of incorrect code for this rule with the "never", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo(1, {bar: 'baz'});

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

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo(1, {bar: 'baz'} );

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo( 1, {bar: 'baz'} );

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

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo( 1, {bar: 'baz'});

    Examples of incorrect code for this rule with the "never", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1);

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

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1 );

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

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1 );

    Examples of incorrect code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo((1 + 2));
    foo((1 + 2), 1);

    Examples of correct code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo( (1 + 2) );
    foo( (1 + 2), 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo( ( 1 + 2 ) );
    foo( ( 1 + 2 ), 1 );

    Examples of correct code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo(( 1 + 2 ));
    foo(( 1 + 2 ), 1 );

    The "empty" exception concerns empty parentheses, and works the same way as the other exceptions, inverting the first option.

    Example of incorrect code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo();

    Example of correct code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of incorrect code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of correct code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo();

    You can include multiple entries in the "exceptions" array.

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}", "[]"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar( {bar:'baz'} );
    baz( 1, [1,2] );
    foo( {bar: 'baz'}, [1, 2] );

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

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar({bar:'baz'});
    baz( 1, [1,2]);
    foo({bar: 'baz'}, [1, 2]);

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between parentheses.

    Related Rules

    Opening curly brace does not appear on the same line as controlling statement.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

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

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

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

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

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

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

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

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Strings must use singlequote.
    Open

                socket.emit("successful login");
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

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

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

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

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

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

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

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

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

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

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

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

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

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

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

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

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

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

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

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

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Expected indentation of 0 spaces but found 2 tabs.
    Open

            }
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

        socket.on('send_reval_data',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected function expression.
    Open

        socket.on('send_reval_data',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

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

    Arrow functions are suited to callbacks, because:

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

    Rule Details

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

    The following patterns are considered problems:

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

    The following patterns are not considered problems:

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

    Options

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

    allowNamedFunctions

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

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

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

    allowUnboundThis

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

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

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

    When Not To Use It

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

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

    Missing semicolon.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    omitLastInOneLineBlock

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

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

    When Not To Use It

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

    Further Reading

    Related Rules

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

    Infix operators must be spaced.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

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

    Unexpected tab character.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Block must not be padded by blank lines.
    Open

                }
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

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

    if (a) {
    
        b();
    
    }

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

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

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

    blocks

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

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

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

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

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

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

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

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

    classes

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

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

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

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

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

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

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

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

    switches

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

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

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

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

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

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

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

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

    When Not To Use It

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

    Unexpected function expression.
    Open

                    labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

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

    Arrow functions are suited to callbacks, because:

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

    Rule Details

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

    The following patterns are considered problems:

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

    The following patterns are not considered problems:

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

    Options

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

    allowNamedFunctions

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

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

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

    allowUnboundThis

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

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

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

    When Not To Use It

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

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

    Missing semicolon.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

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

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

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

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

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

    return
    {
        name: "ESLint"
    };

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

    return;
    {
        name: "ESLint";
    }

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

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

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

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

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

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

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

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

    String option:

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

    Object option:

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

    always

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

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

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

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

    never

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

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

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

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Expected space(s) after "while".
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.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

    Unexpected unnamed function.
    Open

                    labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Missing space before function parentheses.
    Open

        socket.on('revaluate',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            console.log(data)
    Severity: Minor
    Found in main_server/admin.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 indentation of 0 spaces but found 1 tab.
    Open

        })
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 4 tabs.
    Open

                    labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                        lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 5 tabs.
    Open

                        lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            var lab_revaluation = [];
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected function expression.
    Open

        socket.on('authorize',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            if(APIKeys.indexOf(data.key) != -1 )
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                socket.emit("successful login");
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 4 tabs.
    Open

                    var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.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

    Unexpected var, use let or const instead.
    Open

                    var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Identifier 'lab_names' is not in camel case.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 0 spaces but found 1 tab.
    Open

        })
    Severity: Minor
    Found in main_server/admin.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

    Unexpected unnamed function.
    Open

        socket.on('revaluate',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            if(!socket.handshake.session.key) return;
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 2 tabs.
    Open

            var labs = require('/etc/main_server/labs.json').Labs;
    Severity: Minor
    Found in main_server/admin.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

    All 'var' declarations must be at the top of the function scope.
    Open

            for(var rev in data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    A space is required after ','.
    Open

        socket.on('authorize',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    More than 2 blank lines not allowed.
    Open

    
    
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow multiple empty lines (no-multiple-empty-lines)

    Some developers prefer to have multiple blank lines removed, while others feel that it helps improve readability. Whitespace is useful for separating logical sections of code, but excess whitespace takes up more of the screen.

    Rule Details

    This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of empty lines has been exceeded.

    Options

    This rule has an object option:

    • "max" (default: 2) enforces a maximum number of consecutive empty lines.
    • "maxEOF" enforces a maximum number of consecutive empty lines at the end of files.
    • "maxBOF" enforces a maximum number of consecutive empty lines at the beginning of files.

    max

    Examples of incorrect code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    
    var bar = 3;

    Examples of correct code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxEOF

    Examples of incorrect code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxBOF

    Examples of incorrect code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/
    
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1}]*/
    
    var foo = 5;
    
    
    var bar = 3;

    When Not To Use It

    If you do not care about extra blank lines, turn this off. Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

        socket.on('send_reval_data',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Missing space before function parentheses.
    Open

        socket.on('send_reval_data',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Unexpected tab character.
    Open

            if(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Opening curly brace does not appear on the same line as controlling statement.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected tab character.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 1 tab.
    Open

        socket.on('authorize',function(data)
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 1 tab.
    Open

        socket.on('revaluate',function(data)
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 2 tabs.
    Open

            if(APIKeys.indexOf(data.key) != -1 )
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

            console.log(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                socket.handshake.session.key = data.key;
    Severity: Minor
    Found in main_server/admin.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

    Missing semicolon.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            if(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

            else socket.emit("login failed");
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Expected indentation of 0 spaces but found 3 tabs.
    Open

                }
    Severity: Minor
    Found in main_server/admin.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

    Missing space before function parentheses.
    Open

                    labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            for(var rev in data)
    Severity: Minor
    Found in main_server/admin.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

    Missing space before value for key 'Labs'.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing between keys and values in object literal properties (key-spacing)

    This rule enforces spacing around the colon in object literal properties. It can verify each property individually, or it can ensure horizontal alignment of adjacent properties in an object literal.

    Rule Details

    This rule enforces consistent spacing between keys and values in object literal properties. In the case of long lines, it is acceptable to add a new line wherever whitespace is allowed.

    Options

    This rule has an object option:

    • "beforeColon": false (default) disallows spaces between the key and the colon in object literals.
    • "beforeColon": true requires at least one space between the key and the colon in object literals.
    • "afterColon": true (default) requires at least one space between the colon and the value in object literals.
    • "afterColon": false disallows spaces between the colon and the value in object literals.
    • "mode": "strict" (default) enforces exactly one space before or after colons in object literals.
    • "mode": "minimum" enforces one or more spaces before or after colons in object literals.
    • "align": "value" enforces horizontal alignment of values in object literals.
    • "align": "colon" enforces horizontal alignment of both colons and values in object literals.
    • "align" with an object value allows for fine-grained spacing when values are being aligned in object literals.
    • "singleLine" specifies a spacing style for single-line object literals.
    • "multiLine" specifies a spacing style for multi-line object literals.

    Please note that you can either use the top-level options or the grouped options (singleLine and multiLine) but not both.

    beforeColon

    Examples of incorrect code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo" : 42 };

    Examples of correct code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo" : 42 };

    afterColon

    Examples of incorrect code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo":42 };

    Examples of correct code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo":42 };

    mode

    Examples of incorrect code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat: 2 * 2
    });

    Examples of correct code for this rule with the { "mode": "minimum" } option:

    /*eslint key-spacing: ["error", { "mode": "minimum" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    align

    Examples of incorrect code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a: value,
        bcde:  42,
        fg :   foo()
    };

    Examples of correct code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a:    value,
        bcde: 42,
    
        fg: foo(),
        h:  function() {
            return this.a;
        },
        ijkl: 'Non-consecutive lines form a new group'
    };
    
    var obj = { a: "foo", longPropertyName: "bar" };

    Examples of incorrect code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat   : 2 * 2
    });

    align

    The align option can take additional configuration through the beforeColon, afterColon, mode, and on options.

    If align is defined as an object, but not all of the parameters are provided, undefined parameters will default to the following:

    // Defaults
    align: {
        "beforeColon": false,
        "afterColon": true,
        "on": "colon",
        "mode": "strict"
    }

    Examples of correct code for this rule with sample { "align": { } } options:

    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "one"   : 1,
        "seven" : 7
    }
    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": false,
            "afterColon": false,
            "on": "value"
        }
    }]*/
    
    var obj = {
        "one":  1,
        "seven":7
    }

    align and multiLine

    The multiLine and align options can differ, which allows for fine-tuned control over the key-spacing of your files. align will not inherit from multiLine if align is configured as an object.

    multiLine is used any time an object literal spans multiple lines. The align configuration is used when there is a group of properties in the same object. For example:

    var myObj = {
      key1: 1, // uses multiLine
    
      key2: 2, // uses align (when defined)
      key3: 3, // uses align (when defined)
    
      key4: 4 // uses multiLine
    }

    Examples of incorrect code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon":true
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
        },
        "one"             : 1,
        "seven"           : 7
    }

    Examples of correct code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon": true
    
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
            //
        }, // These are two separate groups, so no alignment between `myObjectFuction` and `one`
        "one"   : 1,
        "seven" : 7 // `one` and `seven` are in their own group, and therefore aligned
    }

    singleLine and multiLine

    Examples of correct code for this rule with sample { "singleLine": { }, "multiLine": { } } options:

    /*eslint "key-spacing": [2, {
        "singleLine": {
            "beforeColon": false,
            "afterColon": true
        },
        "multiLine": {
            "beforeColon": true,
            "afterColon": true,
            "align": "colon"
        }
    }]*/
    var obj = { one: 1, "two": 2, three: 3 };
    var obj2 = {
        "two" : 2,
        three : 3
    };

    When Not To Use It

    If you have another convention for property spacing that might not be consistent with the available options, or if you want to permit multiple styles concurrently you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

            for(var rev in data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                var i =0;
    Severity: Minor
    Found in main_server/admin.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

    All 'var' declarations must be at the top of the function scope.
    Open

            var labs = require('/etc/main_server/labs.json').Labs;
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                var i =0;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

                var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

                var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.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

    Block must not be padded by blank lines.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Expected space(s) after "if".
    Open

            if(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                    var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected var, use let or const instead.
    Open

            var lab_revaluation = [];
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

            console.log(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Expected space(s) after "for".
    Open

            for(var rev in data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

                var i =0;
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

                var i =0;
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    All 'var' declarations must be at the top of the function scope.
    Open

                    var lab_names =[]
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    ["Lab_No"] is better written in dot notation.
    Open

                        lab_names.push(lab["Lab_No"]);
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Dot Notation (dot-notation)

    In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

    foo["bar"];

    Rule Details

    This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

    Examples of incorrect code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo["bar"];

    Examples of correct code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo.bar;
    
    var x = foo[bar];    // Property name is a variable, square-bracket notation required

    Options

    This rule accepts a single options argument:

    • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
    • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

    allowKeywords

    Examples of correct code for the { "allowKeywords": false } option:

    /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
    
    var foo = { "class": "CS 101" }
    var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

    allowPattern

    For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

    Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

    /*eslint camelcase: "error"*/
    /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
    
    var data = {};
    data.foo_bar = 42;
    
    var data = {};
    data["fooBar"] = 42;
    
    var data = {};
    data["foo_bar"] = 42; // no warning

    Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                    })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            if(!socket.handshake.session.key) return;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected unnamed function.
    Open

        socket.on('authorize',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Block must not be padded by blank lines.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Missing semicolon.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.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

    Missing space before value for key 'lab'.
    Open

                    lab:data[rev].labname,
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing between keys and values in object literal properties (key-spacing)

    This rule enforces spacing around the colon in object literal properties. It can verify each property individually, or it can ensure horizontal alignment of adjacent properties in an object literal.

    Rule Details

    This rule enforces consistent spacing between keys and values in object literal properties. In the case of long lines, it is acceptable to add a new line wherever whitespace is allowed.

    Options

    This rule has an object option:

    • "beforeColon": false (default) disallows spaces between the key and the colon in object literals.
    • "beforeColon": true requires at least one space between the key and the colon in object literals.
    • "afterColon": true (default) requires at least one space between the colon and the value in object literals.
    • "afterColon": false disallows spaces between the colon and the value in object literals.
    • "mode": "strict" (default) enforces exactly one space before or after colons in object literals.
    • "mode": "minimum" enforces one or more spaces before or after colons in object literals.
    • "align": "value" enforces horizontal alignment of values in object literals.
    • "align": "colon" enforces horizontal alignment of both colons and values in object literals.
    • "align" with an object value allows for fine-grained spacing when values are being aligned in object literals.
    • "singleLine" specifies a spacing style for single-line object literals.
    • "multiLine" specifies a spacing style for multi-line object literals.

    Please note that you can either use the top-level options or the grouped options (singleLine and multiLine) but not both.

    beforeColon

    Examples of incorrect code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo" : 42 };

    Examples of correct code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo" : 42 };

    afterColon

    Examples of incorrect code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo":42 };

    Examples of correct code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo":42 };

    mode

    Examples of incorrect code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat: 2 * 2
    });

    Examples of correct code for this rule with the { "mode": "minimum" } option:

    /*eslint key-spacing: ["error", { "mode": "minimum" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    align

    Examples of incorrect code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a: value,
        bcde:  42,
        fg :   foo()
    };

    Examples of correct code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a:    value,
        bcde: 42,
    
        fg: foo(),
        h:  function() {
            return this.a;
        },
        ijkl: 'Non-consecutive lines form a new group'
    };
    
    var obj = { a: "foo", longPropertyName: "bar" };

    Examples of incorrect code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat   : 2 * 2
    });

    align

    The align option can take additional configuration through the beforeColon, afterColon, mode, and on options.

    If align is defined as an object, but not all of the parameters are provided, undefined parameters will default to the following:

    // Defaults
    align: {
        "beforeColon": false,
        "afterColon": true,
        "on": "colon",
        "mode": "strict"
    }

    Examples of correct code for this rule with sample { "align": { } } options:

    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "one"   : 1,
        "seven" : 7
    }
    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": false,
            "afterColon": false,
            "on": "value"
        }
    }]*/
    
    var obj = {
        "one":  1,
        "seven":7
    }

    align and multiLine

    The multiLine and align options can differ, which allows for fine-tuned control over the key-spacing of your files. align will not inherit from multiLine if align is configured as an object.

    multiLine is used any time an object literal spans multiple lines. The align configuration is used when there is a group of properties in the same object. For example:

    var myObj = {
      key1: 1, // uses multiLine
    
      key2: 2, // uses align (when defined)
      key3: 3, // uses align (when defined)
    
      key4: 4 // uses multiLine
    }

    Examples of incorrect code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon":true
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
        },
        "one"             : 1,
        "seven"           : 7
    }

    Examples of correct code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon": true
    
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
            //
        }, // These are two separate groups, so no alignment between `myObjectFuction` and `one`
        "one"   : 1,
        "seven" : 7 // `one` and `seven` are in their own group, and therefore aligned
    }

    singleLine and multiLine

    Examples of correct code for this rule with sample { "singleLine": { }, "multiLine": { } } options:

    /*eslint "key-spacing": [2, {
        "singleLine": {
            "beforeColon": false,
            "afterColon": true
        },
        "multiLine": {
            "beforeColon": true,
            "afterColon": true,
            "align": "colon"
        }
    }]*/
    var obj = { one: 1, "two": 2, three: 3 };
    var obj2 = {
        "two" : 2,
        three : 3
    };

    When Not To Use It

    If you have another convention for property spacing that might not be consistent with the available options, or if you want to permit multiple styles concurrently you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected unnamed function.
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    A space is required after ','.
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                console.log(newScores)
    Severity: Minor
    Found in main_server/admin.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

    A space is required after '{'.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing inside braces (object-curly-spacing)

    While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

    // simple object literals
    var obj = { foo: "bar" };
    
    // nested object literals
    var obj = { foo: { zoo: "bar" } };
    
    // destructuring assignment (EcmaScript 6)
    var { x, y } = y;
    
    // import/export declarations (EcmaScript 6)
    import { foo } from "bar";
    export { foo };

    Rule Details

    This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "never" (default) disallows spacing inside of braces
    • "always" requires spacing inside of braces (except {})

    Object option:

    • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
    • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
    • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
    • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

    never

    Examples of incorrect code for this rule with the default "never" option:

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = { 'foo': 'bar' };
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux'}, bar};
    var {x } = y;
    import { foo } from 'bar';

    Examples of correct code for this rule with the default "never" option:

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
    var obj = {
      'foo': 'bar'
    };
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var obj = {};
    var {x} = y;
    import {foo} from 'bar';

    always

    Examples of incorrect code for this rule with the "always" option:

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux' }, bar};
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var {x} = y;
    import {foo } from 'bar';

    Examples of correct code for this rule with the "always" option:

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {};
    var obj = { 'foo': 'bar' };
    var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
    var obj = {
      'foo': 'bar'
    };
    var { x } = y;
    import { foo } from 'bar';

    arraysInObjects

    Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

    /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
    
    var obj = {"foo": [ 1, 2 ] };
    var obj = {"foo": [ "baz", "bar" ] };

    Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

    /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
    
    var obj = { "foo": [ 1, 2 ]};
    var obj = { "foo": [ "baz", "bar" ]};

    objectsInObjects

    Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

    /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
    
    var obj = {"foo": {"baz": 1, "bar": 2} };

    Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

    /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
    
    var obj = { "foo": { "baz": 1, "bar": 2 }};

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

    Related Rules

    ["score"] is better written in dot notation.
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Dot Notation (dot-notation)

    In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

    foo["bar"];

    Rule Details

    This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

    Examples of incorrect code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo["bar"];

    Examples of correct code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo.bar;
    
    var x = foo[bar];    // Property name is a variable, square-bracket notation required

    Options

    This rule accepts a single options argument:

    • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
    • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

    allowKeywords

    Examples of correct code for the { "allowKeywords": false } option:

    /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
    
    var foo = { "class": "CS 101" }
    var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

    allowPattern

    For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

    Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

    /*eslint camelcase: "error"*/
    /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
    
    var data = {};
    data.foo_bar = 42;
    
    var data = {};
    data["fooBar"] = 42;
    
    var data = {};
    data["foo_bar"] = 42; // no warning

    Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                         {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Mixed spaces and tabs.
    Open

                         {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Unexpected tab character.
    Open

                     })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

                     })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected function expression.
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Identifier 'score_string' is not in camel case.
    Open

                         var score_string ="";
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

                         var score_string ="";
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                         {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Mixed spaces and tabs.
    Open

                         write_to_file.write(score_string,function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Mixed spaces and tabs.
    Open

                         })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Expected space(s) after "if".
    Open

            if(APIKeys.indexOf(data.key) != -1 )
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Block must not be padded by blank lines.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 1 tab.
    Open

        socket.on('send_reval_data',function(data)
    Severity: Minor
    Found in main_server/admin.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 indentation of 0 spaces but found 4 tabs.
    Open

                    })
    Severity: Minor
    Found in main_server/admin.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

    A space is required after ','.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    A space is required after '{'.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing inside braces (object-curly-spacing)

    While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

    // simple object literals
    var obj = { foo: "bar" };
    
    // nested object literals
    var obj = { foo: { zoo: "bar" } };
    
    // destructuring assignment (EcmaScript 6)
    var { x, y } = y;
    
    // import/export declarations (EcmaScript 6)
    import { foo } from "bar";
    export { foo };

    Rule Details

    This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "never" (default) disallows spacing inside of braces
    • "always" requires spacing inside of braces (except {})

    Object option:

    • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
    • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
    • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
    • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

    never

    Examples of incorrect code for this rule with the default "never" option:

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = { 'foo': 'bar' };
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux'}, bar};
    var {x } = y;
    import { foo } from 'bar';

    Examples of correct code for this rule with the default "never" option:

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
    var obj = {
      'foo': 'bar'
    };
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var obj = {};
    var {x} = y;
    import {foo} from 'bar';

    always

    Examples of incorrect code for this rule with the "always" option:

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux' }, bar};
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var {x} = y;
    import {foo } from 'bar';

    Examples of correct code for this rule with the "always" option:

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {};
    var obj = { 'foo': 'bar' };
    var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
    var obj = {
      'foo': 'bar'
    };
    var { x } = y;
    import { foo } from 'bar';

    arraysInObjects

    Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

    /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
    
    var obj = {"foo": [ 1, 2 ] };
    var obj = {"foo": [ "baz", "bar" ] };

    Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

    /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
    
    var obj = { "foo": [ 1, 2 ]};
    var obj = { "foo": [ "baz", "bar" ]};

    objectsInObjects

    Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

    /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
    
    var obj = {"foo": {"baz": 1, "bar": 2} };

    Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

    /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
    
    var obj = { "foo": { "baz": 1, "bar": 2 }};

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

    Related Rules

    Expected space(s) after "if".
    Open

            if(!socket.handshake.session.key) return;
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

            var lab_revaluation = [];
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected var, use let or const instead.
    Open

            var labs = require('/etc/main_server/labs.json').Labs;
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    There should be no spaces inside this paren.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    Disallow or enforce spaces inside of parentheses (space-in-parens)

    Some style guides require or disallow spaces inside of parentheses:

    foo( 'bar' );
    var x = ( 1 + 2 ) * 3;
    
    foo('bar');
    var x = (1 + 2) * 3;

    Rule Details

    This rule will enforce consistency of spacing directly inside of parentheses, by disallowing or requiring one or more spaces to the right of ( and to the left of ). In either case, () will still be allowed.

    Options

    There are two options for this rule:

    • "never" (default) enforces zero spaces inside of parentheses
    • "always" enforces a space inside of parentheses

    Depending on your coding conventions, you can choose either option by specifying it in your configuration:

    "space-in-parens": ["error", "always"]

    "never"

    Examples of incorrect code for this rule with the default "never" option:

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo( 'bar');
    foo('bar' );
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

    Examples of correct code for this rule with the default "never" option:

    /*eslint space-in-parens: ["error", "never"]*/
    
    foo();
    
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

    "always"

    Examples of incorrect code for this rule with the "always" option:

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo( 'bar');
    foo('bar' );
    foo('bar');
    
    var foo = (1 + 2) * 3;
    (function () { return 'bar'; }());

    Examples of correct code for this rule with the "always" option:

    /*eslint space-in-parens: ["error", "always"]*/
    
    foo();
    
    foo( 'bar' );
    
    var foo = ( 1 + 2 ) * 3;
    ( function () { return 'bar'; }() );

    Exceptions

    An object literal may be used as a third array item to specify exceptions, with the key "exceptions" and an array as the value. These exceptions work in the context of the first option. That is, if "always" is set to enforce spacing, then any "exception" will disallow spacing. Conversely, if "never" is set to disallow spacing, then any "exception" will enforce spacing.

    The following exceptions are available: ["{}", "[]", "()", "empty"].

    Examples of incorrect code for this rule with the "never", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo(1, {bar: 'baz'});

    Examples of correct code for this rule with the "never", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo(1, {bar: 'baz'} );

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo( {bar: 'baz'} );
    foo( 1, {bar: 'baz'} );

    Examples of correct code for this rule with the "always", { "exceptions": ["{}"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}"] }]*/
    
    foo({bar: 'baz'});
    foo( 1, {bar: 'baz'});

    Examples of incorrect code for this rule with the "never", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1);

    Examples of correct code for this rule with the "never", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo( [bar, baz] );
    foo( [bar, baz], 1 );

    Examples of correct code for this rule with the "always", { "exceptions": ["[]"] } option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["[]"] }]*/
    
    foo([bar, baz]);
    foo([bar, baz], 1 );

    Examples of incorrect code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo((1 + 2));
    foo((1 + 2), 1);

    Examples of correct code for this rule with the "never", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["()"] }]*/
    
    foo( (1 + 2) );
    foo( (1 + 2), 1);

    Examples of incorrect code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo( ( 1 + 2 ) );
    foo( ( 1 + 2 ), 1 );

    Examples of correct code for this rule with the "always", { "exceptions": ["()"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["()"] }]*/
    
    foo(( 1 + 2 ));
    foo(( 1 + 2 ), 1 );

    The "empty" exception concerns empty parentheses, and works the same way as the other exceptions, inverting the first option.

    Example of incorrect code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo();

    Example of correct code for this rule with the "never", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "never", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of incorrect code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo( );

    Example of correct code for this rule with the "always", { "exceptions": ["empty"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["empty"] }]*/
    
    foo();

    You can include multiple entries in the "exceptions" array.

    Examples of incorrect code for this rule with the "always", { "exceptions": ["{}", "[]"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar( {bar:'baz'} );
    baz( 1, [1,2] );
    foo( {bar: 'baz'}, [1, 2] );

    Examples of correct code for this rule with the "always", { "exceptions": ["{}", "[]"] }] option:

    /*eslint space-in-parens: ["error", "always", { "exceptions": ["{}", "[]"] }]*/
    
    bar({bar:'baz'});
    baz( 1, [1,2]);
    foo({bar: 'baz'}, [1, 2]);

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between parentheses.

    Related Rules

    Block must not be padded by blank lines.
    Open

            }
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected to return a value in function.
    Open

                    labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces return statements in callbacks of array's methods (array-callback-return)

    Array has several methods for filtering, mapping, and folding. If we forget to write return statement in a callback of those, it's probably a mistake.

    // example: convert ['a', 'b', 'c'] --> {a: 0, b: 1, c: 2}
    var indexMap = myArray.reduce(function(memo, item, index) {
      memo[item] = index;
    }, {}); // Error: cannot set property 'b' of undefined

    This rule enforces usage of return statement in callbacks of array's methods.

    Rule Details

    This rule finds callback functions of the following methods, then checks usage of return statement.

    Examples of incorrect code for this rule:

    /*eslint array-callback-return: "error"*/
    
    var indexMap = myArray.reduce(function(memo, item, index) {
        memo[item] = index;
    }, {});
    
    var foo = Array.from(nodes, function(node) {
        if (node.tagName === "DIV") {
            return true;
        }
    });
    
    var bar = foo.filter(function(x) {
        if (x) {
            return true;
        } else {
            return;
        }
    });

    Examples of correct code for this rule:

    /*eslint array-callback-return: "error"*/
    
    var indexMap = myArray.reduce(function(memo, item, index) {
        memo[item] = index;
        return memo;
    }, {});
    
    var foo = Array.from(nodes, function(node) {
        if (node.tagName === "DIV") {
            return true;
        }
        return false;
    });
    
    var bar = foo.map(node => node.getAttribute("id"));

    Known Limitations

    This rule checks callback functions of methods with the given names, even if the object which has the method is not an array.

    When Not To Use It

    If you don't want to warn about usage of return statement in callbacks of array's methods, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected function expression.
    Open

        socket.on('revaluate',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            console.log(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing space before function parentheses.
    Open

        socket.on('authorize',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Identifier 'lab_revaluation' is not in camel case.
    Open

            var lab_revaluation = [];
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected require().
    Open

            var labs = require('/etc/main_server/labs.json').Labs;
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforce require() on the top-level module scope (global-require)

    In Node.js, module dependencies are included using the require() function, such as:

    var fs = require("fs");

    While require() may be called anywhere in code, some style guides prescribe that it should be called only in the top level of a module to make it easier to identify dependencies. For instance, it's arguably harder to identify dependencies when they are deeply nested inside of functions and other statements:

    function foo() {
    
        if (condition) {
            var fs = require("fs");
        }
    }

    Since require() does a synchronous load, it can cause performance problems when used in other locations.

    Further, ES6 modules mandate that import and export statements can only occur in the top level of the module's body.

    Rule Details

    This rule requires all calls to require() to be at the top level of the module, similar to ES6 import and export statements, which also can occur only at the top level.

    Examples of incorrect code for this rule:

    /*eslint global-require: "error"*/
    /*eslint-env es6*/
    
    // calling require() inside of a function is not allowed
    function readFile(filename, callback) {
        var fs = require('fs');
        fs.readFile(filename, callback)
    }
    
    // conditional requires like this are also not allowed
    if (DEBUG) { require('debug'); }
    
    // a require() in a switch statement is also flagged
    switch(x) { case '1': require('1'); break; }
    
    // you may not require() inside an arrow function body
    var getModule = (name) => require(name);
    
    // you may not require() inside of a function body as well
    function getModule(name) { return require(name); }
    
    // you may not require() inside of a try/catch block
    try {
        require(unsafeModule);
    } catch(e) {
        console.log(e);
    }

    Examples of correct code for this rule:

    /*eslint global-require: "error"*/
    
    // all these variations of require() are ok
    require('x');
    var y = require('y');
    var z;
    z = require('z').initialize();
    
    // requiring a module and using it in a function is ok
    var fs = require('fs');
    function readFile(filename, callback) {
        fs.readFile(filename, callback)
    }
    
    // you can use a ternary to determine which module to require
    var logger = DEBUG ? require('dev-logger') : require('logger');
    
    // if you want you can require() at the end of your module
    function doSomethingA() {}
    function doSomethingB() {}
    var x = require("x"),
        z = require("z");

    When Not To Use It

    If you have a module that must be initialized with information that comes from the file-system or if a module is only used in very rare situations and will cause significant overhead to load it may make sense to disable the rule. If you need to require() an optional dependency inside of a try/catch, you can disable this rule for just that dependency using the // eslint-disable-line global-require comment. Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

                var i =0;
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    ["Lab_No"] is better written in dot notation.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Dot Notation (dot-notation)

    In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

    foo["bar"];

    Rule Details

    This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

    Examples of incorrect code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo["bar"];

    Examples of correct code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo.bar;
    
    var x = foo[bar];    // Property name is a variable, square-bracket notation required

    Options

    This rule accepts a single options argument:

    • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
    • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

    allowKeywords

    Examples of correct code for the { "allowKeywords": false } option:

    /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
    
    var foo = { "class": "CS 101" }
    var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

    allowPattern

    For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

    Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

    /*eslint camelcase: "error"*/
    /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
    
    var data = {};
    data.foo_bar = 42;
    
    var data = {};
    data["fooBar"] = 42;
    
    var data = {};
    data["foo_bar"] = 42; // no warning

    Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                socket.emit("successful login");
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Strings must use singlequote.
    Open

            else socket.emit("login failed");
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

    Examples of incorrect code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

    Examples of correct code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

    Examples of incorrect code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

    Examples of correct code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

    Examples of incorrect code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

    Examples of correct code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

    Examples of additional correct code for this rule with the "double", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

    Examples of additional correct code for this rule with the "single", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

    Examples of additional correct code for this rule with the "backtick", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

    Examples of additional correct code for this rule with the "double", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

    Examples of additional correct code for this rule with the "single", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    All 'var' declarations must be at the top of the function scope.
    Open

                    var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected require().
    Open

                    var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforce require() on the top-level module scope (global-require)

    In Node.js, module dependencies are included using the require() function, such as:

    var fs = require("fs");

    While require() may be called anywhere in code, some style guides prescribe that it should be called only in the top level of a module to make it easier to identify dependencies. For instance, it's arguably harder to identify dependencies when they are deeply nested inside of functions and other statements:

    function foo() {
    
        if (condition) {
            var fs = require("fs");
        }
    }

    Since require() does a synchronous load, it can cause performance problems when used in other locations.

    Further, ES6 modules mandate that import and export statements can only occur in the top level of the module's body.

    Rule Details

    This rule requires all calls to require() to be at the top level of the module, similar to ES6 import and export statements, which also can occur only at the top level.

    Examples of incorrect code for this rule:

    /*eslint global-require: "error"*/
    /*eslint-env es6*/
    
    // calling require() inside of a function is not allowed
    function readFile(filename, callback) {
        var fs = require('fs');
        fs.readFile(filename, callback)
    }
    
    // conditional requires like this are also not allowed
    if (DEBUG) { require('debug'); }
    
    // a require() in a switch statement is also flagged
    switch(x) { case '1': require('1'); break; }
    
    // you may not require() inside an arrow function body
    var getModule = (name) => require(name);
    
    // you may not require() inside of a function body as well
    function getModule(name) { return require(name); }
    
    // you may not require() inside of a try/catch block
    try {
        require(unsafeModule);
    } catch(e) {
        console.log(e);
    }

    Examples of correct code for this rule:

    /*eslint global-require: "error"*/
    
    // all these variations of require() are ok
    require('x');
    var y = require('y');
    var z;
    z = require('z').initialize();
    
    // requiring a module and using it in a function is ok
    var fs = require('fs');
    function readFile(filename, callback) {
        fs.readFile(filename, callback)
    }
    
    // you can use a ternary to determine which module to require
    var logger = DEBUG ? require('dev-logger') : require('logger');
    
    // if you want you can require() at the end of your module
    function doSomethingA() {}
    function doSomethingB() {}
    var x = require("x"),
        z = require("z");

    When Not To Use It

    If you have a module that must be initialized with information that comes from the file-system or if a module is only used in very rare situations and will cause significant overhead to load it may make sense to disable the rule. If you need to require() an optional dependency inside of a try/catch, you can disable this rule for just that dependency using the // eslint-disable-line global-require comment. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                    labs.map(function(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            for(var rev in data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected use of continue statement.
    Open

                if(i> labs.length) continue;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow continue statements (no-continue)

    The continue statement terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. When used incorrectly it makes code less testable, less readable and less maintainable. Structured control flow statements such as if should be used instead.

    var sum = 0,
        i;
    
    for(i = 0; i < 10; i++) {
        if(i >= 5) {
            continue;
        }
    
        a += i;
    }

    Rule Details

    This rule disallows continue statements.

    Examples of incorrect code for this rule:

    /*eslint no-continue: "error"*/
    
    var sum = 0,
        i;
    
    for(i = 0; i < 10; i++) {
        if(i >= 5) {
            continue;
        }
    
        a += i;
    }
    /*eslint no-continue: "error"*/
    
    var sum = 0,
        i;
    
    labeledLoop: for(i = 0; i < 10; i++) {
        if(i >= 5) {
            continue labeledLoop;
        }
    
        a += i;
    }

    Examples of correct code for this rule:

    /*eslint no-continue: "error"*/
    
    var sum = 0,
        i;
    
    for(i = 0; i < 10; i++) {
        if(i < 5) {
           a += i;
        }
    }

    Compatibility

    Identifier 'score_string' is not in camel case.
    Open

                             score_string = score_string + id + ',' + newScores[i]['score'][id] + '\n';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    Mixed spaces and tabs.
    Open

                         }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Infix operators must be spaced.
    Open

                if(i> labs.length) continue;
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected string concatenation.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    Expected indentation of 0 spaces but found 2 tabs.
    Open

            }
    Severity: Minor
    Found in main_server/admin.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

    All 'var' declarations must be at the top of the function scope.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Infix operators must be spaced.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Expected space(s) after "for".
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Mixed spaces and tabs.
    Open

                             score_string = score_string + id + ',' + newScores[i]['score'][id] + '\n';
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Identifier 'start_date' is not in camel case.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            console.log(lab_revaluation)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            console.log(lab_revaluation)
    Severity: Minor
    Found in main_server/admin.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

    Opening curly brace does not appear on the same line as controlling statement.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Mixed spaces and tabs.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Unexpected tab character.
    Open

                         write_to_file.write(score_string,function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    A space is required after ','.
    Open

                         write_to_file.write(score_string,function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                    lab:data[rev].labname,
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    startDate: new Date(start_date),
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 4 tabs.
    Open

                    admin_key : socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.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 indentation of 0 spaces but found 3 tabs.
    Open

                })
    Severity: Minor
    Found in main_server/admin.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

    Missing semicolon.
    Open

            console.log(lab_revaluation)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                    admin_key : socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                console.log(newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

            }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected var, use let or const instead.
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Missing space before function parentheses.
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Unexpected tab character.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

                             socket.emit('update_score',newScores[i]['labName'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                         })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected var, use let or const instead.
    Open

                         var score_string ="";
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Unexpected string concatenation.
    Open

                             score_string = score_string + id + ',' + newScores[i]['score'][id] + '\n';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    ["score"] is better written in dot notation.
    Open

                             score_string = score_string + id + ',' + newScores[i]['score'][id] + '\n';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Dot Notation (dot-notation)

    In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

    foo["bar"];

    Rule Details

    This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

    Examples of incorrect code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo["bar"];

    Examples of correct code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo.bar;
    
    var x = foo[bar];    // Property name is a variable, square-bracket notation required

    Options

    This rule accepts a single options argument:

    • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
    • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

    allowKeywords

    Examples of correct code for the { "allowKeywords": false } option:

    /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
    
    var foo = { "class": "CS 101" }
    var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

    allowPattern

    For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

    Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

    /*eslint camelcase: "error"*/
    /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
    
    var data = {};
    data.foo_bar = 42;
    
    var data = {};
    data["fooBar"] = 42;
    
    var data = {};
    data["foo_bar"] = 42; // no warning

    Source: http://eslint.org/docs/rules/

    Unexpected function expression.
    Open

                         write_to_file.write(score_string,function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                socket.handshake.session.key = data.key;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected unnamed function.
    Open

        socket.on('send_reval_data',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Unexpected tab character.
    Open

                    var labs = require('/etc/main_server/labs.json').Labs
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                    })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    A space is required after ','.
    Open

                    socket.emit('login_success',{})
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    socket.emit("reval",{Labs:lab_names})
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

        socket.on('revaluate',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            console.log(socket.handshake.session.key)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

            console.log(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Strings must use singlequote.
    Open

                while( i < labs.length && labs[i]["Lab_No"]!=rev.labname)i++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

    Examples of incorrect code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

    Examples of correct code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

    Examples of incorrect code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

    Examples of correct code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

    Examples of incorrect code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

    Examples of correct code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

    Examples of additional correct code for this rule with the "double", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

    Examples of additional correct code for this rule with the "single", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

    Examples of additional correct code for this rule with the "backtick", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

    Examples of additional correct code for this rule with the "double", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

    Examples of additional correct code for this rule with the "single", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Expected space(s) after "if".
    Open

                if(i> labs.length) continue;
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected var, use let or const instead.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Mixed spaces and tabs.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Mixed spaces and tabs.
    Open

                     {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Identifier 'score_string' is not in camel case.
    Open

                             score_string = score_string + id + ',' + newScores[i]['score'][id] + '\n';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

                             socket.emit('update_score',newScores[i]['labName'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    All 'var' declarations must be at the top of the function scope.
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected tab character.
    Open

                         }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                         {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Mixed spaces and tabs.
    Open

                     })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Unexpected tab character.
    Open

                if(i> labs.length) continue;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Infix operators must be spaced.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    All 'var' declarations must be at the top of the function scope.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Variable Declarations to be at the top of their scope (vars-on-top)

    The vars-on-top rule generates warnings when variable declarations are not used serially at the top of a function scope or the top of a program. By default variable declarations are always moved (“hoisted”) invisibly to the top of their containing scope by the JavaScript interpreter. This rule forces the programmer to represent that behaviour by manually moving the variable declaration to the top of its containing scope.

    Rule Details

    This rule aims to keep all variable declarations in the leading series of statements. Allowing multiple declarations helps promote maintainability and is thus allowed.

    Examples of incorrect code for this rule:

    /*eslint vars-on-top: "error"*/
    
    // Variable declarations in a block:
    function doSomething() {
        var first;
        if (true) {
            first = true;
        }
        var second;
    }
    
    // Variable declaration in for initializer:
    function doSomething() {
        for (var i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    // Variables after other statements:
    f();
    var a;

    Examples of correct code for this rule:

    /*eslint vars-on-top: "error"*/
    
    function doSomething() {
        var first;
        var second; //multiple declarations are allowed at the top
        if (true) {
            first = true;
        }
    }
    
    function doSomething() {
        var i;
        for (i=0; i<10; i++) {}
    }
    /*eslint vars-on-top: "error"*/
    
    var a;
    f();
    /*eslint vars-on-top: "error"*/
    
    // Directives may precede variable declarations.
    "use strict";
    var a;
    f();
    
    // Comments can describe variables.
    function doSomething() {
        // this is the first var.
        var first;
        // this is the second var.
        var second
    }

    Further Reading

    Unexpected tab character.
    Open

                    startDate: new Date(start_date),
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Extra space after key 'admin_key'.
    Open

                    admin_key : socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing between keys and values in object literal properties (key-spacing)

    This rule enforces spacing around the colon in object literal properties. It can verify each property individually, or it can ensure horizontal alignment of adjacent properties in an object literal.

    Rule Details

    This rule enforces consistent spacing between keys and values in object literal properties. In the case of long lines, it is acceptable to add a new line wherever whitespace is allowed.

    Options

    This rule has an object option:

    • "beforeColon": false (default) disallows spaces between the key and the colon in object literals.
    • "beforeColon": true requires at least one space between the key and the colon in object literals.
    • "afterColon": true (default) requires at least one space between the colon and the value in object literals.
    • "afterColon": false disallows spaces between the colon and the value in object literals.
    • "mode": "strict" (default) enforces exactly one space before or after colons in object literals.
    • "mode": "minimum" enforces one or more spaces before or after colons in object literals.
    • "align": "value" enforces horizontal alignment of values in object literals.
    • "align": "colon" enforces horizontal alignment of both colons and values in object literals.
    • "align" with an object value allows for fine-grained spacing when values are being aligned in object literals.
    • "singleLine" specifies a spacing style for single-line object literals.
    • "multiLine" specifies a spacing style for multi-line object literals.

    Please note that you can either use the top-level options or the grouped options (singleLine and multiLine) but not both.

    beforeColon

    Examples of incorrect code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo" : 42 };

    Examples of correct code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo" : 42 };

    afterColon

    Examples of incorrect code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo":42 };

    Examples of correct code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo":42 };

    mode

    Examples of incorrect code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat: 2 * 2
    });

    Examples of correct code for this rule with the { "mode": "minimum" } option:

    /*eslint key-spacing: ["error", { "mode": "minimum" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    align

    Examples of incorrect code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a: value,
        bcde:  42,
        fg :   foo()
    };

    Examples of correct code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a:    value,
        bcde: 42,
    
        fg: foo(),
        h:  function() {
            return this.a;
        },
        ijkl: 'Non-consecutive lines form a new group'
    };
    
    var obj = { a: "foo", longPropertyName: "bar" };

    Examples of incorrect code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat   : 2 * 2
    });

    align

    The align option can take additional configuration through the beforeColon, afterColon, mode, and on options.

    If align is defined as an object, but not all of the parameters are provided, undefined parameters will default to the following:

    // Defaults
    align: {
        "beforeColon": false,
        "afterColon": true,
        "on": "colon",
        "mode": "strict"
    }

    Examples of correct code for this rule with sample { "align": { } } options:

    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "one"   : 1,
        "seven" : 7
    }
    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": false,
            "afterColon": false,
            "on": "value"
        }
    }]*/
    
    var obj = {
        "one":  1,
        "seven":7
    }

    align and multiLine

    The multiLine and align options can differ, which allows for fine-tuned control over the key-spacing of your files. align will not inherit from multiLine if align is configured as an object.

    multiLine is used any time an object literal spans multiple lines. The align configuration is used when there is a group of properties in the same object. For example:

    var myObj = {
      key1: 1, // uses multiLine
    
      key2: 2, // uses align (when defined)
      key3: 3, // uses align (when defined)
    
      key4: 4 // uses multiLine
    }

    Examples of incorrect code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon":true
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
        },
        "one"             : 1,
        "seven"           : 7
    }

    Examples of correct code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon": true
    
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
            //
        }, // These are two separate groups, so no alignment between `myObjectFuction` and `one`
        "one"   : 1,
        "seven" : 7 // `one` and `seven` are in their own group, and therefore aligned
    }

    singleLine and multiLine

    Examples of correct code for this rule with sample { "singleLine": { }, "multiLine": { } } options:

    /*eslint "key-spacing": [2, {
        "singleLine": {
            "beforeColon": false,
            "afterColon": true
        },
        "multiLine": {
            "beforeColon": true,
            "afterColon": true,
            "align": "colon"
        }
    }]*/
    var obj = { one: 1, "two": 2, three: 3 };
    var obj2 = {
        "two" : 2,
        three : 3
    };

    When Not To Use It

    If you have another convention for property spacing that might not be consistent with the available options, or if you want to permit multiple styles concurrently you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected require().
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforce require() on the top-level module scope (global-require)

    In Node.js, module dependencies are included using the require() function, such as:

    var fs = require("fs");

    While require() may be called anywhere in code, some style guides prescribe that it should be called only in the top level of a module to make it easier to identify dependencies. For instance, it's arguably harder to identify dependencies when they are deeply nested inside of functions and other statements:

    function foo() {
    
        if (condition) {
            var fs = require("fs");
        }
    }

    Since require() does a synchronous load, it can cause performance problems when used in other locations.

    Further, ES6 modules mandate that import and export statements can only occur in the top level of the module's body.

    Rule Details

    This rule requires all calls to require() to be at the top level of the module, similar to ES6 import and export statements, which also can occur only at the top level.

    Examples of incorrect code for this rule:

    /*eslint global-require: "error"*/
    /*eslint-env es6*/
    
    // calling require() inside of a function is not allowed
    function readFile(filename, callback) {
        var fs = require('fs');
        fs.readFile(filename, callback)
    }
    
    // conditional requires like this are also not allowed
    if (DEBUG) { require('debug'); }
    
    // a require() in a switch statement is also flagged
    switch(x) { case '1': require('1'); break; }
    
    // you may not require() inside an arrow function body
    var getModule = (name) => require(name);
    
    // you may not require() inside of a function body as well
    function getModule(name) { return require(name); }
    
    // you may not require() inside of a try/catch block
    try {
        require(unsafeModule);
    } catch(e) {
        console.log(e);
    }

    Examples of correct code for this rule:

    /*eslint global-require: "error"*/
    
    // all these variations of require() are ok
    require('x');
    var y = require('y');
    var z;
    z = require('z').initialize();
    
    // requiring a module and using it in a function is ok
    var fs = require('fs');
    function readFile(filename, callback) {
        fs.readFile(filename, callback)
    }
    
    // you can use a ternary to determine which module to require
    var logger = DEBUG ? require('dev-logger') : require('logger');
    
    // if you want you can require() at the end of your module
    function doSomethingA() {}
    function doSomethingB() {}
    var x = require("x"),
        z = require("z");

    When Not To Use It

    If you have a module that must be initialized with information that comes from the file-system or if a module is only used in very rare situations and will cause significant overhead to load it may make sense to disable the rule. If you need to require() an optional dependency inside of a try/catch, you can disable this rule for just that dependency using the // eslint-disable-line global-require comment. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                             score_string = score_string + id + ',' + newScores[i]['score'][id] + '\n';
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing space before function parentheses.
    Open

                         write_to_file.write(score_string,function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    ["labName"] is better written in dot notation.
    Open

                             socket.emit('update_score',newScores[i]['labName'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Dot Notation (dot-notation)

    In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

    foo["bar"];

    Rule Details

    This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

    Examples of incorrect code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo["bar"];

    Examples of correct code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo.bar;
    
    var x = foo[bar];    // Property name is a variable, square-bracket notation required

    Options

    This rule accepts a single options argument:

    • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
    • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

    allowKeywords

    Examples of correct code for the { "allowKeywords": false } option:

    /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
    
    var foo = { "class": "CS 101" }
    var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

    allowPattern

    For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

    Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

    /*eslint camelcase: "error"*/
    /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
    
    var data = {};
    data.foo_bar = 42;
    
    var data = {};
    data["fooBar"] = 42;
    
    var data = {};
    data["foo_bar"] = 42; // no warning

    Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    endDate: new Date(end_date),
    Severity: Minor
    Found in main_server/admin.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

    More than 2 blank lines not allowed.
    Open

            
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow multiple empty lines (no-multiple-empty-lines)

    Some developers prefer to have multiple blank lines removed, while others feel that it helps improve readability. Whitespace is useful for separating logical sections of code, but excess whitespace takes up more of the screen.

    Rule Details

    This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of empty lines has been exceeded.

    Options

    This rule has an object option:

    • "max" (default: 2) enforces a maximum number of consecutive empty lines.
    • "maxEOF" enforces a maximum number of consecutive empty lines at the end of files.
    • "maxBOF" enforces a maximum number of consecutive empty lines at the beginning of files.

    max

    Examples of incorrect code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    
    var bar = 3;

    Examples of correct code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxEOF

    Examples of incorrect code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxBOF

    Examples of incorrect code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/
    
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1}]*/
    
    var foo = 5;
    
    
    var bar = 3;

    When Not To Use It

    If you do not care about extra blank lines, turn this off. Source: http://eslint.org/docs/rules/

    Trailing spaces not allowed.
    Open

            
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow trailing whitespace at the end of lines (no-trailing-spaces)

    Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before check-in.

    Rule Details

    This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines.

    Examples of incorrect code for this rule:

    /*eslint no-trailing-spaces: "error"*/
    
    var foo = 0;//•••••
    var baz = 5;//••
    //•••••

    Examples of correct code for this rule:

    /*eslint no-trailing-spaces: "error"*/
    
    var foo = 0;
    var baz = 5;

    Options

    This rule has an object option:

    • "skipBlankLines": false (default) disallows trailing whitespace on empty lines
    • "skipBlankLines": true allows trailing whitespace on empty lines

    skipBlankLines

    Examples of correct code for this rule with the { "skipBlankLines": true } option:

    /*eslint no-trailing-spaces: ["error", { "skipBlankLines": true }]*/
    
    var foo = 0;
    var baz = 5;
    //•••••

    Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                console.log(newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    ["labName"] is better written in dot notation.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Dot Notation (dot-notation)

    In JavaScript, one can access properties using the dot notation (foo.bar) or square-bracket notation (foo["bar"]). However, the dot notation is often preferred because it is easier to read, less verbose, and works better with aggressive JavaScript minimizers.

    foo["bar"];

    Rule Details

    This rule is aimed at maintaining code consistency and improving code readability by encouraging use of the dot notation style whenever possible. As such, it will warn when it encounters an unnecessary use of square-bracket notation.

    Examples of incorrect code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo["bar"];

    Examples of correct code for this rule:

    /*eslint dot-notation: "error"*/
    
    var x = foo.bar;
    
    var x = foo[bar];    // Property name is a variable, square-bracket notation required

    Options

    This rule accepts a single options argument:

    • Set the allowKeywords option to false (default is true) to follow ECMAScript version 3 compatible style, avoiding dot notation for reserved word properties.
    • Set the allowPattern option to a regular expression string to allow bracket notation for property names that match a pattern (by default, no pattern is tested).

    allowKeywords

    Examples of correct code for the { "allowKeywords": false } option:

    /*eslint dot-notation: ["error", { "allowKeywords": false }]*/
    
    var foo = { "class": "CS 101" }
    var x = foo["class"]; // Property name is a reserved word, square-bracket notation required

    allowPattern

    For example, when preparing data to be sent to an external API, it is often required to use property names that include underscores. If the camelcase rule is in effect, these snake case properties would not be allowed. By providing an allowPattern to the dot-notation rule, these snake case properties can be accessed with bracket notation.

    Examples of correct code for the sample { "allowPattern": "^[a-z]+(_[a-z]+)+$" } option:

    /*eslint camelcase: "error"*/
    /*eslint dot-notation: ["error", { "allowPattern": "^[a-z]+(_[a-z]+)+$" }]*/
    
    var data = {};
    data.foo_bar = 42;
    
    var data = {};
    data["fooBar"] = 42;
    
    var data = {};
    data["foo_bar"] = 42; // no warning

    Source: http://eslint.org/docs/rules/

    Unexpected unnamed function.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Unexpected tab character.
    Open

                         var score_string ="";
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                         {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Mixed spaces and tabs.
    Open

                             socket.emit('update_score',newScores[i]['labName'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Missing semicolon.
    Open

                         })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                lab_revaluation.push({
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Trailing spaces not allowed.
    Open

            
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow trailing whitespace at the end of lines (no-trailing-spaces)

    Sometimes in the course of editing files, you can end up with extra whitespace at the end of lines. These whitespace differences can be picked up by source control systems and flagged as diffs, causing frustration for developers. While this extra whitespace causes no functional issues, many code conventions require that trailing spaces be removed before check-in.

    Rule Details

    This rule disallows trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines.

    Examples of incorrect code for this rule:

    /*eslint no-trailing-spaces: "error"*/
    
    var foo = 0;//•••••
    var baz = 5;//••
    //•••••

    Examples of correct code for this rule:

    /*eslint no-trailing-spaces: "error"*/
    
    var foo = 0;
    var baz = 5;

    Options

    This rule has an object option:

    • "skipBlankLines": false (default) disallows trailing whitespace on empty lines
    • "skipBlankLines": true allows trailing whitespace on empty lines

    skipBlankLines

    Examples of correct code for this rule with the { "skipBlankLines": true } option:

    /*eslint no-trailing-spaces: ["error", { "skipBlankLines": true }]*/
    
    var foo = 0;
    var baz = 5;
    //•••••

    Source: http://eslint.org/docs/rules/

    Unexpected string concatenation.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    Mixed spaces and tabs.
    Open

                         var score_string ="";
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Strings must use singlequote.
    Open

                         var score_string ="";
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

    Examples of incorrect code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

    Examples of correct code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

    Examples of incorrect code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

    Examples of correct code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

    Examples of incorrect code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

    Examples of correct code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

    Examples of additional correct code for this rule with the "double", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

    Examples of additional correct code for this rule with the "single", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

    Examples of additional correct code for this rule with the "backtick", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

    Examples of additional correct code for this rule with the "double", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

    Examples of additional correct code for this rule with the "single", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Mixed spaces and tabs.
    Open

                         for(var id in newScores[i]['score'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Mixed spaces and tabs.
    Open

                         {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Unexpected unnamed function.
    Open

                         write_to_file.write(score_string,function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                if(i> labs.length) continue;
    Severity: Minor
    Found in main_server/admin.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

    Infix operators must be spaced.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.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

    A space is required after ','.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                     {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected tab character.
    Open

                             socket.emit('update_score',newScores[i]['labName'])
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected var, use let or const instead.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Unexpected var, use let or const instead.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                lab_revaluation.push({
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                    endDate: new Date(end_date),
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Identifier 'write_to_file' is not in camel case.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Missing space before value for key 'flags'.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing between keys and values in object literal properties (key-spacing)

    This rule enforces spacing around the colon in object literal properties. It can verify each property individually, or it can ensure horizontal alignment of adjacent properties in an object literal.

    Rule Details

    This rule enforces consistent spacing between keys and values in object literal properties. In the case of long lines, it is acceptable to add a new line wherever whitespace is allowed.

    Options

    This rule has an object option:

    • "beforeColon": false (default) disallows spaces between the key and the colon in object literals.
    • "beforeColon": true requires at least one space between the key and the colon in object literals.
    • "afterColon": true (default) requires at least one space between the colon and the value in object literals.
    • "afterColon": false disallows spaces between the colon and the value in object literals.
    • "mode": "strict" (default) enforces exactly one space before or after colons in object literals.
    • "mode": "minimum" enforces one or more spaces before or after colons in object literals.
    • "align": "value" enforces horizontal alignment of values in object literals.
    • "align": "colon" enforces horizontal alignment of both colons and values in object literals.
    • "align" with an object value allows for fine-grained spacing when values are being aligned in object literals.
    • "singleLine" specifies a spacing style for single-line object literals.
    • "multiLine" specifies a spacing style for multi-line object literals.

    Please note that you can either use the top-level options or the grouped options (singleLine and multiLine) but not both.

    beforeColon

    Examples of incorrect code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo" : 42 };

    Examples of correct code for this rule with the default { "beforeColon": false } option:

    /*eslint key-spacing: ["error", { "beforeColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "beforeColon": true } option:

    /*eslint key-spacing: ["error", { "beforeColon": true }]*/
    
    var obj = { "foo" : 42 };

    afterColon

    Examples of incorrect code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo":42 };

    Examples of correct code for this rule with the default { "afterColon": true } option:

    /*eslint key-spacing: ["error", { "afterColon": true }]*/
    
    var obj = { "foo": 42 };

    Examples of incorrect code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo": 42 };

    Examples of correct code for this rule with the { "afterColon": false } option:

    /*eslint key-spacing: ["error", { "afterColon": false }]*/
    
    var obj = { "foo":42 };

    mode

    Examples of incorrect code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the default { "mode": "strict" } option:

    /*eslint key-spacing: ["error", { "mode": "strict" }]*/
    
    call({
        foobar: 42,
        bat: 2 * 2
    });

    Examples of correct code for this rule with the { "mode": "minimum" } option:

    /*eslint key-spacing: ["error", { "mode": "minimum" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    align

    Examples of incorrect code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a: value,
        bcde:  42,
        fg :   foo()
    };

    Examples of correct code for this rule with the { "align": "value" } option:

    /*eslint key-spacing: ["error", { "align": "value" }]*/
    
    var obj = {
        a:    value,
        bcde: 42,
    
        fg: foo(),
        h:  function() {
            return this.a;
        },
        ijkl: 'Non-consecutive lines form a new group'
    };
    
    var obj = { a: "foo", longPropertyName: "bar" };

    Examples of incorrect code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat:    2 * 2
    });

    Examples of correct code for this rule with the { "align": "colon" } option:

    /*eslint key-spacing: ["error", { "align": "colon" }]*/
    
    call({
        foobar: 42,
        bat   : 2 * 2
    });

    align

    The align option can take additional configuration through the beforeColon, afterColon, mode, and on options.

    If align is defined as an object, but not all of the parameters are provided, undefined parameters will default to the following:

    // Defaults
    align: {
        "beforeColon": false,
        "afterColon": true,
        "on": "colon",
        "mode": "strict"
    }

    Examples of correct code for this rule with sample { "align": { } } options:

    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "one"   : 1,
        "seven" : 7
    }
    /*eslint key-spacing: ["error", {
        "align": {
            "beforeColon": false,
            "afterColon": false,
            "on": "value"
        }
    }]*/
    
    var obj = {
        "one":  1,
        "seven":7
    }

    align and multiLine

    The multiLine and align options can differ, which allows for fine-tuned control over the key-spacing of your files. align will not inherit from multiLine if align is configured as an object.

    multiLine is used any time an object literal spans multiple lines. The align configuration is used when there is a group of properties in the same object. For example:

    var myObj = {
      key1: 1, // uses multiLine
    
      key2: 2, // uses align (when defined)
      key3: 3, // uses align (when defined)
    
      key4: 4 // uses multiLine
    }

    Examples of incorrect code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon":true
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
        },
        "one"             : 1,
        "seven"           : 7
    }

    Examples of correct code for this rule with sample { "align": { }, "multiLine": { } } options:

    /*eslint key-spacing: ["error", {
        "multiLine": {
            "beforeColon": false,
            "afterColon": true
    
        },
        "align": {
            "beforeColon": true,
            "afterColon": true,
            "on": "colon"
        }
    }]*/
    
    var obj = {
        "myObjectFunction": function() {
            // Do something
            //
        }, // These are two separate groups, so no alignment between `myObjectFuction` and `one`
        "one"   : 1,
        "seven" : 7 // `one` and `seven` are in their own group, and therefore aligned
    }

    singleLine and multiLine

    Examples of correct code for this rule with sample { "singleLine": { }, "multiLine": { } } options:

    /*eslint "key-spacing": [2, {
        "singleLine": {
            "beforeColon": false,
            "afterColon": true
        },
        "multiLine": {
            "beforeColon": true,
            "afterColon": true,
            "align": "colon"
        }
    }]*/
    var obj = { one: 1, "two": 2, three: 3 };
    var obj2 = {
        "two" : 2,
        three : 3
    };

    When Not To Use It

    If you have another convention for property spacing that might not be consistent with the available options, or if you want to permit multiple styles concurrently you can safely disable this rule. Source: http://eslint.org/docs/rules/

    A space is required before '}'.
    Open

                     var write_to_file = fs.createWriteStream(path.join(__dirname,'/reval/',newScores[i]['labName']+'_reval_score.csv'),{flags:'w'});
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing inside braces (object-curly-spacing)

    While formatting preferences are very personal, a number of style guides require or disallow spaces between curly braces in the following situations:

    // simple object literals
    var obj = { foo: "bar" };
    
    // nested object literals
    var obj = { foo: { zoo: "bar" } };
    
    // destructuring assignment (EcmaScript 6)
    var { x, y } = y;
    
    // import/export declarations (EcmaScript 6)
    import { foo } from "bar";
    export { foo };

    Rule Details

    This rule enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "never" (default) disallows spacing inside of braces
    • "always" requires spacing inside of braces (except {})

    Object option:

    • "arraysInObjects": true requires spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to never)
    • "arraysInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an array element (applies when the first option is set to always)
    • "objectsInObjects": true requires spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to never)
    • "objectsInObjects": false disallows spacing inside of braces of objects beginning and/or ending with an object element (applies when the first option is set to always)

    never

    Examples of incorrect code for this rule with the default "never" option:

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = { 'foo': 'bar' };
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux'}, bar};
    var {x } = y;
    import { foo } from 'bar';

    Examples of correct code for this rule with the default "never" option:

    /*eslint object-curly-spacing: ["error", "never"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': {'bar': 'baz'}, 'qux': 'quxx'};
    var obj = {
      'foo': 'bar'
    };
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var obj = {};
    var {x} = y;
    import {foo} from 'bar';

    always

    Examples of incorrect code for this rule with the "always" option:

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {'foo': 'bar'};
    var obj = {'foo': 'bar' };
    var obj = { baz: {'foo': 'qux'}, bar};
    var obj = {baz: { 'foo': 'qux' }, bar};
    var obj = {'foo': 'bar'
    };
    var obj = {
      'foo':'bar'};
    var {x} = y;
    import {foo } from 'bar';

    Examples of correct code for this rule with the "always" option:

    /*eslint object-curly-spacing: ["error", "always"]*/
    
    var obj = {};
    var obj = { 'foo': 'bar' };
    var obj = { 'foo': { 'bar': 'baz' }, 'qux': 'quxx' };
    var obj = {
      'foo': 'bar'
    };
    var { x } = y;
    import { foo } from 'bar';

    arraysInObjects

    Examples of additional correct code for this rule with the "never", { "arraysInObjects": true } options:

    /*eslint object-curly-spacing: ["error", "never", { "arraysInObjects": true }]*/
    
    var obj = {"foo": [ 1, 2 ] };
    var obj = {"foo": [ "baz", "bar" ] };

    Examples of additional correct code for this rule with the "always", { "arraysInObjects": false } options:

    /*eslint object-curly-spacing: ["error", "always", { "arraysInObjects": false }]*/
    
    var obj = { "foo": [ 1, 2 ]};
    var obj = { "foo": [ "baz", "bar" ]};

    objectsInObjects

    Examples of additional correct code for this rule with the "never", { "objectsInObjects": true } options:

    /*eslint object-curly-spacing: ["error", "never", { "objectsInObjects": true }]*/
    
    var obj = {"foo": {"baz": 1, "bar": 2} };

    Examples of additional correct code for this rule with the "always", { "objectsInObjects": false } options:

    /*eslint object-curly-spacing: ["error", "always", { "objectsInObjects": false }]*/
    
    var obj = { "foo": { "baz": 1, "bar": 2 }};

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing between curly braces.

    Related Rules

    Mixed spaces and tabs.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Identifier 'end_date' is not in camel case.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Camelcase (camelcase)

    When it comes to naming variables, style guides generally fall into one of two camps: camelcase (variableName) and underscores (variable_name). This rule focuses on using the camelcase approach. If your style guide calls for camelcasing your variable names, then this rule is for you!

    Rule Details

    This rule looks for any underscores (_) located within the source code. It ignores leading and trailing underscores and only checks those in the middle of a variable name. If ESLint decides that the variable is a constant (all uppercase), then no warning will be thrown. Otherwise, a warning will be thrown. This rule only flags definitions and assignments but not function calls. In case of ES6 import statements, this rule only targets the name of the variable that will be imported into the local module scope.

    Options

    This rule has an object option:

    • "properties": "always" (default) enforces camelcase style for property names
    • "properties": "never" does not check property names

    always

    Examples of incorrect code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased } from "external-module"
    
    var my_favorite_color = "#112C85";
    
    function do_something() {
        // ...
    }
    
    obj.do_something = function() {
        // ...
    };
    
    var obj = {
        my_pref: 1
    };

    Examples of correct code for this rule with the default { "properties": "always" } option:

    /*eslint camelcase: "error"*/
    
    import { no_camelcased as camelCased } from "external-module";
    
    var myFavoriteColor   = "#112C85";
    var _myFavoriteColor  = "#112C85";
    var myFavoriteColor_  = "#112C85";
    var MY_FAVORITE_COLOR = "#112C85";
    var foo = bar.baz_boom;
    var foo = { qux: bar.baz_boom };
    
    obj.do_something();
    do_something();
    new do_something();
    
    var { category_id: category } = query;

    never

    Examples of correct code for this rule with the { "properties": "never" } option:

    /*eslint camelcase: ["error", {properties: "never"}]*/
    
    var obj = {
        my_pref: 1
    };

    When Not To Use It

    If you have established coding standards using a different naming convention (separating words with underscores), turn this rule off. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    lab:data[rev].labname,
    Severity: Minor
    Found in main_server/admin.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

    Missing semicolon.
    Open

                })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            require('./reval/reval.js')(lab_revaluation,function(err,newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.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

    Missing space before function parentheses.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Unexpected tab character.
    Open

                     {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected string concatenation.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    Infix operators must be spaced.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Expected space(s) after "for".
    Open

                for(var i in newScores)
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected function expression.
    Open

                     write_to_file.on('open',function(file)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 1 tab.
    Open

        function checkLab(lab)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected function expression.
    Open

            var handle = setInterval(function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Expected indentation of 0 spaces but found 5 tabs.
    Open

                        }
    Severity: Minor
    Found in main_server/admin.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

    Unexpected unnamed function.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Unexpected unnamed function.
    Open

        socket.on('logout',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Unexpected tab character.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected unnamed function.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Unexpected tab character.
    Open

                    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                        time++;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Block must not be padded by blank lines.
    Open

            },1000);
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Block must not be padded by blank lines.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    More than 2 blank lines not allowed.
    Open

    
    
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow multiple empty lines (no-multiple-empty-lines)

    Some developers prefer to have multiple blank lines removed, while others feel that it helps improve readability. Whitespace is useful for separating logical sections of code, but excess whitespace takes up more of the screen.

    Rule Details

    This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of empty lines has been exceeded.

    Options

    This rule has an object option:

    • "max" (default: 2) enforces a maximum number of consecutive empty lines.
    • "maxEOF" enforces a maximum number of consecutive empty lines at the end of files.
    • "maxBOF" enforces a maximum number of consecutive empty lines at the beginning of files.

    max

    Examples of incorrect code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    
    var bar = 3;

    Examples of correct code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxEOF

    Examples of incorrect code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxBOF

    Examples of incorrect code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/
    
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1}]*/
    
    var foo = 5;
    
    
    var bar = 3;

    When Not To Use It

    If you do not care about extra blank lines, turn this off. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            socket.emit('logged out');
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 0 spaces but found 1 tab.
    Open

        })
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

        // to download the file can be sent to the admin on the portal.
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 0 spaces but found 3 tabs.
    Open

                })
    Severity: Minor
    Found in main_server/admin.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

    Missing space before function parentheses.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                     {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected tab character.
    Open

                         console.log(error);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

                        console.log(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    A space is required after ','.
    Open

                        socket.emit('update_score',lab);
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Block must not be padded by blank lines.
    Open

    }
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Unexpected function expression.
    Open

                     write_to_file.on('error',function(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Mixed spaces and tabs.
    Open

                     })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            var handle = setInterval(function()
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected tab character.
    Open

                            clearInterval(handle);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Closing curly brace does not appear on the same line as the subsequent block.
    Open

                    }
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected tab character.
    Open

                })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 0 spaces but found 2 tabs.
    Open

            })
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 2 tabs.
    Open

            delete socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.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

    Opening curly brace does not appear on the same line as controlling statement.
    Open

                    {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Unexpected tab character.
    Open

                        clearInterval(handle);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                    }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Mixed spaces and tabs.
    Open

                         console.log(error);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Unexpected tab character.
    Open

            delete socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    More than 2 blank lines not allowed.
    Open

    
    
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow multiple empty lines (no-multiple-empty-lines)

    Some developers prefer to have multiple blank lines removed, while others feel that it helps improve readability. Whitespace is useful for separating logical sections of code, but excess whitespace takes up more of the screen.

    Rule Details

    This rule aims to reduce the scrolling required when reading through your code. It will warn when the maximum amount of empty lines has been exceeded.

    Options

    This rule has an object option:

    • "max" (default: 2) enforces a maximum number of consecutive empty lines.
    • "maxEOF" enforces a maximum number of consecutive empty lines at the end of files.
    • "maxBOF" enforces a maximum number of consecutive empty lines at the beginning of files.

    max

    Examples of incorrect code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    
    var bar = 3;

    Examples of correct code for this rule with the default { "max": 2 } option:

    /*eslint no-multiple-empty-lines: "error"*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxEOF

    Examples of incorrect code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxEOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxEOF": 1 }]*/
    
    var foo = 5;
    
    
    var bar = 3;

    maxBOF

    Examples of incorrect code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1 }]*/
    
    
    var foo = 5;
    
    
    var bar = 3;

    Examples of correct code for this rule with the { max: 2, maxBOF: 1 } options:

    /*eslint no-multiple-empty-lines: ["error", { "max": 2, "maxBOF": 1}]*/
    
    var foo = 5;
    
    
    var bar = 3;

    When Not To Use It

    If you do not care about extra blank lines, turn this off. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 5 tabs.
    Open

                        console.log(err)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                     })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 0 spaces but found 3 tabs.
    Open

                }
    Severity: Minor
    Found in main_server/admin.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

    Missing semicolon.
    Open

            })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

            delete socket.handshake.session.key
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        function checkLab(lab)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    A space is required after ','.
    Open

        socket.on('logout',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            var time =0;
    Severity: Minor
    Found in main_server/admin.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

    Missing space before function parentheses.
    Open

            var handle = setInterval(function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Infix operators must be spaced.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                    if(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    A space is required after ','.
    Open

                            socket.emit('update_score_timeout',lab);
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 3 tabs.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected string concatenation.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using template literals instead of string concatenation. (prefer-template)

    In ES2015 (ES6), we can use template literals instead of string concatenation.

    var str = "Hello, " + name + "!";
    /*eslint-env es6*/
    
    var str = `Hello, ${name}!`;

    Rule Details

    This rule is aimed to flag usage of + operators with strings.

    Examples

    Examples of incorrect code for this rule:

    /*eslint prefer-template: "error"*/
    
    var str = "Hello, " + name + "!";
    var str = "Time: " + (12 * 60 * 60 * 1000);

    Examples of correct code for this rule:

    /*eslint prefer-template: "error"*/
    /*eslint-env es6*/
    
    var str = "Hello World!";
    var str = `Hello, ${name}!`;
    var str = `Time: ${12 * 60 * 60 * 1000}`;
    
    // This is reported by `no-useless-concat`.
    var str = "Hello, " + "World!";

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about string concatenation, you can safely disable this rule.

    Related Rules

    Strings must use singlequote.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce the consistent use of either backticks, double, or single quotes (quotes)

    JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:

    /*eslint-env es6*/
    
    var double = "double";
    var single = 'single';
    var backtick = `backtick`;    // ES6 only

    Each of these lines creates a string and, in some cases, can be used interchangeably. The choice of how to define strings in a codebase is a stylistic one outside of template literals (which allow embedded of expressions to be interpreted).

    Many codebases require strings to be defined in a consistent manner.

    Rule Details

    This rule enforces the consistent use of either backticks, double, or single quotes.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "double" (default) requires the use of double quotes wherever possible
    • "single" requires the use of single quotes wherever possible
    • "backtick" requires the use of backticks wherever possible

    Object option:

    • "avoidEscape": true allows strings to use single-quotes or double-quotes so long as the string contains a quote that would have to be escaped otherwise
    • "allowTemplateLiterals": true allows strings to use backticks

    Deprecated: The object property avoid-escape is deprecated; please use the object property avoidEscape instead.

    double

    Examples of incorrect code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    
    var single = 'single';
    var unescaped = 'a string containing "double" quotes';

    Examples of correct code for this rule with the default "double" option:

    /*eslint quotes: ["error", "double"]*/
    /*eslint-env es6*/
    
    var double = "double";
    var backtick = `back\ntick`;  // backticks are allowed due to newline
    var backtick = tag`backtick`; // backticks are allowed due to tag

    single

    Examples of incorrect code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    
    var double = "double";
    var unescaped = "a string containing 'single' quotes";

    Examples of correct code for this rule with the "single" option:

    /*eslint quotes: ["error", "single"]*/
    /*eslint-env es6*/
    
    var single = 'single';
    var backtick = `back${x}tick`; // backticks are allowed due to substitution

    backticks

    Examples of incorrect code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    
    var single = 'single';
    var double = "double";
    var unescaped = 'a string containing `backticks`';

    Examples of correct code for this rule with the "backtick" option:

    /*eslint quotes: ["error", "backtick"]*/
    /*eslint-env es6*/
    
    var backtick = `backtick`;

    avoidEscape

    Examples of additional correct code for this rule with the "double", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
    
    var single = 'a string containing "double" quotes';

    Examples of additional correct code for this rule with the "single", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "single", { "avoidEscape": true }]*/
    
    var double = "a string containing 'single' quotes";

    Examples of additional correct code for this rule with the "backtick", { "avoidEscape": true } options:

    /*eslint quotes: ["error", "backtick", { "avoidEscape": true }]*/
    
    var double = "a string containing `backtick` quotes"

    allowTemplateLiterals

    Examples of additional correct code for this rule with the "double", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "double", { "allowTemplateLiterals": true }]*/
    
    var double = "double";
    var double = `double`;

    Examples of additional correct code for this rule with the "single", { "allowTemplateLiterals": true } options:

    /*eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/
    
    var single = 'single';
    var single = `single`;

    When Not To Use It

    If you do not need consistency in your string styles, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 5 tabs.
    Open

                        time++;
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 6 tabs.
    Open

                            socket.emit('update_score_timeout',lab);
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                    else
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 5 tabs.
    Open

                        clearInterval(handle);
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                     {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected unnamed function.
    Open

            var handle = setInterval(function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow named function expressions (func-names)

    A pattern that's becoming more common is to give function expressions names to aid in debugging. For example:

    Foo.prototype.bar = function bar() {};

    Adding the second bar in the above example is optional. If you leave off the function name then when the function throws an exception you are likely to get something similar to anonymous function in the stack trace. If you provide the optional name for a function expression then you will get the name of the function expression in the stack trace.

    Rule Details

    This rule can enforce or disallow the use of named function expressions.

    Options

    This rule has a string option:

    • "always" (default) requires function expressions to have a name
    • "as-needed" requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
    • "never" disallows named function expressions, except in recursive functions, where a name is needed

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "always" option:

    /*eslint func-names: ["error", "always"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    as-needed

    ECMAScript 6 introduced a name property on all functions. The value of name is determined by evaluating the code around the function to see if a name can be inferred. For example, a function assigned to a variable will automatically have a name property equal to the name of the variable. The value of name is then used in stack traces for easier debugging.

    Examples of incorrect code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Examples of correct code for this rule with the default "as-needed" option:

    /*eslint func-names: ["error", "as-needed"]*/
    
    var bar = function() {};
    
    (function bar() {
        // ...
    }())

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function bar() {};
    
    (function bar() {
        // ...
    }())

    Examples of correct code for this rule with the "never" option:

    /*eslint func-names: ["error", "never"]*/
    
    Foo.prototype.bar = function() {};
    
    (function() {
        // ...
    }())

    Further Reading

    Compatibility

    Missing space before function parentheses.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Expected indentation of 0 spaces but found 2 tabs.
    Open

            },1000);
    Severity: Minor
    Found in main_server/admin.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

    Block must not be padded by blank lines.
    Open

                }
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Expected indentation of 0 spaces but found 1 tab.
    Open

        })
    Severity: Minor
    Found in main_server/admin.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

    Unexpected var, use let or const instead.
    Open

            var handle = setInterval(function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    A space is required after ','.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected space(s) after "if".
    Open

                        if(time > 30)
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    else
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                        socket.emit('update_score',lab);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

    }
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Missing semicolon.
    Open

                     })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Opening curly brace does not appear on the same line as controlling statement.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Missing semicolon.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        // Continuously check the reval directory to check if the end file exists for 30 seconds, after which a link
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                        console.log(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 2 spaces but found 5 tabs.
    Open

                        socket.emit('update_score',lab);
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

            },1000);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    A space is required after ','.
    Open

            },1000);
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

        }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Opening curly brace does not appear on the same line as controlling statement.
    Open

        {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Mixed spaces and tabs.
    Open

                     {
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow mixed spaces and tabs for indentation (no-mixed-spaces-and-tabs)

    Most code conventions require either tabs or spaces be used for indentation. As such, it's usually an error if a single line of code is indented with both tabs and spaces.

    Rule Details

    This rule disallows mixed spaces and tabs for indentation.

    Examples of incorrect code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->..return x + y;
    
          return x + y;
    }
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Examples of correct code for this rule:

    /*eslint no-mixed-spaces-and-tabs: "error"*/
    
    function add(x, y) {
    // --->return x + y;
        return x + y;
    }

    Options

    This rule has a string option.

    • "smart-tabs" allows mixed spaces and tabs when the latter are used for alignment.

    smart-tabs

    Examples of correct code for this rule with the "smart-tabs" option:

    /*eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
    
    function main() {
    // --->var x = 5,
    // --->....y = 7;
    
        var x = 5,
            y = 7;
    }

    Further Reading

    Unexpected tab character.
    Open

            var handle = setInterval(function()
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

        socket.on('logout',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Opening curly brace does not appear on the same line as controlling statement.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require Brace Style (brace-style)

    Brace style is closely related to indent style in programming and describes the placement of braces relative to their control statement and body. There are probably a dozen, if not more, brace styles in the world.

    The one true brace style is one of the most common brace styles in JavaScript, in which the opening brace of a block is placed on the same line as its corresponding statement or declaration. For example:

    if (foo) {
      bar();
    } else {
      baz();
    }

    One common variant of one true brace style is called Stroustrup, in which the else statements in an if-else construct, as well as catch and finally, must be on its own line after the preceding closing brace. For example:

    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Another style is called Allman, in which all the braces are expected to be on their own lines without any extra indentation. For example:

    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }

    While no style is considered better than the other, most developers agree that having a consistent style throughout a project is important for its long-term maintainability.

    Rule Details

    This rule enforces consistent brace style for blocks.

    Options

    This rule has a string option:

    • "1tbs" (default) enforces one true brace style
    • "stroustrup" enforces Stroustrup style
    • "allman" enforces Allman style

    This rule has an object option for an exception:

    • "allowSingleLine": true (default false) allows the opening and closing braces for a block to be on the same line

    1tbs

    Examples of incorrect code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }

    Examples of correct code for this rule with the default "1tbs" option:

    /*eslint brace-style: "error"*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }
    
    try {
      somethingRisky();
    } catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "1tbs", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "1tbs", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); } else { baz(); }
    
    try { somethingRisky(); } catch(e) { handleError(); }

    stroustrup

    Examples of incorrect code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "stroustrup" option:

    /*eslint brace-style: ["error", "stroustrup"]*/
    
    function foo() {
      return true;
    }
    
    if (foo) {
      bar();
    }
    
    if (foo) {
      bar();
    }
    else {
      baz();
    }
    
    try {
      somethingRisky();
    }
    catch(e) {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "stroustrup", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "stroustrup", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    allman

    Examples of incorrect code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo() {
      return true;
    }
    
    if (foo)
    {
      bar(); }
    
    try
    {
      somethingRisky();
    } catch(e)
    {
      handleError();
    }
    
    if (foo) {
      bar();
    } else {
      baz();
    }

    Examples of correct code for this rule with the "allman" option:

    /*eslint brace-style: ["error", "allman"]*/
    
    function foo()
    {
      return true;
    }
    
    if (foo)
    {
      bar();
    }
    
    if (foo)
    {
      bar();
    }
    else
    {
      baz();
    }
    
    try
    {
      somethingRisky();
    }
    catch(e)
    {
      handleError();
    }
    
    // when there are no braces, there are no problems
    if (foo) bar();
    else if (baz) boom();

    Examples of correct code for this rule with the "allman", { "allowSingleLine": true } options:

    /*eslint brace-style: ["error", "allman", { "allowSingleLine": true }]*/
    
    function nop() { return; }
    
    if (foo) { bar(); }
    
    if (foo) { bar(); }
    else { baz(); }
    
    try { somethingRisky(); }
    catch(e) { handleError(); }

    When Not To Use It

    If you don't want to enforce a particular brace style, don't enable this rule.

    Further Reading

    Missing space before function parentheses.
    Open

        socket.on('logout',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Require or disallow a space before function parenthesis (space-before-function-paren)

    When formatting a function, whitespace is allowed between the function name or function keyword and the opening paren. Named functions also require a space between the function keyword and the function name, but anonymous functions require no whitespace. For example:

    function withoutSpace(x) {
        // ...
    }
    
    function withSpace (x) {
        // ...
    }
    
    var anonymousWithoutSpace = function() {};
    
    var anonymousWithSpace = function () {};

    Style guides may require a space after the function keyword for anonymous functions, while others specify no whitespace. Similarly, the space after a function name may or may not be required.

    Rule Details

    This rule aims to enforce consistent spacing before function parentheses and as such, will warn whenever whitespace doesn't match the preferences specified.

    Options

    This rule has a string option or an object option:

    {
        "space-before-function-paren": ["error", "always"],
        // or
        "space-before-function-paren": ["error", {
            "anonymous": "always",
            "named": "always",
            "asyncArrow": "ignore"
        }],
    }
    • always (default) requires a space followed by the ( of arguments.
    • never disallows any space followed by the ( of arguments.

    The string option does not check async arrow function expressions for backward compatibility.

    You can also use a separate option for each type of function. Each of the following options can be set to "always", "never", or "ignore". Default is "always" basically.

    • anonymous is for anonymous function expressions (e.g. function () {}).
    • named is for named function expressions (e.g. function foo () {}).
    • asyncArrow is for async arrow function expressions (e.g. async () => {}). asyncArrow is set to "ignore" by default for backwards compatibility.

    "always"

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the default "always" option:

    /*eslint space-before-function-paren: "error"*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    "never"

    Examples of incorrect code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    var bar = function foo () {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint space-before-function-paren: ["error", "never"]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    var bar = function foo() {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    // async arrow function expressions are ignored by default.
    var foo = async () => 1
    var foo = async() => 1

    {"anonymous": "always", "named": "never", "asyncArrow": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };
    
    var foo = async(a) => await a

    Examples of correct code for this rule with the {"anonymous": "always", "named": "never", "asyncArrow": "always"} option:

    /*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };
    
    var foo = async (a) => await a

    {"anonymous": "never", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    var bar = function () {
        // ...
    };
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "never", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "never", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo () {
        // ...
    }
    
    var bar = function() {
        // ...
    };
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    {"anonymous": "ignore", "named": "always"}

    Examples of incorrect code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    function foo() {
        // ...
    }
    
    class Foo {
        constructor() {
            // ...
        }
    }
    
    var foo = {
        bar() {
            // ...
        }
    };

    Examples of correct code for this rule with the {"anonymous": "ignore", "named": "always"} option:

    /*eslint space-before-function-paren: ["error", { "anonymous": "ignore", "named": "always" }]*/
    /*eslint-env es6*/
    
    var bar = function() {
        // ...
    };
    
    var bar = function () {
        // ...
    };
    
    function foo () {
        // ...
    }
    
    class Foo {
        constructor () {
            // ...
        }
    }
    
    var foo = {
        bar () {
            // ...
        }
    };

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of spacing before function parenthesis.

    Related Rules

    Block must not be padded by blank lines.
    Open

            {
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow padding within blocks (padded-blocks)

    Some style guides require block statements to start and end with blank lines. The goal is to improve readability by visually separating the block content and the surrounding code.

    if (a) {
    
        b();
    
    }

    Since it's good to have a consistent code style, you should either always write padded blocks or never do it.

    Rule Details

    This rule enforces consistent empty line padding within blocks.

    Options

    This rule has one option, which can be a string option or an object option.

    String option:

    • "always" (default) requires empty lines at the beginning and ending of block statements (except switch statements and classes)
    • "never" disallows empty lines at the beginning and ending of block statements (except switch statements and classes)

    Object option:

    • "blocks" require or disallow padding within block statements
    • "classes" require or disallow padding within classes
    • "switches" require or disallow padding within switch statements

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint padded-blocks: ["error", "always"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the "never" option:

    /*eslint padded-blocks: ["error", "never"]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    blocks

    Examples of incorrect code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
        b();
    }
    
    if (a) { b(); }
    
    if (a)
    {
        b();
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }
    
    if (a) {
        // comment
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "always" } option:

    /*eslint padded-blocks: ["error", { "blocks": "always" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        // comment
        b();
    
    }

    Examples of incorrect code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
    
        b();
    
    }
    
    if (a)
    {
    
        b();
    
    }
    
    if (a) {
    
        b();
    }
    
    if (a) {
        b();
    
    }

    Examples of correct code for this rule with the { "blocks": "never" } option:

    /*eslint padded-blocks: ["error", { "blocks": "never" }]*/
    
    if (a) {
        b();
    }
    
    if (a)
    {
        b();
    }

    classes

    Examples of incorrect code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
        constructor(){
        }
    }

    Examples of correct code for this rule with the { "classes": "always" } option:

    /*eslint padded-blocks: ["error", { "classes": "always" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of incorrect code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
    
        constructor(){
        }
    
    }

    Examples of correct code for this rule with the { "classes": "never" } option:

    /*eslint padded-blocks: ["error", { "classes": "never" }]*/
    
    class  A {
        constructor(){
        }
    }

    switches

    Examples of incorrect code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
        case 0: foo();
    }

    Examples of correct code for this rule with the { "switches": "always" } option:

    /*eslint padded-blocks: ["error", { "switches": "always" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }
    
    if (a) {
        b();
    }

    Examples of incorrect code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
    
        case 0: foo();
    
    }

    Examples of correct code for this rule with the { "switches": "never" } option:

    /*eslint padded-blocks: ["error", { "switches": "never" }]*/
    
    switch (a) {
        case 0: foo();
    }
    
    if (a) {
    
        b();
    
    }

    When Not To Use It

    You can turn this rule off if you are not concerned with the consistency of padding within blocks. Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

            var time =0;
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected space(s) after "if".
    Open

                    if(err)
    Severity: Minor
    Found in main_server/admin.js by eslint

    enforce consistent spacing before and after keywords (keyword-spacing)

    Keywords are syntax elements of JavaScript, such as function and if. These identifiers have special meaning to the language and so often appear in a different color in code editors. As an important part of the language, style guides often refer to the spacing that should be used around keywords. For example, you might have a style guide that says keywords should be always surrounded by spaces, which would mean if-else statements must look like this:

    if (foo) {
        // ...
    } else {
        // ...
    }

    Of course, you could also have a style guide that disallows spaces around keywords.

    Rule Details

    This rule enforces consistent spacing around keywords and keyword-like tokens: as (in module declarations), async (of async functions), await (of await expressions), break, case, catch, class, const, continue, debugger, default, delete, do, else, export, extends, finally, for, from (in module declarations), function, get (of getters), if, import, in, instanceof, let, new, of (in for-of statements), return, set (of setters), static, super, switch, this, throw, try, typeof, var, void, while, with, and yield. This rule is designed carefully not to conflict with other spacing rules: it does not apply to spacing where other rules report problems.

    Options

    This rule has an object option:

    • "before": true (default) requires at least one space before keywords
    • "before": false disallows spaces before keywords
    • "after": true (default) requires at least one space after keywords
    • "after": false disallows spaces after keywords
    • "overrides" allows overriding spacing style for specified keywords

    before

    Examples of incorrect code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    Examples of correct code for this rule with the default { "before": true } option:

    /*eslint keyword-spacing: ["error", { "before": true }]*/
    /*eslint-env es6*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // no conflict with `array-bracket-spacing`
    let a = [this];
    let b = [function() {}];
    
    // no conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // no conflict with `block-spacing`
    {function foo() {}}
    
    // no conflict with `comma-spacing`
    let a = [100,this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // no conflict with `generator-star-spacing`
    function *foo() {}
    
    // no conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // no conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // no conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // no conflict with `space-in-parens`
    (function () {})();
    
    // no conflict with `space-infix-ops`
    if ("foo"in {foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "before": false } option:

    /*eslint keyword-spacing: ["error", { "before": false }]*/
    
    if (foo) {
        //...
    }else if (bar) {
        //...
    }else {
        //...
    }

    after

    Examples of incorrect code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    Examples of correct code for this rule with the default { "after": true } option:

    /*eslint keyword-spacing: ["error", { "after": true }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }
    
    // not conflict with `array-bracket-spacing`
    let a = [this];
    
    // not conflict with `arrow-spacing`
    let a = ()=> this.foo;
    
    // not conflict with `comma-spacing`
    let a = [100, this.foo, this.bar];
    
    // not conflict with `computed-property-spacing`
    obj[this.foo] = 0;
    
    // not conflict with `generator-star-spacing`
    function* foo() {}
    
    // not conflict with `key-spacing`
    let obj = {
        foo:function() {}
    };
    
    // not conflict with `func-call-spacing`
    class A {
        constructor() {
            super();
        }
    }
    
    // not conflict with `object-curly-spacing`
    let obj = {foo: this};
    
    // not conflict with `semi-spacing`
    let a = this;function foo() {}
    
    // not conflict with `space-before-function-paren`
    function() {}
    
    // no conflict with `space-infix-ops`
    if ("foo"in{foo: 0}) {}
    if (10+this.foo<= this.bar) {}
    
    // no conflict with `space-unary-ops`
    function* foo(a) {
        return yield+a;
    }
    
    // no conflict with `yield-star-spacing`
    function* foo(a) {
        return yield* a;
    }
    
    // no conflict with `jsx-curly-spacing`
    let a = 

    Examples of incorrect code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if (foo) {
        //...
    } else if (bar) {
        //...
    } else {
        //...
    }

    Examples of correct code for this rule with the { "after": false } option:

    /*eslint keyword-spacing: ["error", { "after": false }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else{
        //...
    }

    overrides

    Examples of correct code for this rule with the { "overrides": { "if": { "after": false }, "for": { "after": false }, "while": { "after": false } } } option:

    /*eslint keyword-spacing: ["error", { "overrides": {
      "if": { "after": false },
      "for": { "after": false },
      "while": { "after": false }
    } }]*/
    
    if(foo) {
        //...
    } else if(bar) {
        //...
    } else {
        //...
    }
    
    for(;;);
    
    while(true) {
      //...
    }

    When Not To Use It

    If you don't want to enforce consistency on keyword spacing, then it's safe to disable this rule. Source: http://eslint.org/docs/rules/

    Unexpected function expression.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 4 tabs.
    Open

                    if(err)
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 5 tabs.
    Open

                        if(time > 30)
    Severity: Minor
    Found in main_server/admin.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 indentation of 2 spaces but found 6 tabs.
    Open

                            clearInterval(handle);
    Severity: Minor
    Found in main_server/admin.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 indentation of 0 spaces but found 1 tab.
    Open

        }
    Severity: Minor
    Found in main_server/admin.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 indentation of 0 spaces but found 4 tabs.
    Open

                    }
    Severity: Minor
    Found in main_server/admin.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

    A space is required after ','.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Enforces spacing around commas (comma-spacing)

    Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.

    var foo = 1, bar = 2;
    var foo = 1 ,bar = 2;

    Rule Details

    This rule enforces consistent spacing before and after commas in variable declarations, array literals, object literals, function parameters, and sequences.

    This rule does not apply in an ArrayExpression or ArrayPattern in either of the following cases:

    • adjacent null elements
    • an initial null element, to avoid conflicts with the [array-bracket-spacing](array-bracket-spacing.md) rule

    Options

    This rule has an object option:

    • "before": false (default) disallows spaces before commas
    • "before": true requires one or more spaces before commas
    • "after": true (default) requires one or more spaces after commas
    • "after": false disallows spaces after commas

    after

    Examples of incorrect code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1 ,bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    
    var foo = 1, bar = 2
        , baz = 3;
    var arr = [1, 2];
    var arr = [1,, 3]
    var obj = {"foo": "bar", "baz": "qur"};
    foo(a, b);
    new Foo(a, b);
    function foo(a, b){}
    a, b

    Example of correct code for this rule with initial null element for the default { "before": false, "after": true } options:

    /*eslint comma-spacing: ["error", { "before": false, "after": true }]*/
    /*eslint array-bracket-spacing: ["error", "always"]*/
    
    var arr = [ , 2, 3 ]

    before

    Examples of incorrect code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1, bar = 2;
    var arr = [1 , 2];
    var obj = {"foo": "bar", "baz": "qur"};
    new Foo(a,b);
    function foo(a,b){}
    a, b

    Examples of correct code for this rule with the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    
    var foo = 1 ,bar = 2 ,
        baz = true;
    var arr = [1 ,2];
    var arr = [1 ,,3]
    var obj = {"foo": "bar" ,"baz": "qur"};
    foo(a ,b);
    new Foo(a ,b);
    function foo(a ,b){}
    a ,b

    Examples of correct code for this rule with initial null element for the { "before": true, "after": false } options:

    /*eslint comma-spacing: ["error", { "before": true, "after": false }]*/
    /*eslint array-bracket-spacing: ["error", "never"]*/
    
    var arr = [,2 ,3]

    When Not To Use It

    If your project will not be following a consistent comma-spacing pattern, turn this rule off.

    Further Reading

    Related Rules

    • [array-bracket-spacing](array-bracket-spacing.md)
    • [comma-style](comma-style.md)
    • [space-in-brackets](space-in-brackets.md) (deprecated)
    • [space-in-parens](space-in-parens.md)
    • [space-infix-ops](space-infix-ops.md)
    • [space-after-keywords](space-after-keywords)
    • [space-unary-ops](space-unary-ops)
    • [space-return-throw-case](space-return-throw-case) Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                            socket.emit('update_score_timeout',lab);
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                        }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Unexpected tab character.
    Open

                    }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Expected indentation of 0 spaces but found 4 tabs.
    Open

                    }
    Severity: Minor
    Found in main_server/admin.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

    Unexpected tab character.
    Open

                }
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

        })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 1 tab.
    Open

        socket.on('logout',function(data)
    Severity: Minor
    Found in main_server/admin.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

    Unexpected function expression.
    Open

        socket.on('logout',function(data)
    Severity: Minor
    Found in main_server/admin.js by eslint

    Suggest using arrow functions as callbacks. (prefer-arrow-callback)

    Arrow functions are suited to callbacks, because:

    • this keywords in arrow functions bind to the upper scope's.
    • The notation of the arrow function is shorter than function expression's.

    Rule Details

    This rule is aimed to flag usage of function expressions in an argument list.

    The following patterns are considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    
    foo(function(a) { return a; });
    foo(function() { return this.a; }.bind(this));

    The following patterns are not considered problems:

    /*eslint prefer-arrow-callback: "error"*/
    /*eslint-env es6*/
    
    foo(a => a);
    foo(function*() { yield; });
    
    // this is not a callback.
    var foo = function foo(a) { return a; };
    
    // using `this` without `.bind(this)`.
    foo(function() { return this.a; });
    
    // recursively.
    foo(function bar(n) { return n && n + bar(n - 1); });

    Options

    This rule takes one optional argument, an object which is an options object.

    allowNamedFunctions

    This is a boolean option and it is false by default. When set to true, the rule doesn't warn on named functions used as callbacks.

    Examples of correct code for the { "allowNamedFunctions": true } option:

    /*eslint prefer-arrow-callback: ["error", { "allowNamedFunctions": true }]*/
    
    foo(function bar() {});

    allowUnboundThis

    This is a boolean option and it is true by default. When set to false, this option allows the use of this without restriction and checks for dynamically assigned this values such as when using Array.prototype.map with a context argument. Normally, the rule will flag the use of this whenever a function does not use bind() to specify the value of this constantly.

    Examples of incorrect code for the { "allowUnboundThis": false } option:

    /*eslint prefer-arrow-callback: ["error", { "allowUnboundThis": false }]*/
    /*eslint-env es6*/
    
    foo(function() { this.a; });
    
    foo(function() { (() => this); });
    
    someArray.map(function (itm) { return this.doSomething(itm); }, someObject);

    When Not To Use It

    This rule should not be used in ES3/5 environments.

    In ES2015 (ES6) or later, if you don't want to be notified about function expressions in an argument list, you can safely disable this rule. Source: http://eslint.org/docs/rules/

    Expected indentation of 2 spaces but found 2 tabs.
    Open

            socket.emit('logged out');
    Severity: Minor
    Found in main_server/admin.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

    Unexpected var, use let or const instead.
    Open

            var time =0;
    Severity: Minor
    Found in main_server/admin.js by eslint

    require let or const instead of var (no-var)

    ECMAScript 6 allows programmers to create variables with block scope instead of function scope using the let and const keywords. Block scope is common in many other programming languages and helps programmers avoid mistakes such as:

    var count = people.length;
    var enoughFood = count > sandwiches.length;
    
    if (enoughFood) {
        var count = sandwiches.length; // accidentally overriding the count variable
        console.log("We have " + count + " sandwiches for everyone. Plenty for all!");
    }
    
    // our count variable is no longer accurate
    console.log("We have " + count + " people and " + sandwiches.length + " sandwiches!");

    Rule Details

    This rule is aimed at discouraging the use of var and encouraging the use of const or let instead.

    Examples

    Examples of incorrect code for this rule:

    /*eslint no-var: "error"*/
    
    var x = "y";
    var CONFIG = {};

    Examples of correct code for this rule:

    /*eslint no-var: "error"*/
    /*eslint-env es6*/
    
    let x = "y";
    const CONFIG = {};

    When Not To Use It

    In addition to non-ES6 environments, existing JavaScript projects that are beginning to introduce ES6 into their codebase may not want to apply this rule if the cost of migrating from var to let is too costly. Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

            var time =0;
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Infix operators must be spaced.
    Open

                fs.stat('./reval/'+lab+"_reval_score.csv",function(err,stat)
    Severity: Minor
    Found in main_server/admin.js by eslint

    require spacing around infix operators (space-infix-ops)

    While formatting preferences are very personal, a number of style guides require spaces around operators, such as:

    var sum = 1 + 2;

    The proponents of these extra spaces believe it make the code easier to read and can more easily highlight potential errors, such as:

    var sum = i+++2;

    While this is valid JavaScript syntax, it is hard to determine what the author intended.

    Rule Details

    This rule is aimed at ensuring there are spaces around infix operators.

    Options

    This rule accepts a single options argument with the following defaults:

    "space-infix-ops": ["error", {"int32Hint": false}]

    int32Hint

    Set the int32Hint option to true (default is false) to allow write a|0 without space.

    var foo = bar|0; // `foo` is forced to be signed 32 bit integer

    Examples of incorrect code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a+b
    
    a+ b
    
    a +b
    
    a?b:c
    
    const a={b:1};
    
    var {a=0}=bar;
    
    function foo(a=0) { }

    Examples of correct code for this rule:

    /*eslint space-infix-ops: "error"*/
    /*eslint-env es6*/
    
    a + b
    
    a       + b
    
    a ? b : c
    
    const a = {b:1};
    
    var {a = 0} = bar;
    
    function foo(a = 0) { }

    Source: http://eslint.org/docs/rules/

    Unexpected tab character.
    Open

                        if(time > 30)
    Severity: Minor
    Found in main_server/admin.js by eslint

    disallow all tabs (no-tabs)

    Some style guides don't allow the use of tab characters at all, including within comments.

    Rule Details

    This rule looks for tabs anywhere inside a file: code, comments or anything else.

    Examples of incorrect code for this rule:

    var a /t= 2;
    
    /**
    * /t/t it's a test function
    */
    function test(){}
    
    var x = 1; // /t test

    Examples of correct code for this rule:

    var a = 2;
    
    /**
    * it's a test function
    */
    function test(){}
    
    var x = 1; // test

    When Not To Use It

    If you have established a standard where having tabs is fine.

    Compatibility

    Missing semicolon.
    Open

                })
    Severity: Minor
    Found in main_server/admin.js by eslint

    require or disallow semicolons instead of ASI (semi)

    JavaScript is unique amongst the C-like languages in that it doesn't require semicolons at the end of each statement. In many cases, the JavaScript engine can determine that a semicolon should be in a certain spot and will automatically add it. This feature is known as automatic semicolon insertion (ASI) and is considered one of the more controversial features of JavaScript. For example, the following lines are both valid:

    var name = "ESLint"
    var website = "eslint.org";

    On the first line, the JavaScript engine will automatically insert a semicolon, so this is not considered a syntax error. The JavaScript engine still knows how to interpret the line and knows that the line end indicates the end of the statement.

    In the debate over ASI, there are generally two schools of thought. The first is that we should treat ASI as if it didn't exist and always include semicolons manually. The rationale is that it's easier to always include semicolons than to try to remember when they are or are not required, and thus decreases the possibility of introducing an error.

    However, the ASI mechanism can sometimes be tricky to people who are using semicolons. For example, consider this code:

    return
    {
        name: "ESLint"
    };

    This may look like a return statement that returns an object literal, however, the JavaScript engine will interpret this code as:

    return;
    {
        name: "ESLint";
    }

    Effectively, a semicolon is inserted after the return statement, causing the code below it (a labeled literal inside a block) to be unreachable. This rule and the [no-unreachable](no-unreachable.md) rule will protect your code from such cases.

    On the other side of the argument are those who says that since semicolons are inserted automatically, they are optional and do not need to be inserted manually. However, the ASI mechanism can also be tricky to people who don't use semicolons. For example, consider this code:

    var globalCounter = { }
    
    (function () {
        var n = 0
        globalCounter.increment = function () {
            return ++n
        }
    })()

    In this example, a semicolon will not be inserted after the first line, causing a run-time error (because an empty object is called as if it's a function). The [no-unexpected-multiline](no-unexpected-multiline.md) rule can protect your code from such cases.

    Although ASI allows for more freedom over your coding style, it can also make your code behave in an unexpected way, whether you use semicolons or not. Therefore, it is best to know when ASI takes place and when it does not, and have ESLint protect your code from these potentially unexpected cases. In short, as once described by Isaac Schlueter, a \n character always ends a statement (just like a semicolon) unless one of the following is true:

    1. The statement has an unclosed paren, array literal, or object literal or ends in some other way that is not a valid way to end a statement. (For instance, ending with . or ,.)
    2. The line is -- or ++ (in which case it will decrement/increment the next token.)
    3. It is a for(), while(), do, if(), or else, and there is no {
    4. The next line starts with [, (, +, *, /, -, ,, ., or some other binary operator that can only be found between two tokens in a single expression.

    Rule Details

    This rule enforces consistent use of semicolons.

    Options

    This rule has two options, a string option and an object option.

    String option:

    • "always" (default) requires semicolons at the end of statements
    • "never" disallows semicolons as the end of statements (except to disambiguate statements beginning with [, (, /, +, or -)

    Object option:

    • "omitLastInOneLineBlock": true ignores the last semicolon in a block in which its braces (and therefore the content of the block) are in the same line

    always

    Examples of incorrect code for this rule with the default "always" option:

    /*eslint semi: ["error", "always"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }

    Examples of correct code for this rule with the default "always" option:

    /*eslint semi: "error"*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    never

    Examples of incorrect code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint";
    
    object.method = function() {
        // ...
    };

    Examples of correct code for this rule with the "never" option:

    /*eslint semi: ["error", "never"]*/
    
    var name = "ESLint"
    
    object.method = function() {
        // ...
    }
    
    var name = "ESLint"
    
    ;(function() {
        // ...
    })()

    omitLastInOneLineBlock

    Examples of additional correct code for this rule with the "always", { "omitLastInOneLineBlock": true } options:

    /*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}] */
    
    if (foo) { bar() }
    
    if (foo) { bar(); baz() }

    When Not To Use It

    If you do not want to enforce semicolon usage (or omission) in any particular way, then you can turn this rule off.

    Further Reading

    Related Rules

    • [no-extra-semi](no-extra-semi.md)
    • [no-unexpected-multiline](no-unexpected-multiline.md)
    • [semi-spacing](semi-spacing.md) Source: http://eslint.org/docs/rules/

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                var start_date = data[rev].start_date + '/'+data[rev].start_month+'/'+data[rev].start_year + ' ' + data[rev].start_hour + ':' + data[rev].start_minute + ':00';
    Severity: Major
    Found in main_server/admin.js and 1 other location - About 2 hrs to fix
    main_server/admin.js on lines 75..75

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            var end_date =  data[rev].end_date + '/'+ data[rev].end_month+'/'+data[rev].end_year + ' ' + data[rev].end_hour + ':' + data[rev].end_minute + ':00';
    Severity: Major
    Found in main_server/admin.js and 1 other location - About 2 hrs to fix
    main_server/admin.js on lines 74..74

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 83.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Expected empty line after require statement not followed by another require.
    Open

    var fs = require('fs');
    Severity: Minor
    Found in main_server/admin.js by eslint

    For more information visit Source: http://eslint.org/docs/rules/

    There are no issues that match your filters.

    Category
    Status