MidnightRiders/MemberPortal

View on GitHub
app/javascript/vendor/foundation/foundation.js

Summary

Maintainability
C
1 day
Test Coverage

File foundation.js has 466 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Foundation Responsive Library
 * http://foundation.zurb.com
 * Copyright 2015, ZURB
 * Free to use under the MIT license.
Severity: Minor
Found in app/javascript/vendor/foundation/foundation.js - About 7 hrs to fix

    Function data_options has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          data_options : function (el, data_attr_name) {
            data_attr_name = data_attr_name || 'options';
            var opts = {}, ii, p, opts_arr,
                data_options = function (el) {
                  var namespace = Foundation.global.namespace;
    Severity: Minor
    Found in app/javascript/vendor/foundation/foundation.js - About 1 hr to fix

      Function matchMedia has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        window.matchMedia || (window.matchMedia = function() {
            "use strict";
      
            // For browsers that support matchMedium api such as IE 9 and webkit
            var styleMedia = (window.styleMedia || window.media);
      Severity: Minor
      Found in app/javascript/vendor/foundation/foundation.js - About 1 hr to fix

        Function init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            init : function (scope, libraries, method, options, response) {
              var args = [scope, method, options, response],
                  responses = [];
        
              // check RTL
        Severity: Minor
        Found in app/javascript/vendor/foundation/foundation.js - About 1 hr to fix

          Function init has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              init : function (scope, libraries, method, options, response) {
          Severity: Minor
          Found in app/javascript/vendor/foundation/foundation.js - About 35 mins to fix

            Identifier 'should_bind_events' is not in camel case.
            Open

                      if (should_bind_events) {

            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 8 spaces but found 10.
            Open

                      style.id    = 'matchmediajs-test';

            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

                  "use strict";

            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 8 spaces but found 10.
            Open

                      style.type  = 'text/css';

            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

            Unnecessary 'use strict' directive.
            Open

                  "use strict";

            require or disallow strict mode directives (strict)

            A strict mode directive is a "use strict" literal at the beginning of a script or function body. It enables strict mode semantics.

            When a directive occurs in global scope, strict mode applies to the entire script:

            "use strict";
            
            // strict mode
            
            function foo() {
                // strict mode
            }

            When a directive occurs at the beginning of a function body, strict mode applies only to that function, including all contained functions:

            function foo() {
                "use strict";
                // strict mode
            }
            
            function foo2() {
                // not strict mode
            };
            
            (function() {
                "use strict";
                function bar() {
                    // strict mode
                }
            }());

            In the CommonJS module system, a hidden function wraps each module and limits the scope of a "global" strict mode directive.

            In ECMAScript modules, which always have strict mode semantics, the directives are unnecessary.

            Rule Details

            This rule requires or disallows strict mode directives.

            This rule disallows strict mode directives, no matter which option is specified, if ESLint configuration specifies either of the following as [parser options](../user-guide/configuring#specifying-parser-options):

            • "sourceType": "module" that is, files are ECMAScript modules
            • "impliedStrict": true property in the ecmaFeatures object

            This rule disallows strict mode directives, no matter which option is specified, in functions with non-simple parameter lists (for example, parameter lists with default parameter values) because that is a syntax error in ECMAScript 2016 and later. See the examples of the function option.

            Options

            This rule has a string option:

            • "safe" (default) corresponds either of the following options:
              • "global" if ESLint considers a file to be a CommonJS module
              • "function" otherwise
            • "global" requires one strict mode directive in the global scope (and disallows any other strict mode directives)
            • "function" requires one strict mode directive in each top-level function declaration or expression (and disallows any other strict mode directives)
            • "never" disallows strict mode directives

            safe

            The "safe" option corresponds to the "global" option if ESLint considers a file to be a Node.js or CommonJS module because the configuration specifies either of the following:

            • node or commonjs [environments](../user-guide/configuring#specifying-environments)
            • "globalReturn": true property in the ecmaFeatures object of [parser options](../user-guide/configuring#specifying-parser-options)

            Otherwise the "safe" option corresponds to the "function" option.

            global

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

            /*eslint strict: ["error", "global"]*/
            
            function foo() {
            }
            /*eslint strict: ["error", "global"]*/
            
            function foo() {
                "use strict";
            }
            /*eslint strict: ["error", "global"]*/
            
            "use strict";
            
            function foo() {
                "use strict";
            }

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

            /*eslint strict: ["error", "global"]*/
            
            "use strict";
            
            function foo() {
            }

            function

            This option ensures that all function bodies are strict mode code, while global code is not. Particularly if a build step concatenates multiple scripts, a strict mode directive in global code of one script could unintentionally enable strict mode in another script that was not intended to be strict code.

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

            /*eslint strict: ["error", "function"]*/
            
            "use strict";
            
            function foo() {
            }
            /*eslint strict: ["error", "function"]*/
            
            function foo() {
            }
            
            (function() {
                function bar() {
                    "use strict";
                }
            }());
            /*eslint strict: ["error", "function"]*/
            /*eslint-env es6*/
            
            // Illegal "use strict" directive in function with non-simple parameter list.
            // This is a syntax error since ES2016.
            function foo(a = 1) {
                "use strict";
            }
            
            // We cannot write "use strict" directive in this function.
            // So we have to wrap this function with a function with "use strict" directive.
            function foo(a = 1) {
            }

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

            /*eslint strict: ["error", "function"]*/
            
            function foo() {
                "use strict";
            }
            
            (function() {
                "use strict";
            
                function bar() {
                }
            
                function baz(a = 1) {
                }
            }());
            
            var foo = (function() {
                "use strict";
            
                return function foo(a = 1) {
                };
            }());

            never

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

            /*eslint strict: ["error", "never"]*/
            
            "use strict";
            
            function foo() {
            }
            /*eslint strict: ["error", "never"]*/
            
            function foo() {
                "use strict";
            }

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

            /*eslint strict: ["error", "never"]*/
            
            function foo() {
            }

            earlier default (removed)

            (removed) The default option (that is, no string option specified) for this rule was removed in ESLint v1.0. The "function" option is most similar to the removed option.

            This option ensures that all functions are executed in strict mode. A strict mode directive must be present in global code or in every top-level function declaration or expression. It does not concern itself with unnecessary strict mode directives in nested functions that are already strict, nor with multiple strict mode directives at the same level.

            Examples of incorrect code for this rule with the earlier default option which has been removed:

            // "strict": "error"
            
            function foo() {
            }
            // "strict": "error"
            
            (function() {
                function bar() {
                    "use strict";
                }
            }());

            Examples of correct code for this rule with the earlier default option which has been removed:

            // "strict": "error"
            
            "use strict";
            
            function foo() {
            }
            // "strict": "error"
            
            function foo() {
                "use strict";
            }
            // "strict": "error"
            
            (function() {
                "use strict";
                function bar() {
                    "use strict";
                }
            }());

            When Not To Use It

            In a codebase that has both strict and non-strict code, either turn this rule off, or selectively disable it where necessary. For example, functions referencing arguments.callee are invalid in strict mode. A full list of strict mode differences is available on MDN. Source: http://eslint.org/docs/rules/

            Expected indentation of 20 spaces but found 22.
            Open

                                  style.textContent = text;

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

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

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

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

            Compatibility

            Identifier 'attr_name' is not in camel case.
            Open

              var attr_name = function (init) {

            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 12 spaces but found 14.
            Open

                          matches: styleMedia.matchMedium(media || 'all'),

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

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

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

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

            Compatibility

            Identifier 'class_array' is not in camel case.
            Open

              var header_helpers = function (class_array) {

            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 function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                      var $this = S(this),

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

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

            var friend = new Person();

            Rule Details

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

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

            Examples of correct code for this rule:

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

            Options

            This rule has an object option:

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

            newIsCap

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

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

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

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

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

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

            capIsNew

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

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

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

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

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

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

            newIsCapExceptions

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

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

            newIsCapExceptionPattern

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

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

            capIsNewExceptions

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

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

            capIsNewExceptionPattern

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

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

            properties

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

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

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

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

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

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

            When Not To Use It

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

            A function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                  S('[' + this.attr_name() +']', this.scope).each(bind);

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

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

            var friend = new Person();

            Rule Details

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

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

            Examples of correct code for this rule:

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

            Options

            This rule has an object option:

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

            newIsCap

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

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

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

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

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

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

            capIsNew

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

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

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

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

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

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

            newIsCapExceptions

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

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

            newIsCapExceptionPattern

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

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

            capIsNewExceptions

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

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

            capIsNewExceptionPattern

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

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

            properties

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

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

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

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

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

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

            When Not To Use It

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

            Expected indentation of 4 spaces but found 6.
            Open

                  if (!styleMedia) {

            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 16 spaces but found 18.
            Open

                              return info.width === '1px';

            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 12 spaces but found 14.
            Open

                          media: media || 'all'

            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 8 spaces but found 10.
            Open

                      var style       = document.createElement('style'),

            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 8 spaces but found 10.
            Open

                      info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

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

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

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

            Compatibility

            Identifier 'should_bind_events' is not in camel case.
            Open

                          should_bind_events = !$this.data(self.attr_name(true) + '-init');

            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 function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                if (S(this.scope).is('[' + this.attr_name() +']')) {

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

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

            var friend = new Person();

            Rule Details

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

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

            Examples of correct code for this rule:

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

            Options

            This rule has an object option:

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

            newIsCap

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

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

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

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

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

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

            capIsNew

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

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

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

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

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

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

            newIsCapExceptions

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

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

            newIsCapExceptionPattern

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

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

            capIsNewExceptions

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

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

            capIsNewExceptionPattern

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

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

            properties

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

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

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

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

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

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

            When Not To Use It

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

            Expected indentation of 16 spaces but found 18.
            Open

                              var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';

            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 16 spaces but found 18.
            Open

                              if (style.styleSheet) {

            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 20 spaces but found 22.
            Open

                                  style.styleSheet.cssText = text;

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

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

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

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

            Compatibility

            Identifier 'class_name' is not in camel case.
            Open

                  if (head.has('.' + class_name).length === 0) {

            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/

            Identifier 'class_name' is not in camel case.
            Open

                    return '<meta class="' + class_name + '" />';

            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 8 spaces but found 10.
            Open

                      script.parentNode.insertBefore(style, script);

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

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

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

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

            Compatibility

            Identifier 'header_helpers' is not in camel case.
            Open

              var header_helpers = function (class_array) {

            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 4 spaces but found 6.
            Open

                  return function(media) {

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

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

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

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

            Compatibility

            Identifier 'class_name' is not in camel case.
            Open

                head.prepend($.map(class_array, function (class_name) {

            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/

            Identifier 'add_namespace' is not in camel case.
            Open

              var add_namespace = function (str) {

            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/

            Identifier 'single_image_loaded' is not in camel case.
            Open

              var single_image_loaded = function (image, callback) {

            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 4 spaces but found 6.
            Open

                  "use strict";

            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 4 spaces but found 6.
            Open

                  var styleMedia = (window.styleMedia || window.media);

            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 8 spaces but found 10.
            Open

                      styleMedia = {

            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 12 spaces but found 14.
            Open

                          matchMedium: function(media) {

            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 8 spaces but found 10.
            Open

                      return {

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

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

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

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

            Compatibility

            Identifier 'data_attr_name' is not in camel case.
            Open

                            return el.data(namespace + '-' + data_attr_name);

            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 function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                  S(window).load(function () {

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

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

            var friend = new Person();

            Rule Details

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

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

            Examples of correct code for this rule:

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

            Options

            This rule has an object option:

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

            newIsCap

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

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

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

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

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

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

            capIsNew

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

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

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

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

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

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

            newIsCapExceptions

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

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

            newIsCapExceptionPattern

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

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

            capIsNewExceptions

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

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

            capIsNewExceptionPattern

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

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

            properties

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

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

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

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

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

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

            When Not To Use It

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

            Identifier 'opts_arr' is not in camel case.
            Open

                    opts_arr = (cached_options || ':').split(';');

            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 4 spaces but found 2.
            Open

              var animating,

            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 4 spaces but found 2.
            Open

              if (requestAnimationFrame) {

            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 function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                  this.rtl = /rtl/i.test(S('html').attr('dir'));

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

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

            var friend = new Person();

            Rule Details

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

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

            Examples of correct code for this rule:

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

            Options

            This rule has an object option:

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

            newIsCap

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

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

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

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

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

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

            capIsNew

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

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

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

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

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

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

            newIsCapExceptions

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

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

            newIsCapExceptionPattern

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

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

            capIsNewExceptions

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

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

            capIsNewExceptionPattern

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

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

            properties

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

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

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

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

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

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

            When Not To Use It

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

            Identifier 'data_options' is not in camel case.
            Open

                        data_options = function (el) {

            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/

            Identifier 'media_class' is not in camel case.
            Open

                      $('head').append('<meta class="' + media_class + '"/>');

            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/

            Identifier 'pictures_number' is not in camel case.
            Open

                      var pictures_number = images.length;

            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 4 spaces but found 2.
            Open

              for (; lastTime < vendors.length && !requestAnimationFrame; lastTime++) {

            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 4 spaces but found 2.
            Open

              function raf() {

            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

            Unnecessarily quoted property 'xlarge' found.
            Open

                  'xlarge'      : new MediaQuery('.foundation-mq-xlarge'),

            require quotes around object literal property names (quote-props)

            Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

            var object1 = {
                property: true
            };
            
            var object2 = {
                "property": true
            };

            In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

            There are, however, some occasions when you must use quotes:

            1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
            2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

            Another example where quotes do matter is when using numeric literals as property keys:

            var object = {
                1e2: 1,
                100: 2
            };

            This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

            Rule Details

            This rule requires quotes around object literal property names.

            Options

            This rule has two options, a string option and an object option.

            String option:

            • "always" (default) requires quotes around all object literal property names
            • "as-needed" disallows quotes around object literal property names that are not strictly required
            • "consistent" enforces a consistent quote style requires quotes around object literal property names
            • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

            Object option:

            • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
            • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

            always

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

            /*eslint quote-props: ["error", "always"]*/
            
            var object = {
                foo: "bar",
                baz: 42,
                "qux-lorem": true
            };

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

            /*eslint quote-props: ["error", "always"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            as-needed

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

            /*eslint quote-props: ["error", "as-needed"]*/
            
            var object = {
                "a": 0,
                "0": 0,
                "true": 0,
                "null": 0
            };

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

            /*eslint quote-props: ["error", "as-needed"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "a-b": 0,
                "0x0": 0,
                "1e2": 0
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42,
                true: 0,
                0: 0,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            consistent

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

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                baz: 42
            };

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

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };
            
            var object3 = {
                foo: 'bar',
                baz: 42
            };

            consistent-as-needed

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

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };

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

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42
            };

            keywords

            Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
            
            var x = {
                while: 1,
                volatile: "foo"
            };

            Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
            
            var x = {
                "prop": 1,
                "bar": "foo"
            };

            unnecessary

            Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
            
            var x = {
                "while": 1,
                "foo": "bar"  // Would normally have caused a warning
            };

            numbers

            Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

            /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
            
            var x = {
                100: 1
            }

            When Not To Use It

            If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

            Further Reading

            Identifier 'cached_options' is not in camel case.
            Open

                    var cached_options = data_options(el);

            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/

            Identifier 'media_class' is not in camel case.
            Open

                      Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));

            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/

            Identifier 'pictures_has_height' is not in camel case.
            Open

                    function pictures_has_height(images) {

            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/

            Identifier 'add_namespace' is not in camel case.
            Open

                  lib['add_namespace'] = add_namespace;

            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/

            Identifier 'methods_arr' is not in camel case.
            Open

                  var methods_arr = methods.split(' '),

            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/

            Identifier 'opts_arr' is not in camel case.
            Open

                    var opts = {}, ii, p, opts_arr,

            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/

            Identifier 'cached_options' is not in camel case.
            Open

                    if (typeof cached_options === 'object') {

            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/

            Identifier 'pictures_number' is not in camel case.
            Open

                      for (var i = pictures_number - 1; i >= 0; i--) {

            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 10 spaces but found 8.
            Open

                    timeToCall = Math.max(0, 16 - (currTime - lastTime)),

            enforce consistent indentation (indent)

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

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

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

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

            Rule Details

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

            Options

            This rule has a mixed option:

            For example, for 2-space indentation:

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

            Or for tabbed indentation:

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

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

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

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

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

            This rule has an object option:

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

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

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

            tab

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

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

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

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

            SwitchCase

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

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

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

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

            VariableDeclarator

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

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

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

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

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

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

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

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

            outerIIFEBody

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

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

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

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

            MemberExpression

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

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

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

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

            FunctionDeclaration

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

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

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

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

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

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

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

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

            FunctionExpression

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

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

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

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

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

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

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

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

            CallExpression

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

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

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

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

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

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

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

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

            ArrayExpression

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

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

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

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

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

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

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

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

            ObjectExpression

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

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

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

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

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

            /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
            
            var foo = { bar: 1,
              baz: 2 };

            Examples of correct code for this rule with the 2, { "ObjectExpression": "first" } option:

            /*eslint indent: ["error", 2, {"ObjectExpression": "first"}]*/
            
            var foo = { bar: 1,
                        baz: 2 };

            Compatibility

            Identifier 'data_attr_name' is not in camel case.
            Open

                  data_options : function (el, data_attr_name) {

            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/

            Identifier 'data_attr_name' is not in camel case.
            Open

                    data_attr_name = data_attr_name || 'options';

            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/

            Unnecessarily quoted property 'small' found.
            Open

                  'small'       : new MediaQuery('.foundation-mq-small'),

            require quotes around object literal property names (quote-props)

            Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

            var object1 = {
                property: true
            };
            
            var object2 = {
                "property": true
            };

            In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

            There are, however, some occasions when you must use quotes:

            1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
            2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

            Another example where quotes do matter is when using numeric literals as property keys:

            var object = {
                1e2: 1,
                100: 2
            };

            This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

            Rule Details

            This rule requires quotes around object literal property names.

            Options

            This rule has two options, a string option and an object option.

            String option:

            • "always" (default) requires quotes around all object literal property names
            • "as-needed" disallows quotes around object literal property names that are not strictly required
            • "consistent" enforces a consistent quote style requires quotes around object literal property names
            • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

            Object option:

            • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
            • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

            always

            Examples of incorrect code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            
            var object = {
                foo: "bar",
                baz: 42,
                "qux-lorem": true
            };

            Examples of correct code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            as-needed

            Examples of incorrect code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            
            var object = {
                "a": 0,
                "0": 0,
                "true": 0,
                "null": 0
            };

            Examples of correct code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "a-b": 0,
                "0x0": 0,
                "1e2": 0
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42,
                true: 0,
                0: 0,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            consistent

            Examples of incorrect code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                baz: 42
            };

            Examples of correct code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };
            
            var object3 = {
                foo: 'bar',
                baz: 42
            };

            consistent-as-needed

            Examples of incorrect code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };

            Examples of correct code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42
            };

            keywords

            Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
            
            var x = {
                while: 1,
                volatile: "foo"
            };

            Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
            
            var x = {
                "prop": 1,
                "bar": "foo"
            };

            unnecessary

            Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
            
            var x = {
                "while": 1,
                "foo": "bar"  // Would normally have caused a warning
            };

            numbers

            Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

            /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
            
            var x = {
                100: 1
            }

            When Not To Use It

            If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

            Further Reading

            Identifier 'attr_name' is not in camel case.
            Open

                  lib['attr_name'] = attr_name;

            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/

            Identifier 'cached_options' is not in camel case.
            Open

                    opts_arr = (cached_options || ':').split(';');

            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 function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                      single_image_loaded(self.S(this), function () {

            require constructor names to begin with a capital letter (new-cap)

            The new operator in JavaScript creates a new instance of a particular type of object. That type of object is represented by a constructor function. Since constructor functions are just regular functions, the only defining characteristic is that new is being used as part of the call. Native JavaScript functions begin with an uppercase letter to distinguish those functions that are to be used as constructors from functions that are not. Many style guides recommend following this pattern to more easily determine which functions are to be used as constructors.

            var friend = new Person();

            Rule Details

            This rule requires constructor names to begin with a capital letter. Certain built-in identifiers are exempt from this rule. These identifiers are:

            • Array
            • Boolean
            • Date
            • Error
            • Function
            • Number
            • Object
            • RegExp
            • String
            • Symbol

            Examples of correct code for this rule:

            /*eslint new-cap: "error"*/
            
            function foo(arg) {
                return Boolean(arg);
            }

            Options

            This rule has an object option:

            • "newIsCap": true (default) requires all new operators to be called with uppercase-started functions.
            • "newIsCap": false allows new operators to be called with lowercase-started or uppercase-started functions.
            • "capIsNew": true (default) requires all uppercase-started functions to be called with new operators.
            • "capIsNew": false allows uppercase-started functions to be called without new operators.
            • "newIsCapExceptions" allows specified lowercase-started function names to be called with the new operator.
            • "newIsCapExceptionPattern" allows any lowercase-started function names that match the specified regex pattern to be called with the new operator.
            • "capIsNewExceptions" allows specified uppercase-started function names to be called without the new operator.
            • "capIsNewExceptionPattern" allows any uppercase-started function names that match the specified regex pattern to be called without the new operator.
            • "properties": true (default) enables checks on object properties
            • "properties": false disables checks on object properties

            newIsCap

            Examples of incorrect code for this rule with the default { "newIsCap": true } option:

            /*eslint new-cap: ["error", { "newIsCap": true }]*/
            
            var friend = new person();

            Examples of correct code for this rule with the default { "newIsCap": true } option:

            /*eslint new-cap: ["error", { "newIsCap": true }]*/
            
            var friend = new Person();

            Examples of correct code for this rule with the { "newIsCap": false } option:

            /*eslint new-cap: ["error", { "newIsCap": false }]*/
            
            var friend = new person();

            capIsNew

            Examples of incorrect code for this rule with the default { "capIsNew": true } option:

            /*eslint new-cap: ["error", { "capIsNew": true }]*/
            
            var colleague = Person();

            Examples of correct code for this rule with the default { "capIsNew": true } option:

            /*eslint new-cap: ["error", { "capIsNew": true }]*/
            
            var colleague = new Person();

            Examples of correct code for this rule with the { "capIsNew": false } option:

            /*eslint new-cap: ["error", { "capIsNew": false }]*/
            
            var colleague = Person();

            newIsCapExceptions

            Examples of additional correct code for this rule with the { "newIsCapExceptions": ["events"] } option:

            /*eslint new-cap: ["error", { "newIsCapExceptions": ["events"] }]*/
            
            var events = require('events');
            
            var emitter = new events();

            newIsCapExceptionPattern

            Examples of additional correct code for this rule with the { "newIsCapExceptionPattern": "^person\.." } option:

            /*eslint new-cap: ["error", { "newIsCapExceptionPattern": "^person\.." }]*/
            
            var friend = new person.acquaintance();
            var bestFriend = new person.friend();

            capIsNewExceptions

            Examples of additional correct code for this rule with the { "capIsNewExceptions": ["Person"] } option:

            /*eslint new-cap: ["error", { "capIsNewExceptions": ["Person"] }]*/
            
            function foo(arg) {
                return Person(arg);
            }

            capIsNewExceptionPattern

            Examples of additional correct code for this rule with the { "capIsNewExceptionPattern": "^Person\.." } option:

            /*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^Person\.." }]*/
            
            var friend = person.Acquaintance();
            var bestFriend = person.Friend();

            properties

            Examples of incorrect code for this rule with the default { "properties": true } option:

            /*eslint new-cap: ["error", { "properties": true }]*/
            
            var friend = new person.acquaintance();

            Examples of correct code for this rule with the default { "properties": true } option:

            /*eslint new-cap: ["error", { "properties": true }]*/
            
            var friend = new person.Acquaintance();

            Examples of correct code for this rule with the { "properties": false } option:

            /*eslint new-cap: ["error", { "properties": false }]*/
            
            var friend = new person.acquaintance();

            When Not To Use It

            If you have conventions that don't require an uppercase letter for constructors, or don't require capitalized functions be only used as constructors, turn this rule off. Source: http://eslint.org/docs/rules/

            Expected indentation of 10 spaces but found 8.
            Open

                    id = window.setTimeout(function () {

            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

            Unnecessarily quoted property 'large' found.
            Open

                  'large'       : new MediaQuery('.foundation-mq-large'),

            require quotes around object literal property names (quote-props)

            Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

            var object1 = {
                property: true
            };
            
            var object2 = {
                "property": true
            };

            In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

            There are, however, some occasions when you must use quotes:

            1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
            2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

            Another example where quotes do matter is when using numeric literals as property keys:

            var object = {
                1e2: 1,
                100: 2
            };

            This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

            Rule Details

            This rule requires quotes around object literal property names.

            Options

            This rule has two options, a string option and an object option.

            String option:

            • "always" (default) requires quotes around all object literal property names
            • "as-needed" disallows quotes around object literal property names that are not strictly required
            • "consistent" enforces a consistent quote style requires quotes around object literal property names
            • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

            Object option:

            • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
            • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

            always

            Examples of incorrect code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            
            var object = {
                foo: "bar",
                baz: 42,
                "qux-lorem": true
            };

            Examples of correct code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            as-needed

            Examples of incorrect code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            
            var object = {
                "a": 0,
                "0": 0,
                "true": 0,
                "null": 0
            };

            Examples of correct code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "a-b": 0,
                "0x0": 0,
                "1e2": 0
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42,
                true: 0,
                0: 0,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            consistent

            Examples of incorrect code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                baz: 42
            };

            Examples of correct code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };
            
            var object3 = {
                foo: 'bar',
                baz: 42
            };

            consistent-as-needed

            Examples of incorrect code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };

            Examples of correct code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42
            };

            keywords

            Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
            
            var x = {
                while: 1,
                volatile: "foo"
            };

            Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
            
            var x = {
                "prop": 1,
                "bar": "foo"
            };

            unnecessary

            Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
            
            var x = {
                "while": 1,
                "foo": "bar"  // Would normally have caused a warning
            };

            numbers

            Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

            /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
            
            var x = {
                100: 1
            }

            When Not To Use It

            If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

            Further Reading

            Identifier 'data_attr_name' is not in camel case.
            Open

                    data_attr_name = data_attr_name || 'options';

            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 function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                    S(window)

            require constructor names to begin with a capital letter (new-cap)

            The new operator in JavaScript creates a new instance of a particular type of object. That type of object is represented by a constructor function. Since constructor functions are just regular functions, the only defining characteristic is that new is being used as part of the call. Native JavaScript functions begin with an uppercase letter to distinguish those functions that are to be used as constructors from functions that are not. Many style guides recommend following this pattern to more easily determine which functions are to be used as constructors.

            var friend = new Person();

            Rule Details

            This rule requires constructor names to begin with a capital letter. Certain built-in identifiers are exempt from this rule. These identifiers are:

            • Array
            • Boolean
            • Date
            • Error
            • Function
            • Number
            • Object
            • RegExp
            • String
            • Symbol

            Examples of correct code for this rule:

            /*eslint new-cap: "error"*/
            
            function foo(arg) {
                return Boolean(arg);
            }

            Options

            This rule has an object option:

            • "newIsCap": true (default) requires all new operators to be called with uppercase-started functions.
            • "newIsCap": false allows new operators to be called with lowercase-started or uppercase-started functions.
            • "capIsNew": true (default) requires all uppercase-started functions to be called with new operators.
            • "capIsNew": false allows uppercase-started functions to be called without new operators.
            • "newIsCapExceptions" allows specified lowercase-started function names to be called with the new operator.
            • "newIsCapExceptionPattern" allows any lowercase-started function names that match the specified regex pattern to be called with the new operator.
            • "capIsNewExceptions" allows specified uppercase-started function names to be called without the new operator.
            • "capIsNewExceptionPattern" allows any uppercase-started function names that match the specified regex pattern to be called without the new operator.
            • "properties": true (default) enables checks on object properties
            • "properties": false disables checks on object properties

            newIsCap

            Examples of incorrect code for this rule with the default { "newIsCap": true } option:

            /*eslint new-cap: ["error", { "newIsCap": true }]*/
            
            var friend = new person();

            Examples of correct code for this rule with the default { "newIsCap": true } option:

            /*eslint new-cap: ["error", { "newIsCap": true }]*/
            
            var friend = new Person();

            Examples of correct code for this rule with the { "newIsCap": false } option:

            /*eslint new-cap: ["error", { "newIsCap": false }]*/
            
            var friend = new person();

            capIsNew

            Examples of incorrect code for this rule with the default { "capIsNew": true } option:

            /*eslint new-cap: ["error", { "capIsNew": true }]*/
            
            var colleague = Person();

            Examples of correct code for this rule with the default { "capIsNew": true } option:

            /*eslint new-cap: ["error", { "capIsNew": true }]*/
            
            var colleague = new Person();

            Examples of correct code for this rule with the { "capIsNew": false } option:

            /*eslint new-cap: ["error", { "capIsNew": false }]*/
            
            var colleague = Person();

            newIsCapExceptions

            Examples of additional correct code for this rule with the { "newIsCapExceptions": ["events"] } option:

            /*eslint new-cap: ["error", { "newIsCapExceptions": ["events"] }]*/
            
            var events = require('events');
            
            var emitter = new events();

            newIsCapExceptionPattern

            Examples of additional correct code for this rule with the { "newIsCapExceptionPattern": "^person\.." } option:

            /*eslint new-cap: ["error", { "newIsCapExceptionPattern": "^person\.." }]*/
            
            var friend = new person.acquaintance();
            var bestFriend = new person.friend();

            capIsNewExceptions

            Examples of additional correct code for this rule with the { "capIsNewExceptions": ["Person"] } option:

            /*eslint new-cap: ["error", { "capIsNewExceptions": ["Person"] }]*/
            
            function foo(arg) {
                return Person(arg);
            }

            capIsNewExceptionPattern

            Examples of additional correct code for this rule with the { "capIsNewExceptionPattern": "^Person\.." } option:

            /*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^Person\.." }]*/
            
            var friend = person.Acquaintance();
            var bestFriend = person.Friend();

            properties

            Examples of incorrect code for this rule with the default { "properties": true } option:

            /*eslint new-cap: ["error", { "properties": true }]*/
            
            var friend = new person.acquaintance();

            Examples of correct code for this rule with the default { "properties": true } option:

            /*eslint new-cap: ["error", { "properties": true }]*/
            
            var friend = new person.Acquaintance();

            Examples of correct code for this rule with the { "properties": false } option:

            /*eslint new-cap: ["error", { "properties": false }]*/
            
            var friend = new person.acquaintance();

            When Not To Use It

            If you have conventions that don't require an uppercase letter for constructors, or don't require capitalized functions be only used as constructors, turn this rule off. Source: http://eslint.org/docs/rules/

            Expected indentation of 10 spaces but found 12.
            Open

                        if (typeof this.libs[lib].settings !== 'undefined') {

            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

            Unnecessarily quoted property 'medium' found.
            Open

                  'medium'      : new MediaQuery('.foundation-mq-medium'),

            require quotes around object literal property names (quote-props)

            Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

            var object1 = {
                property: true
            };
            
            var object2 = {
                "property": true
            };

            In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

            There are, however, some occasions when you must use quotes:

            1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
            2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

            Another example where quotes do matter is when using numeric literals as property keys:

            var object = {
                1e2: 1,
                100: 2
            };

            This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

            Rule Details

            This rule requires quotes around object literal property names.

            Options

            This rule has two options, a string option and an object option.

            String option:

            • "always" (default) requires quotes around all object literal property names
            • "as-needed" disallows quotes around object literal property names that are not strictly required
            • "consistent" enforces a consistent quote style requires quotes around object literal property names
            • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

            Object option:

            • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
            • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

            always

            Examples of incorrect code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            
            var object = {
                foo: "bar",
                baz: 42,
                "qux-lorem": true
            };

            Examples of correct code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            as-needed

            Examples of incorrect code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            
            var object = {
                "a": 0,
                "0": 0,
                "true": 0,
                "null": 0
            };

            Examples of correct code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "a-b": 0,
                "0x0": 0,
                "1e2": 0
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42,
                true: 0,
                0: 0,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            consistent

            Examples of incorrect code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                baz: 42
            };

            Examples of correct code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };
            
            var object3 = {
                foo: 'bar',
                baz: 42
            };

            consistent-as-needed

            Examples of incorrect code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };

            Examples of correct code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42
            };

            keywords

            Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
            
            var x = {
                while: 1,
                volatile: "foo"
            };

            Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
            
            var x = {
                "prop": 1,
                "bar": "foo"
            };

            unnecessary

            Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
            
            var x = {
                "while": 1,
                "foo": "bar"  // Would normally have caused a warning
            };

            numbers

            Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

            /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
            
            var x = {
                100: 1
            }

            When Not To Use It

            If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

            Further Reading

            A function with a name starting with an uppercase letter should only be used as a constructor.
            Open

                return this.query || (this.query = S(this.selector).css('font-family').replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ''));

            require constructor names to begin with a capital letter (new-cap)

            The new operator in JavaScript creates a new instance of a particular type of object. That type of object is represented by a constructor function. Since constructor functions are just regular functions, the only defining characteristic is that new is being used as part of the call. Native JavaScript functions begin with an uppercase letter to distinguish those functions that are to be used as constructors from functions that are not. Many style guides recommend following this pattern to more easily determine which functions are to be used as constructors.

            var friend = new Person();

            Rule Details

            This rule requires constructor names to begin with a capital letter. Certain built-in identifiers are exempt from this rule. These identifiers are:

            • Array
            • Boolean
            • Date
            • Error
            • Function
            • Number
            • Object
            • RegExp
            • String
            • Symbol

            Examples of correct code for this rule:

            /*eslint new-cap: "error"*/
            
            function foo(arg) {
                return Boolean(arg);
            }

            Options

            This rule has an object option:

            • "newIsCap": true (default) requires all new operators to be called with uppercase-started functions.
            • "newIsCap": false allows new operators to be called with lowercase-started or uppercase-started functions.
            • "capIsNew": true (default) requires all uppercase-started functions to be called with new operators.
            • "capIsNew": false allows uppercase-started functions to be called without new operators.
            • "newIsCapExceptions" allows specified lowercase-started function names to be called with the new operator.
            • "newIsCapExceptionPattern" allows any lowercase-started function names that match the specified regex pattern to be called with the new operator.
            • "capIsNewExceptions" allows specified uppercase-started function names to be called without the new operator.
            • "capIsNewExceptionPattern" allows any uppercase-started function names that match the specified regex pattern to be called without the new operator.
            • "properties": true (default) enables checks on object properties
            • "properties": false disables checks on object properties

            newIsCap

            Examples of incorrect code for this rule with the default { "newIsCap": true } option:

            /*eslint new-cap: ["error", { "newIsCap": true }]*/
            
            var friend = new person();

            Examples of correct code for this rule with the default { "newIsCap": true } option:

            /*eslint new-cap: ["error", { "newIsCap": true }]*/
            
            var friend = new Person();

            Examples of correct code for this rule with the { "newIsCap": false } option:

            /*eslint new-cap: ["error", { "newIsCap": false }]*/
            
            var friend = new person();

            capIsNew

            Examples of incorrect code for this rule with the default { "capIsNew": true } option:

            /*eslint new-cap: ["error", { "capIsNew": true }]*/
            
            var colleague = Person();

            Examples of correct code for this rule with the default { "capIsNew": true } option:

            /*eslint new-cap: ["error", { "capIsNew": true }]*/
            
            var colleague = new Person();

            Examples of correct code for this rule with the { "capIsNew": false } option:

            /*eslint new-cap: ["error", { "capIsNew": false }]*/
            
            var colleague = Person();

            newIsCapExceptions

            Examples of additional correct code for this rule with the { "newIsCapExceptions": ["events"] } option:

            /*eslint new-cap: ["error", { "newIsCapExceptions": ["events"] }]*/
            
            var events = require('events');
            
            var emitter = new events();

            newIsCapExceptionPattern

            Examples of additional correct code for this rule with the { "newIsCapExceptionPattern": "^person\.." } option:

            /*eslint new-cap: ["error", { "newIsCapExceptionPattern": "^person\.." }]*/
            
            var friend = new person.acquaintance();
            var bestFriend = new person.friend();

            capIsNewExceptions

            Examples of additional correct code for this rule with the { "capIsNewExceptions": ["Person"] } option:

            /*eslint new-cap: ["error", { "capIsNewExceptions": ["Person"] }]*/
            
            function foo(arg) {
                return Person(arg);
            }

            capIsNewExceptionPattern

            Examples of additional correct code for this rule with the { "capIsNewExceptionPattern": "^Person\.." } option:

            /*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^Person\.." }]*/
            
            var friend = person.Acquaintance();
            var bestFriend = person.Friend();

            properties

            Examples of incorrect code for this rule with the default { "properties": true } option:

            /*eslint new-cap: ["error", { "properties": true }]*/
            
            var friend = new person.acquaintance();

            Examples of correct code for this rule with the default { "properties": true } option:

            /*eslint new-cap: ["error", { "properties": true }]*/
            
            var friend = new person.Acquaintance();

            Examples of correct code for this rule with the { "properties": false } option:

            /*eslint new-cap: ["error", { "properties": false }]*/
            
            var friend = new person.acquaintance();

            When Not To Use It

            If you have conventions that don't require an uppercase letter for constructors, or don't require capitalized functions be only used as constructors, turn this rule off. Source: http://eslint.org/docs/rules/

            Unnecessarily quoted property 'xxlarge' found.
            Open

                  'xxlarge'     : new MediaQuery('.foundation-mq-xxlarge')

            require quotes around object literal property names (quote-props)

            Object literal property names can be defined in two ways: using literals or using strings. For example, these two objects are equivalent:

            var object1 = {
                property: true
            };
            
            var object2 = {
                "property": true
            };

            In many cases, it doesn't matter if you choose to use an identifier instead of a string or vice-versa. Even so, you might decide to enforce a consistent style in your code.

            There are, however, some occasions when you must use quotes:

            1. If you are using an ECMAScript 3 JavaScript engine (such as IE8) and you want to use a keyword (such as if) as a property name. This restriction was removed in ECMAScript 5.
            2. You want to use a non-identifier character in your property name, such as having a property with a space like "one two".

            Another example where quotes do matter is when using numeric literals as property keys:

            var object = {
                1e2: 1,
                100: 2
            };

            This may look alright at first sight, but this code in fact throws a syntax error in ECMAScript 5 strict mode. This happens because 1e2 and 100 are coerced into strings before getting used as the property name. Both String(1e2) and String(100) happen to be equal to "100", which causes the "Duplicate data property in object literal not allowed in strict mode" error. Issues like that can be tricky to debug, so some prefer to require quotes around all property names.

            Rule Details

            This rule requires quotes around object literal property names.

            Options

            This rule has two options, a string option and an object option.

            String option:

            • "always" (default) requires quotes around all object literal property names
            • "as-needed" disallows quotes around object literal property names that are not strictly required
            • "consistent" enforces a consistent quote style requires quotes around object literal property names
            • "consistent-as-needed" requires quotes around all object literal property names if any name strictly requires quotes, otherwise disallows quotes around object property names

            Object option:

            • "keywords": true requires quotes around language keywords used as object property names (only applies when using as-needed or consistent-as-needed)
            • "unnecessary": true (default) disallows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "unnecessary": false allows quotes around object literal property names that are not strictly required (only applies when using as-needed)
            • "numbers": true requires quotes around numbers used as object property names (only applies when using as-needed)

            always

            Examples of incorrect code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            
            var object = {
                foo: "bar",
                baz: 42,
                "qux-lorem": true
            };

            Examples of correct code for this rule with the default "always" option:

            /*eslint quote-props: ["error", "always"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            as-needed

            Examples of incorrect code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            
            var object = {
                "a": 0,
                "0": 0,
                "true": 0,
                "null": 0
            };

            Examples of correct code for this rule with the "as-needed" option:

            /*eslint quote-props: ["error", "as-needed"]*/
            /*eslint-env es6*/
            
            var object1 = {
                "a-b": 0,
                "0x0": 0,
                "1e2": 0
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42,
                true: 0,
                0: 0,
                'qux-lorem': true
            };
            
            var object3 = {
                foo() {
                    return;
                }
            };

            consistent

            Examples of incorrect code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                baz: 42
            };

            Examples of correct code for this rule with the "consistent" option:

            /*eslint quote-props: ["error", "consistent"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };
            
            var object3 = {
                foo: 'bar',
                baz: 42
            };

            consistent-as-needed

            Examples of incorrect code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                foo: "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                'foo': 'bar',
                'baz': 42
            };

            Examples of correct code for this rule with the "consistent-as-needed" option:

            /*eslint quote-props: ["error", "consistent-as-needed"]*/
            
            var object1 = {
                "foo": "bar",
                "baz": 42,
                "qux-lorem": true
            };
            
            var object2 = {
                foo: 'bar',
                baz: 42
            };

            keywords

            Examples of additional incorrect code for this rule with the "as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true }]*/
            
            var x = {
                while: 1,
                volatile: "foo"
            };

            Examples of additional incorrect code for this rule with the "consistent-as-needed", { "keywords": true } options:

            /*eslint quote-props: ["error", "consistent-as-needed", { "keywords": true }]*/
            
            var x = {
                "prop": 1,
                "bar": "foo"
            };

            unnecessary

            Examples of additional correct code for this rule with the "as-needed", { "unnecessary": false } options:

            /*eslint quote-props: ["error", "as-needed", { "keywords": true, "unnecessary": false }]*/
            
            var x = {
                "while": 1,
                "foo": "bar"  // Would normally have caused a warning
            };

            numbers

            Examples of additional incorrect code for this rule with the "as-needed", { "numbers": true } options:

            /*eslint quote-props: ["error", "as-needed", { "numbers": true }]*/
            
            var x = {
                100: 1
            }

            When Not To Use It

            If you don't care if property names are consistently wrapped in quotes or not, and you don't target legacy ES3 environments, turn this rule off.

            Further Reading

            Identifier 'cached_options' is not in camel case.
            Open

                      return cached_options;

            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/

            Identifier 'media_class' is not in camel case.
            Open

                  register_media : function (media, media_class) {

            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/

            'FastClick' is not defined.
            Open

                    FastClick.attach(document.body);

            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/

            'Foundation' is not defined.
            Open

                          var namespace = Foundation.global.namespace;

            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/

            'Foundation' is not defined.
            Open

                    return this.match(Foundation.media_queries.large);

            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/

            'Foundation' is not defined.
            Open

                    return this.match(Foundation.media_queries.medium);

            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/

            Unnecessary semicolon.
            Open

                        };

            disallow unnecessary semicolons (no-extra-semi)

            Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

            Rule Details

            This rule disallows unnecessary semicolons.

            Examples of incorrect code for this rule:

            /*eslint no-extra-semi: "error"*/
            
            var x = 5;;
            
            function foo() {
                // code
            };

            Examples of correct code for this rule:

            /*eslint no-extra-semi: "error"*/
            
            var x = 5;
            
            var foo = function() {
                // code
            };

            When Not To Use It

            If you intentionally use extra semicolons then you can disable this rule.

            Related Rules

            'Foundation' is not defined.
            Open

                        Foundation.stylesheet.insertRule('@media ' +

            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/

            'Foundation' is not defined.
            Open

                      var query = Foundation.media_queries[media];

            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/

            Unnecessary semicolon.
            Open

                      };

            disallow unnecessary semicolons (no-extra-semi)

            Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

            Rule Details

            This rule disallows unnecessary semicolons.

            Examples of incorrect code for this rule:

            /*eslint no-extra-semi: "error"*/
            
            var x = 5;;
            
            function foo() {
                // code
            };

            Examples of correct code for this rule:

            /*eslint no-extra-semi: "error"*/
            
            var x = 5;
            
            var foo = function() {
                // code
            };

            When Not To Use It

            If you intentionally use extra semicolons then you can disable this rule.

            Related Rules

            'Foundation' is not defined.
            Open

                    return this.match(Foundation.media_queries.small);

            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/

            'Foundation' is not defined.
            Open

                    if (media === undefined && Foundation.stylesheet) {

            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/

            'Foundation' is not defined.
            Open

                      Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);

            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/

            'Foundation' is not defined.
            Open

                    return this.match(Foundation.media_queries.xxlarge);

            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/

            'Foundation' is not defined.
            Open

                      Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));

            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/

            'Foundation' is not defined.
            Open

                    if (Foundation.media_queries[media] === undefined) {

            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/

            'Foundation' is not defined.
            Open

                    return this.match(Foundation.media_queries.xlarge);

            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/

            'Foundation' is not defined.
            Open

                          Foundation.media_queries[media] + '{ ' + rule + ' }', Foundation.stylesheet.cssRules.length);

            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/

            'Foundation' is not defined.
            Open

                          Foundation.media_queries[media] + '{ ' + rule + ' }', Foundation.stylesheet.cssRules.length);

            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/

            'Foundation' is not defined.
            Open

                  Foundation.init.apply(Foundation, [this].concat(args));

            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/

            'Foundation' is not defined.
            Open

                  Foundation.init.apply(Foundation, [this].concat(args));

            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/

            'Foundation' is not defined.
            Open

                      Foundation.stylesheet.insertRule(rule, Foundation.stylesheet.cssRules.length);

            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/

            There are no issues that match your filters.

            Category
            Status