{
    "root": true,
    "extends": "eslint-config-forgerock",
    "env": {
        "amd": true,
        "browser": true
    },
    "rules": {
        /*
         * --------------------------------------------------------------------------------
         * ERROR RULES
         *
         * These are rules we're sure about. They will cause the build to fail.
         * --------------------------------------------------------------------------------
         */

        /**
         * Disallow spacing at the start or end of an array literal.
         *
         * var a = [ 1, 2 ]; # bad
         *
         * var a = [1, 2]; # good
         */
        "array-bracket-spacing": [2, "never"],
        /**
         * Require spacing inside of single line blocks.
         *
         * function () {return 1;} # bad
         *
         * function () { return 1; } # good
         */
        "block-spacing": [2, "always"],
        /**
         * Enforce the "one true brace style".
         *
         * if (a) # bad
         * {
         * }
         * else {
         * }
         *
         * if (a) { # good
         * } else {
         * }
         */
        "brace-style": [2, "1tbs", { "allowSingleLine": true }],
        /**
         * Camel cased variable names.
         *
         * var apples_and_pears # bad
         * var fruit {
         *     apple_and_pears: true
         * }
         *
         * var applesAndPears # good
         * var fruit {
         *     appleAndPears: true
         * }
         */
        "camelcase": [2, {
            "properties": "always"
        }],
        /**
         * Require a space after a comma and disallow a space before a comma.
         *
         * var a = [1,2 ,3]; # bad
         *
         * var a = [1, 2, 3]; # good
         */
        "comma-spacing": [2, {
            "before": false,
            "after": true
        }],
        /**
         * Require commas to appear at the end of lines instead of the start.
         *
         * var a = 3 # bad
         *   , b = 4;
         *
         * var a = 3, # good
         *     b = 4;
         */
        "comma-style": 2,
        /**
         * Require newline before the dot if a property access is split over lines.
         *
         * var a = universe. # bad
         *     galaxy;
         *
         * var a = universe # good
         *     .galaxy;
         */
        "dot-location": [2, "property"],
        /**
         * Require a line break at the end of a file.
         */
        "eol-last": 2,
        /**
         * Make sure for-in loops check hasOwnProperty.
         *
         * for (key in foo) { # bad
         *   doSomething(key);
         * }
         *
         * for (key in foo) { # good
         *   if (Object.prototype.hasOwnProperty.call(foo, key)) {
         *     doSomething(key);
         *   }
         * }
         */
        "guard-for-in": 2,
        /**
         * 4 space indent.
         *
         * function() { # bad
         * ··var apples
         *
         * function() { # good
         * ····var apples
         */
        "indent": [2, 4, {
            /**
             * One level indent on switch cases.
             *
             * switch(value) { # bad
             * case "apples":
             *
             * switch(value) { # good
             * ····case "apples":
             */
            "SwitchCase": 1,
            /**
             * One level indent on variable declarations.
             *
             * var apples, { # bad
             * pears
             *
             * var apples, { # good
             * ····pears
             */
            "VariableDeclarator": 1
        }],
        /**
         * Maximum line length of 120 characters.
         */
        "max-len": [2, 120, 4],
        /**
         * Require a capital letter for constructors.
         *
         * var f = Foo(); # bad
         *
         * var f = new Foo(); # good
         */
        "new-cap": [2, {
            "capIsNew": false
        }],
        /**
         * Require parentheses when invoking a constructor with no arguments.
         *
         * var a = new A; # bad
         *
         * var a = new A(); # good
         */
        "new-parens": 2,
        /**
         * Disallow the use of alert, confirm, and prompt.
         *
         * alert("hi"); # bad
         */
        "no-alert": 2,
        /**
         * Disallow use of bitwise operators.
         *
         * var x = y | z; # bad
         */
        "no-bitwise": 2,
        /**
         * Disallow the exception parameter name being the same as a variable in the outer scope.
         *
         * var err = "x"; # bad
         * try {} catch (err) {}
         */
        "no-catch-shadow": 2,
        /**
         * Disallow use of the continue statement.
         *
         * while (i < 10) { # bad
         *   if (i % 2 === 0) {
         *     continue;
         *   }
         * }
         */
        "no-continue": 2,
        /**
         * Disallow a duplicate case label.
         *
         * switch (foo) { # bad
         *   case 1:
         *   case 1:
         *     i++;
         * }
         */
        "no-duplicate-case": 2,
        /**
         * Disallow the use of empty character classes in regular expressions.
         *
         * var foo = /^abc[]/; # bad
         */
        "no-empty-character-class": 2,
        /**
         * Disallow adding to native types.
         *
         * Object.prototype.extra = 55; # bad
         */
        "no-extend-native": 2,
        /**
         * Disallow invalid regular expression strings in the RegExp constructor.
         *
         * RegExp('[') # bad
         */
        "no-invalid-regexp": 2,
        /**
         * Disallow whitespace characters that aren't spaces or tabs outside of strings and comments.
         *
         * function <NBSP>thing() { # bad
         */
        "no-irregular-whitespace": 2,
        /**
         * Disallow use of labelled statements
         *
         * outer: # bad
         * while (true) {
         *   break outer;
         * }
         */
        "no-labels": 2,
        /**
         * Disallow if as the only statement in a else block.
         *
         * if (a) { # bad
         * } else {
         *   if (b) {
         *   }
         * }
         *
         * if (a) { # good
         * } else if (b) {
         * }
         */
        "no-lonely-if": 2,
        /**
         * Disallow mixed spaces and tabs for indentation.
         *
         * \t....var a = 3; # bad
         *
         * ........var a = 3; # good
         */
        "no-mixed-spaces-and-tabs": 2,
        /**
         * Disallow 3 or more consecutive empty lines.
         */
        "no-multiple-empty-lines": 2,
        /**
         * Multiple spaces not allowed.
         *
         * var fruit···=··"apples" # bad
         *
         * var fruit·=·"apples" # good
         */
        "no-multi-spaces": 2,
        /**
         * Disallow use of multiline strings.
         *
         * var x = "Line 1 \ # bad
         *          Line 2";
         *
         * var x = "Line 1" + # good
         *         "Line 2";
         */
        "no-multi-str": 2,
        /**
         * Disallow reassignments of native objects.
         *
         * Object = 3; # bad
         */
        "no-native-reassign": 2,
        /**
         * Disallow trailing whitespace at the end of lines.
         *
         * var a = 3;···· # bad
         */
        "no-trailing-spaces": 2,
        /**
         * Disallow declaration of variables that are not used in the code.
         */
        "no-unused-vars": 2,
        /**
         * Disallow use of the void operator.
         *
         * return void 0; # bad
         */
        "no-void": 2,
        /**
         * Spaces inside of curly braces.
         *
         * {apples: true} # bad
         *
         * { apples: true } # good
         */
        "object-curly-spacing": [2, "always"],
        /**
         * Require operators to appear at the end of lines if split across multple lines.
         *
         * var a = b # bad
         *     + c;
         *
         * var a = b + # good
         *     c;
         */
        "operator-linebreak": 2,
        /**
         * Double quotes for string literals. Single quotes allowed to avoid escaping
         *
         * var string = 'this is a string' # bad
         *
         * var string = "this is a string" # good
         * var string = 'this is a "string"' # good
         */
        "quotes": [2, "double", "avoid-escape"],
        /**
         * Require a space or newline after a semicolon and not before.
         *
         * for (i = 0 ;i < 10;i++) { # bad
         *
         * for (i = 0; i < 10; i++) { # good
         */
        "semi-spacing": [2, {
            "before": false,
            "after": true
        }],
        /**
         * Space required after keywords.
         *
         * if(fruit) { # bad
         * }else{
         *
         * if (fruit) { # good. Space before else is not enforced but recommended
         * } else {
         */
        "space-after-keywords": [2, "always"],
        /**
         * Space required before opening block curly brace.
         *
         * if (fruit){ # bad
         *     function fruit(){}
         *
         * if (fruit) { # good
         *     function fruit() {}
         */
        "space-before-blocks": [2, "always"],
        /**
         * Space required before function parenthesis.
         *
         * function() { # bad
         *
         * function () { # good
         */
        "space-before-function-paren": [2, "always"],
        /**
         * Require a space before certain keywords.
         *
         * if (a) { # bad
         * }else {
         * }
         *
         * if (a) { # good
         * } else {
         * }
         */
        "space-before-keywords": 2,
        /**
         * Spaces not allowed in parentheses.
         *
         * fruit( "apple" ) # bad
         *
         * fruit("apple") # good
         */
        "space-in-parens": [2, "never"],
        /**
         * Spaces required around infix operators
         *
         * var numOfApples = 1+2-3 # bad
         *
         * var numOfApples = 1 + 2 - 3 # good
         */
        "space-infix-ops": [2, {
            "int32Hint": false
        }],
        /**
         * Disallow a space after a unary operator.
         *
         * var a = ! b; # bad
         *
         * var a = !b; # good
         */
        "space-unary-ops": 2,
        /**
         * Validates that JSDoc is syntactically correct.
         */
        "valid-jsdoc": [2, {
            "prefer": {
                /**
                 * Prefer using returns over return
                 *
                 * @return {int} The number of apples. # bad
                 *
                 * @returns {int} The number of apples. # good
                 */
                "return": "returns"
            },
            /**
             * If there is no return statement, a @returns annotation is not required.
             */
            "requireReturn": false
        }],
        /**
         * Disallow comparisons with the constant on the left-hand side.
         *
         * var a = (2 === b); # bad
         *
         * var a = (b === 2); # good
         */
        "yoda": [2, "never"]

        /*
         * --------------------------------------------------------------------------------
         * WARNING RULES
         *
         * These are rules that we want to turn into errors but can't yet because there are
         * too many violations. As we fix the violations, we will transition them into
         * error rules.
         * --------------------------------------------------------------------------------
         */

        /*
         * --------------------------------------------------------------------------------
         * DISABLED RULES
         *
         * Rules we'd like to enable but can't for various reasons.
         * --------------------------------------------------------------------------------
         */


        /**
         * Disallow the use of console.
         *
         * TODO: Need an abstraction for logging before we can enable this.
         */
        //"no-console": 0
        /**
         * Disallow reassignment of function parameters.
         *
         * function (a) { # bad
         *   a = 3;
         * }
         */
        //"no-param-reassign": 0
    }
}
