{ // http://eslint.org/docs/rules/ "parserOptions": { "ecmaVersion": 7, "sourceType": "module", "ecmaFeatures": { "arrowFunctions": true, "binaryLiterals": true, "blockBindings": true, "classes": true, "defaultParams": true, "destructuring": true, "forOf": true, "generators": true, "modules": true, "objectLiteralComputedProperties": true, "objectLiteralDuplicateProperties": true, "objectLiteralShorthandMethods": true, "objectLiteralShorthandProperties": true, "octalLiterals": true, "regexUFlag": true, "regexYFlag": true, "spread": true, "superInFunctions": true, "templateStrings": true, "unicodeCodePointEscapes": true, "globalReturn": true, "jsx": true, "legacyDecorators": true } }, "settings": { "import/extensions": [ ".js" ], "import/resolve": { "extensions": [ ".js" ] } }, "env": { "browser": false, // browser global variables "node": false, // Node.js global variables and Node.js-specific rules "amd": false, // defines require() and define() as global variables as per the amd spec "mocha": false, // adds all of the Mocha testing global variables "jasmine": false, // adds all of the Jasmine testing global variables for version 1.3 and 2.0 "phantomjs": false, // phantomjs global variables "jquery": false, // jquery global variables "prototypejs": false, // prototypejs global variables "shelljs": false, // shelljs global variables "es6": true // enable all ECMAScript 6 features except for modules }, "globals": { "By": true, "bean": true, "browser": true, "element": true, "expect": true, "global": true, "navigator": true, "protractor": true, "ReactTestUtils": true, "window": true, "$": true }, "plugins": [ "babel", "import" ], "parser": "babel-eslint", "rules": { ////////// Possible Errors ////////// "no-cond-assign": 2, // disallow assignment in conditional expressions "no-console": 2, // disallow use of console (off by default in the node environment) "no-constant-condition": 0, // disallow use of constant expressions in conditions "no-control-regex": 2, // disallow control characters in regular expressions "no-debugger": 2, // disallow use of debugger "no-dupe-args": 2, // disallow duplicate arguments in functions "no-dupe-keys": 2, // disallow duplicate keys when creating object literals "no-duplicate-case": 2, // disallow a duplicate case label "no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions "no-empty": 2, // disallow empty statements "no-ex-assign": 2, // disallow assigning to the exception in a catch block "no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context "no-extra-parens": [ "error", "all" ], // disallow unnecessary parentheses (off by default) "no-extra-semi": 2, // disallow unnecessary semicolons "no-func-assign": 2, // disallow overwriting functions written as function declarations "no-inner-declarations": 2, // disallow function or variable declarations in nested blocks "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions "no-prototype-builtins": 2, // disallow calling some Object.prototype methods directly on objects "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal "no-sparse-arrays": 2, // disallow sparse arrays "no-unexpected-multiline": 2, // Avoid code that looks like two expressions but is actually one (off by default) "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement "no-unsafe-finally": 2, // disallow control flow statements in finally blocks "use-isnan": 2, // disallow comparisons with the value NaN "valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default) "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string ////////// Best Practices ////////// "accessor-pairs": 0, // enforces getter/setter pairs in objects (off by default) "array-callback-return": 2, // enforce return statements in callbacks of array methods "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default) "complexity": [ "error", 4 ], // specify the maximum cyclomatic complexity allowed in a program (off by default) "consistent-return": 2, // require return statements to either always or never specify values "curly": 2, // specify curly brace conventions for all control statements "default-case": 2, // require default case in switch statements (off by default) "dot-location": [ 2, "property" ], // enforces consistent newlines before or after dots (off by default) "dot-notation": 2, // encourages use of dot notation whenever possible "eqeqeq": 2, // require the use of === and !== "guard-for-in": 0, // make sure for-in loops have an if statement (off by default) "no-alert": 2, // disallow the use of alert, confirm, and prompt "no-caller": 2, // disallow use of arguments.caller or arguments.callee "no-case-declarations": 2, // disallow lexical declarations in case clauses "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default) "no-else-return": 2, // disallow else after a return in an if (off by default) "no-empty-function": 2, // disallow empty functions "no-empty-pattern": 2, // disallow empty destructuring patterns "no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default) "no-eval": 2, // disallow use of eval() "no-extend-native": 2, // disallow adding to native types "no-extra-bind": 2, // disallow unnecessary function binding "no-extra-label": 2, // disallow unnecessary labels "no-fallthrough": 2, // disallow fallthrough of case statements "no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default) "no-implicit-coercion": 2, // disallow shorthand type conversions "no-implicit-globals": 2, // disallow var and named function declarations in the global scope "no-implied-eval": 2, // disallow use of eval()-like methods "no-invalid-this": 0, // disallow this keywords outside of classes or class-like objects "no-iterator": 2, // disallow usage of __iterator__ property "no-labels": 2, // disallow use of labeled statements "no-lone-blocks": 2, // disallow unnecessary nested blocks "no-loop-func": 2, // disallow creation of functions within loops "no-magic-numbers": 0, // disallow magic numbers "no-multi-spaces": 2, // disallow use of multiple spaces "no-multi-str": 0, // disallow use of multiline strings "no-native-reassign": 2, // disallow reassignments of native objects "no-new-func": 2, // disallow use of new operator for Function object "no-new-wrappers": 2, // disallows creating new instances of String, Number, and Boolean "no-new": 2, // disallow use of new operator when not part of the assignment or comparison "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251"; "no-octal": 2, // disallow use of octal literals "no-param-reassign": 2, // disallow reassignment of function parameters (off by default) "no-proto": 2, // disallow usage of __proto__ property "no-redeclare": 2, // disallow declaring the same variable more then once "no-return-assign": 2, // disallow use of assignment in return statement "no-script-url": 2, // disallow use of javascript: urls "no-self-assign": 2, // disallow assignments where both sides are exactly the same "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default) "no-sequences": 2, // disallow use of comma operator "no-throw-literal": 2, // restrict what can be thrown as an exception (off by default) "no-unmodified-loop-condition": 2, // disallow unmodified loop conditions "no-unused-expressions": 2, // disallow usage of expressions in statement position "no-unused-labels": 2, // disallow unused labels "no-useless-call": 2, // disallow unnecessary calls to .call() and .apply() "no-useless-concat": 2, // disallow unnecessary concatenation of literals or template literals "no-useless-escape": 2, // disallow unnecessary escape characters "no-void": 2, // disallow use of void operator (off by default) "no-warning-comments": 2, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default) "no-with": 2, // disallow use of the with statement "radix": 2, // require use of the second argument for parseInt() (off by default) "sort-keys": [ 2, "asc", { "caseSensitive": false, "natural": false } ], "vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default) "wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default) "yoda": 2, // require or disallow Yoda conditions ////////// Strict Mode ////////// "strict": [ 2, "global" ], // controls location of Use Strict Directives ////////// Variables ////////// "init-declarations": 0, // require or disallow initialization in var declarations "no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment) "no-delete-var": 2, // disallow deletion of variables "no-label-var": 2, // disallow labels that share a name with a variable "no-restricted-globals": 2, // disallow specified global variables "no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments "no-shadow": 2, // disallow declaration of variables already declared in the outer scope "no-undef-init": 2, // disallow use of undefined when initializing variables "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block "no-undefined": 0, // disallow use of undefined variable (off by default) "no-unused-vars": 2, // disallow declaration of variables that are not used in the code "no-use-before-define": 2, // disallow use of variables before they are defined ////////// Node.js and CommonJs ////////// "callback-return": 2, // require return statements after callbacks "global-require": 2, // require require() calls to be placed at top-level module scope "handle-callback-err": 2, // enforces error handling in callbacks (off by default) (on by default in the node environment) "no-mixed-requires": 2, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment) "no-new-require": 2, // disallow use of new operator with the require function (off by default) (on by default in the node environment) "no-path-concat": 2, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment) "no-process-exit": 2, // disallow process.exit() (on by default in the node environment) "no-restricted-modules": 0, // restrict usage of specified node modules (off by default) "no-sync": 0, // disallow use of synchronous methods (off by default) ////////// Stylistic Issues ////////// "array-bracket-spacing": 2, // enforce spacing inside array brackets (off by default) "block-spacing": 2, // enforce consistent spacing inside single-line blocks "brace-style": [ 2, "1tbs" ], // enforce one true brace style (off by default) "camelcase": 2, // require camel case names "comma-dangle": 2, // disallow trailing commas in object literals "comma-spacing": [ 2, { "before": false, "after": true } ], // enforce spacing before and after comma "comma-style": [ 2, "last" ], // enforce one true comma style (off by default) "computed-property-spacing": [ 2, "never" ], // require or disallow padding inside computed properties (off by default) "consistent-this": 2, // enforces consistent naming when capturing the current execution context (off by default) "eol-last": 2, // enforce newline at the end of file, with no multiple empty lines "func-names": [ 2, "never" ], // require function expressions to have a name (off by default) "func-style": [ 2, "declaration", { "allowArrowFunctions": true } ], // enforces use of function declarations or expressions (off by default) "id-blacklist": 0, // disallow specified identifiers "id-length": [ "error", { "min": 2, "exceptions": [ "_", "$", "Q", "R", "RU" ] } ], // enforce minimum and maximum identifier lengths "id-match": 0, // require identifiers to match a specified regular expression "indent": [ "error", 4, { "SwitchCase": 1, "MemberExpression": 1 } ], // this option sets a specific tab width for your code (off by default) "jsx-quotes": [ 2, "prefer-double" ], // enforce the consistent use of either double or single quotes in JSX attributes "key-spacing": 2, // enforces spacing between keys and values in object literal properties "keyword-spacing": 2, // enforce consistent spacing before and after keywords "linebreak-style": 0, // disallow mixed 'LF' and 'CRLF' as linebreaks (off by default) "lines-around-comment": [ 2, { "beforeBlockComment": false } ], // enforces empty lines around comments (off by default) "max-depth": [ 2, { "max": 3 } ], // enforce a maximum depth that blocks can be nested "max-len": [ 2, { "code": 120 } ], // enforce a maximum line length "max-lines": [ 2, { "max": 300 } ], // enforce a maximum number of lines per file "max-nested-callbacks": 2, // specify the maximum depth callbacks can be nested (off by default) "max-params": 0, // enforce a maximum number of parameters in function definitions "max-statements-per-line": 2, // enforce a maximum number of statements allowed per line "max-statements": 0, // enforce a maximum number of statements allowed in function blocks "multiline-ternary": 0, // enforce newlines between operands of ternary expressions "new-cap": 2, // require a capital letter for constructors "new-parens": 2, // disallow the omission of parentheses when invoking a constructor with no arguments "newline-after-var": 0, // allow/disallow an empty newline after var statement (off by default) "newline-before-return": 0, // require an empty line before return statements "newline-per-chained-call": [ 2, { "ignoreChainWithDepth": 3 } ], // require a newline after each call in a method chain "no-array-constructor": 2, // disallow use of the Array constructor "no-bitwise": 2, // disallow bitwise operators "no-continue": 2, // disallow use of the continue statement (off by default) "no-inline-comments": 2, // disallow comments inline after code (off by default) "no-lonely-if": 2, // disallow if as the only statement in an else block (off by default) "no-mixed-operators": 0, // disallow mixed binary operators "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation "no-multiple-empty-lines": [ 2, { "max": 1 } ], // disallow multiple empty lines (off by default) "no-negated-condition": 0, // disallow negated conditions "no-nested-ternary": 2, // disallow nested ternary expressions (off by default) "no-new-object": 2, // disallow use of the Object constructor "no-plusplus": 2, // disallow the unary operators ++ and -- "no-restricted-syntax": 2, // disallow specified syntax "no-spaced-func": 2, // disallow space between function identifier and application "no-tabs": 0, // Disallow tabs in file "no-ternary": 0, // disallow the use of ternary operators (off by default) "no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines "no-underscore-dangle": 0, // disallow dangling underscores in identifiers "no-unneeded-ternary": 2, // disallow ternary operators when simpler alternatives exist "no-whitespace-before-property": 2, // disallow whitespace before properties "object-curly-newline": [ 2, { "multiline": true, "minProperties": 6 } ], // enforce consistent line breaks inside braces "object-curly-spacing": 2, // enforce consistent spacing inside braces "object-property-newline": [ 2, { "allowMultiplePropertiesPerLine": true } ], // enforce placing object properties on separate lines "one-var-declaration-per-line": 2, // require or disallow newlines around var declarations "one-var": 0, // allow just one var statement per function (off by default) "operator-assignment": 2, // require assignment operator shorthand where possible or prohibit it entirely (off by default) "operator-linebreak": [ 2, "after" ], // enforce operators to be placed before or after line breaks (off by default) "padded-blocks": [ 2, "never" ], // enforce padding within blocks (off by default) "quote-props": [ 2, "consistent-as-needed" ], // require quotes around object literal property names (off by default) "quotes": [ 2, "single", "avoid-escape" ], // specify whether double or single quotes should be used "require-jsdoc": 0, // require JSDoc comments "semi-spacing": 2, // enforce spacing before and after semicolons "semi": 2, // require or disallow use of semicolons instead of ASI "sort-vars": 0, // sort variables within the same declaration block (off by default) "space-before-blocks": 2, // require or disallow space before blocks (off by default) "space-before-function-paren": [ "error", { "anonymous": "always", "named": "never", "asyncArrow": "always" } ], // require or disallow space before function opening parenthesis (off by default) "space-in-parens": [ 2, "never" ], // require or disallow spaces inside parentheses (off by default) "space-infix-ops": 2, // require spaces around operators "space-unary-ops": 2, // require or disallow spaces before/after unary operators (words on by default, nonwords off by default) "spaced-comment": 2, // require or disallow a space immediately following the // or /* in a comment (off by default) "unicode-bom": 2, // require or disallow Unicode byte order mark (BOM) "wrap-regex": 2, // require regex literals to be wrapped in parentheses (off by default) ////////// ECMAScript 6 ////////// "arrow-body-style": [ 2, "as-needed" ], // require braces around arrow function bodies "arrow-parens": [ "error", "always" ], // Require parens in arrow function arguments "arrow-spacing": 2, // enforce consistent spacing before and after the arrow in arrow functions "constructor-super": 0, // verify super() callings in constructors (off by default) "generator-star-spacing": [ "error", { "before": false, "after": true } ], // enforce the spacing around the * in generator functions (off by default) "no-class-assign": 2, // disallow reassigning class members "no-confusing-arrow": 0, // disallow arrow functions where they could be confused with comparisons "no-const-assign": 2, // disallow reassigning const variables "no-dupe-class-members": 2, // disallow duplicate class members "no-duplicate-imports": 2, // disallow duplicate module imports "no-new-symbol": 2, // disallow new operators with the Symbol object "no-restricted-imports": 2, // disallow specified modules when loaded by import "no-this-before-super": 2, // disallow to use this/super before super() calling in constructors (off by default) "no-useless-computed-key": 2, // disallow unnecessary computed property keys in object literals "no-useless-constructor": 2, // disallow unnecessary constructors "no-useless-rename": 2, // disallow renaming import, export, and destructured assignments to the same name "no-var": 2, // require let or const instead of var (off by default) "object-shorthand": 0, // require method and property shorthand syntax for object literals (off by default) "prefer-arrow-callback": 2, // require arrow functions as callbacks "prefer-const": 2, // suggest using of const declaration for variables that are never modified after declared (off by default) "prefer-rest-params": 2, // require rest parameters instead of arguments "prefer-spread": 2, // require spread operators instead of .apply() "prefer-template": 2, // require template literals instead of string concatenation "require-yield": 2, // require generator functions to contain yield "rest-spread-spacing": 2, // enforce spacing between rest and spread operators and their expressions "sort-imports": 0, // enforce sorted import declarations within modules "template-curly-spacing": 2, // require or disallow spacing around embedded expressions of template strings "yield-star-spacing": [ 2, "after" ], // require or disallow spacing around the * in yield* expressions ////////// Import plugin /////////// // Static analysis "import/no-unresolved": [ 2, { "ignore": [ "^[~]" ] } ], // Ensure imports point to a file/module that can be resolved "import/named": 2, // Ensure named imports correspond to a named export in the remote file "import/default": 0, // Ensure a default export is present, given a default import "import/namespace": 2, // Ensure imported namespaces contain dereferenced properties as they are dereferenced "import/no-restricted-paths": 2, // Restrict which files can be imported in a given folder "import/no-absolute-path": 2, // Forbid import of modules using absolute paths "import/no-dynamic-require": 2, // Forbid require() calls with expressions "import/no-internal-modules": 0, // Use this rule to prevent importing the submodules of other modules "import/no-webpack-loader-syntax": 2, // Forbid Webpack loader syntax in imports // Helpful warnings "import/export": 2, // Report any invalid exports, i.e. re-export of the same name "import/no-named-as-default": 2, // Report use of exported name as identifier of default export "import/no-named-as-default-member": 0, // Report use of exported name as property of default export "import/no-deprecated": 2, // Report imported names marked with @deprecated documentation tag "import/no-extraneous-dependencies": 2, // Forbid the use of extraneous packages "import/no-mutable-exports": 2, // Forbid the use of mutable exports with var or let // Module systems "import/unambiguous": 0, // Warn if a module could be mistakenly parsed as a script by a consumer leveraging Unambiguous JavaScript Grammar to determine correct parsing goal. "import/no-commonjs": 2, // Report CommonJS require calls and module.exports or exports.* "import/no-amd": 2, // Report AMD require and define calls "import/no-nodejs-modules": 0, // No Node.js builtin modules // Style guide "import/first": 2, // Ensure all imports appear before other statements "import/no-duplicates": 2, // Report repeated import of the same module in multiple places "import/no-namespace": 0, // Report namespace imports "import/extensions": [ 2, "never", { "json": "always", "svg": "always" } ], // Ensure consistent use of file extension within the import path "import/order": 2, // Enforce a convention in module import order "import/newline-after-import": 2, // Enforce a newline after import statements "import/prefer-default-export": 0, // Prefer a default export if module exports a single name "import/max-dependencies": 0, // Forbid modules to have too many dependencies (import or require statements). "import/no-unassigned-import": 0, // With both CommonJS' require and the ES6 modules' import syntax, it is possible to import a module but not to use its result. This can be done explicitly by not assigning the module to as variable. "import/no-named-default": 0 // Reports use of a default export as a locally named import. } }