{
  "root": true,
  "parser": "babel-eslint",
  "env": {
    "jasmine": true,
    "jest": true,
    "node": true,
  },
  "globals": {},
  "plugins": [
    "filenames",
    "header",
    "lodash",
    "markdown",
    "new-with-error",
    "node",
    "security",

    // FIXME: Reactivate when there are less false positives and when speed is
    // improved.
    // "spellcheck",
  ],
  "rules": {
    /*
     * Mandatory code style rules.
     */

    "camelcase": [
      "error",
      {"properties": "never"},
    ],
    "comma-spacing": "error",
    "consistent-this": [
      "error",
      "self",
    ],
    "curly": [
      "error",
      "all",
    ],
    "dot-notation": "error",
    "eol-last": "error",
    "func-names": "error",
    "id-length": [
      "error",
      {
        "exceptions": [
          "_",
          "__",
          "cb",
          "db",
          "e",
          "fs",
          "i",
          "j",
          "k",
        ],
        "max": 40,
        "min": 3,
        "properties": "never",
      },
    ],
    "indent": [
      "error",
      2,
      {
        "CallExpression": {
          "arguments": 1,
        },
        "FunctionDeclaration": {
          "body": 1,
          "parameters": 1,
        },
        "FunctionExpression": {
          "body": 1,
          "parameters": 1,
        },
        "MemberExpression": 0,
        "SwitchCase": 1,
        "VariableDeclarator": 2,
      },
    ],
    "key-spacing": "error",
    "keyword-spacing": "error",
    "max-lines": [
      "error",
      {"max": 500},
    ],
    "max-statements-per-line": [
      "error",
      {"max": 2},
    ],
    "newline-before-return": "error",
    "no-irregular-whitespace": "error",
    "no-lone-blocks": "error",
    "no-magic-numbers": [
      "warn",
      {
        "ignore": [0, 1],
        "ignoreArrayIndexes": true,
      },
    ],

    // Allow multiple spaces for variable declaration. (alignement)
    "no-multi-spaces": [
      "error",
      {
        "exceptions": {
          "VariableDeclarator": true,
        },
      },
    ],
    "no-multi-str": "error",
    "no-tabs": "error",
    "no-trailing-spaces": "error",
    "no-undef-init": "error",
    "no-unneeded-ternary": "error",
    "no-useless-call": "error",
    "no-useless-computed-key": "error",
    "no-useless-escape": "error",
    "no-useless-rename": "error",
    "no-whitespace-before-property": "error",
    "object-property-newline": [
      "error",
      {"allowMultiplePropertiesPerLine": true},
    ],
    "one-var": [
      "error",
      "never",
    ],
    "quotes": "error",
    "rest-spread-spacing": "error",
    "semi": "error",
    "semi-spacing": "error",
    "space-infix-ops": "error",
    "space-unary-ops": "error",


    /*
     * Rules to help finding possible errors.
     */

    "array-callback-return": "error",
    "callback-return": "error",
    "node/exports-style": [
      "error",
      "module.exports",
      {
        "allowBatchAssign": true,
      },
    ],
    "eqeqeq": "error",
    "func-name-matching": "error",
    "func-style": [
      "error",
      "declaration",
      {"allowArrowFunctions": true},
    ],
    "guard-for-in": "error",
    "max-depth": [
      "warn",
      15,
    ],
    "max-nested-callbacks": [
      "warn",
      5,
    ],
    "max-params": [
      "warn",
      8,
    ],
    "new-cap": "error",
    "new-parens": "error",
    "new-with-error/new-with-error": "error",
    "no-alert": "error",
    "no-array-constructor": "error",
    "no-bitwise": [
      "error",
      {
        "allow": ["~"],
        "int32Hint": true,
      },
    ],
    "no-caller": "error",
    "no-case-declarations": "error",
    "no-catch-shadow": "error",

    // Disallows the use of console.* (Prefer `@auex/logger`)
    "no-console": "error",
    "default-case": [
      "error",
      {"commentPattern": "No default."},
    ],
    "no-else-return": "error",
    "no-eq-null": "error",
    "no-empty": "error",
    "no-empty-function": "error",
    "no-eval": "error",
    "no-extend-native": "error",
    "no-extra-bind": "error",
    "no-extra-parens": [
      "error",
      "functions",
    ],
    "no-fallthrough": [
      "error",
      {"commentPattern": "Fallthrough."},
    ],
    "no-global-assign": "error",
    "no-implied-eval": "error",
    "no-iterator": "error",
    "no-label-var": "error",
    "no-labels": "error",
    "no-lonely-if": "error",
    "no-loop-func": "error",
    "no-mixed-operators": "error",
    "no-new": "error",
    "no-new-func": "error",
    "no-new-object": "error",
    "no-new-wrappers": "error",
    "no-proto": "error",
    "no-return-assign": "error",
    "no-restricted-globals": [
      "error",
      "event",
    ],
    "no-script-url": "error",
    "no-self-assign": [
      "error",
      {"props": true},
    ],
    "no-sequences": "error",
    "no-shadow": [
      "error",
      {
        "allow": [
          "callback",
          "cb",
          "err",
          "next",
          "res",
          "response",
          "result",
          "self",
        ],
      },
    ],
    "no-shadow-restricted-names": "error",
    "no-octal-escape": "error",
    "no-self-compare": "error",
    "no-throw-literal": "error",
    "no-undef": [
      "error",
      {"typeof": true},
    ],
    "no-underscore-dangle": [
      "error",
      {
        "allow": [
          "__",
          "__BUILDING__",
          "__DEV__",
          "__PRERENDER__",
          "__PROD__",
          "__STAGE__",
          "__TEST_ENV__",
          "__TESTING__",
          "_id",
        ],
        "allowAfterThis": true,
      },
    ],
    "no-unexpected-multiline": "error",
    "no-unmodified-loop-condition": "error",
    "no-unsafe-finally": "error",
    "no-unsafe-negation": "error",
    "no-unused-expressions": [
      "error",
      {
        "allowShortCircuit": true,
        "allowTernary": true,
      },
    ],
    "no-unused-vars": [
      "error",
      {"args": "after-used"},
    ],
    "no-use-before-define": [
      "error",
      "nofunc",
    ],
    "no-useless-return": "error",
    "no-with": "error",
    "unicode-bom": "error",
    "valid-jsdoc": [
      "error",
      {
        "matchDescription": "^[A-Z](?:.|\\s)*?[.]$",
        "requireParamDescription": false,
        "requireReturn": false,
        "requireReturnType": false,
      },
    ],
    "valid-typeof": [
      "error",
      {"requireStringLiterals": true},
    ],
    "wrap-iife": [
      "error",
      "outside",
      {"functionPrototypeMethods": true},
    ],
    "yoda": [
      "error",
      "never",
      {"exceptRange": true},
    ],

    /*
     * Lo-Dash.
     */

    "lodash/callback-binding": "error",
    "lodash/chain-style": "error",
    "lodash/chaining": [
      "error",
      "always",
      2,
    ],
    "lodash/collection-method-value": "error",
    "lodash/collection-return": "error",
    "lodash/consistent-compose": "error",
    "lodash/identity-shorthand": "error",
    "lodash/matches-prop-shorthand": "error",
    "lodash/matches-shorthand": "error",
    "lodash/no-commit": "error",
    "lodash/no-double-unwrap": "error",
    "lodash/no-extra-args": "error",
    "lodash/path-style": "error",
    "lodash/prefer-compact": "error",
    "lodash/prefer-filter": "error",
    "lodash/prefer-flat-map": "error",
    "lodash/prefer-get": "error",
    "lodash/prefer-includes": "error",
    "lodash/prefer-invoke-map": "error",
    "lodash/prefer-is-nil": "error",
    "lodash/prefer-map": "error",
    "lodash/prefer-matches": "error",
    "lodash/prefer-noop": "error",
    "lodash/prefer-over-quantifier": "error",
    "lodash/prefer-reject": "error",
    "lodash/prefer-startswith": "error",
    "lodash/prefer-thru": "error",
    "lodash/prefer-times": "error",
    "lodash/prefer-wrapper-method": "error",
    "lodash/preferred-alias": "error",
    "lodash/prop-shorthand": "error",
    "lodash/unwrap": "error",

    /*
     * Node.
     */

    "node/no-deprecated-api": "error",
    "node/shebang": "error",

    /*
     * Security.
     */

    "security/detect-buffer-noassert": "error",
    "security/detect-child-process": "error",
    "security/detect-disable-mustache-escape": "error",
    "security/detect-eval-with-expression": "error",

    // FIXME: Reactivate once
    // https://github.com/nodesecurity/eslint-plugin-security/pull/6
    // is published.
    // "security/detect-no-csrf-before-method-override": "error",
    "security/detect-non-literal-fs-filename": "error",
    "security/detect-non-literal-regexp": "error",
    "security/detect-possible-timing-attacks": "error",
    "security/detect-pseudoRandomBytes": "error",
    "security/detect-unsafe-regex": "error",

    /*
     * Files.
     */

    "header/header": [
      "warn",
      "block",
      [
        "*",
        " * Copyright 2013-present, Novivia, Inc.",
        " * All rights reserved.",
        " ",
      ],
    ],
    "filenames/match-exported": "error",
    "filenames/match-regex": [
      "error",
      "^[A-Z]?([a-z0-9]+)([A-Z][a-z0-9]+)*(JSON)?$",
    ],

    /*
     * Spellchecking.
     */

    // FIXME: Reactivate when there are less false positives and when speed is
    // improved.
    // "spellcheck/spell-checker": [
    //   "warn",
    //   {
    //     "comments": true,
    //     "strings": false,
    //     "identifiers": false,
    //     "lang": "en_US",
    //     "skipWords": [
    //       "FIXME:",
    //       "TODO:",
    //       "globals",
    //       "ie",
    //       "js",
    //       "webpack",
    //     ],
    //     "skipIfMatch": [
    //       "https?://[^s]*",

    //       // See https://github.com/aotaduy/eslint-plugin-spellcheck/issues/7
    //       "(\\s|^)\\w+'t(\\s|$)",

    //       // See https://github.com/aotaduy/eslint-plugin-spellcheck/issues/8
    //       "(\\s|^)\\d+(st|nd|rd|th)(\\s|$)",

    //       // See https://github.com/aotaduy/eslint-plugin-spellcheck/issues/9
    //       "^[-\\w]+\/[-\\w\\.]+$",
    //     ],
    //   },
    // ],
  },
}
