.eslintrc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. {
  2. "env": {
  3. "amd": false,
  4. "browser": false,
  5. "es6": false,
  6. "jasmine": false,
  7. "jquery": false,
  8. "meteor": false,
  9. "mocha": false,
  10. "node": true,
  11. "prototypejs": false,
  12. "shelljs": false
  13. },
  14. "ecmaFeatures": {
  15. "arrowFunctions": false,
  16. "binaryLiterals": false,
  17. "blockBindings": false,
  18. "classes": false,
  19. "defaultParams": false,
  20. "destructuring": false,
  21. "forOf": false,
  22. "generators": false,
  23. "globalReturn": false,
  24. "jsx": false,
  25. "modules": false,
  26. "objectLiteralComputedProperties": false,
  27. "objectLiteralDuplicateProperties": false,
  28. "objectLiteralShorthandMethods": false,
  29. "objectLiteralShorthandProperties": false,
  30. "octalLiterals": false,
  31. "regexUFlag": false,
  32. "regexYFlag": false,
  33. "spread": false,
  34. "superInFunctions": false,
  35. "templateStrings": false,
  36. "unicodeCodePointEscapes": false
  37. },
  38. "rules": {
  39. // Possible Errors
  40. "comma-dangle": [2, "never"], // disallow or enforce trailing commas
  41. "no-cond-assign": [2, "except-parens"], // disallow assignment in conditional expressions
  42. "no-console": 0, // disallow use of console (off by default in the node environment)
  43. "no-constant-condition": 2, // disallow use of constant expressions in conditions
  44. "no-control-regex": 2, // disallow control characters in regular expressions
  45. "no-debugger": 2, // disallow use of debugger
  46. "no-dupe-args": 2, // disallow duplicate arguments in functions
  47. "no-dupe-keys": 2, // disallow duplicate keys when creating object literals
  48. "no-duplicate-case": 2, // disallow a duplicate case label.
  49. "no-empty": 2, // disallow empty statements
  50. "no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions
  51. "no-ex-assign": 2, // disallow assigning to the exception in a catch block
  52. "no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context
  53. "no-extra-parens": 2, // disallow unnecessary parentheses (off by default)
  54. "no-extra-semi": 2, // disallow unnecessary semicolons
  55. "no-func-assign": 2, // disallow overwriting functions written as function declarations
  56. "no-inner-declarations": [2, "both"], // disallow function or variable declarations in nested blocks
  57. "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
  58. "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
  59. "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
  60. "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
  61. "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
  62. "no-reserved-keys": 0, // disallow reserved words being used as object literal keys (off by default)
  63. "no-sparse-arrays": 2, // disallow sparse arrays
  64. "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
  65. "use-isnan": 2, // disallow comparisons with the value NaN
  66. "valid-jsdoc": 0, // ensure JSDoc comments are valid (off by default)
  67. "valid-typeof": 2, // ensure that the results of typeof are compared against a valid string
  68. // Best Practices
  69. "block-scoped-var": 0, // treat var statements as if they were block scoped (off by default)
  70. "complexity": 2, // specify the maximum cyclomatic complexity allowed in a program (off by default)
  71. "consistent-return": 2, // require return statements to either always or never specify values
  72. "curly": [2, "multi-line"], // specify curly brace conventions for all control statements
  73. "default-case": 2, // require default case in switch statements (off by default)
  74. "dot-notation": [2, { // encourages use of dot notation whenever possible
  75. "allowKeywords": true,
  76. "allowPattern": "^[a-z]+([_-][a-z]+)+$"
  77. }],
  78. "eqeqeq": 2, // require the use of === and !==
  79. "guard-for-in": 2, // make sure for-in loops have an if statement (off by default)
  80. "no-alert": 2, // disallow the use of alert, confirm, and prompt
  81. "no-caller": 2, // disallow use of arguments.caller or arguments.callee
  82. "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default)
  83. "no-else-return": 2, // disallow else after a return in an if (off by default)
  84. "no-empty-label": 2, // disallow use of labels for anything other then loops and switches
  85. "no-eq-null": 0, // disallow comparisons to null without a type-checking operator (off by default)
  86. "no-eval": 2, // disallow use of eval()
  87. "no-extend-native": 2, // disallow adding to native types
  88. "no-extra-bind": 2, // disallow unnecessary function binding
  89. "no-fallthrough": 2, // disallow fallthrough of case statements
  90. "no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
  91. "no-implied-eval": 2, // disallow use of eval()-like methods
  92. "no-iterator": 2, // disallow usage of __iterator__ property
  93. "no-labels": 0, // disallow use of labeled statements
  94. "no-lone-blocks": 2, // disallow unnecessary nested blocks
  95. "no-loop-func": 2, // disallow creation of functions within loops
  96. "no-multi-spaces": 2, // disallow use of multiple spaces
  97. "no-multi-str": 2, // disallow use of multiline strings
  98. "no-native-reassign": 2, // disallow reassignments of native objects
  99. "no-new": 2, // disallow use of new operator when not part of the assignment or comparison
  100. "no-new-func": 2, // disallow use of new operator for Function object
  101. "no-new-wrappers": 2, // disallow creating new instances of String, Number, and Boolean
  102. "no-octal": 2, // disallow use of octal literals
  103. "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
  104. "no-param-reassign": 0, // disallow reassignment of function parameters (off by default)
  105. "no-process-env": 2, // disallow use of process.env (off by default)
  106. "no-proto": 2, // disallow usage of __proto__ property
  107. "no-redeclare": 2, // disallow declaring the same variable more then once
  108. "no-return-assign": 0, // disallow use of assignment in return statement
  109. "no-script-url": 0, // disallow use of javascript: urls.
  110. "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
  111. "no-sequences": 2, // disallow use of comma operator
  112. "no-throw-literal": 2, // restrict what can be thrown as an exception (off by default)
  113. "no-unused-expressions": 2, // disallow usage of expressions in statement position
  114. "no-void": 2, // disallow use of void operator (off by default)
  115. "no-warning-comments": 1, // disallow usage of configurable warning terms in comments": 0, // e.g. TODO or FIXME (off by default)
  116. "no-with": 2, // disallow use of the with statement
  117. "radix": 0, // require use of the second argument for parseInt() (off by default)
  118. "vars-on-top": 0, // require to declare all vars on top of their containing scope (off by default)
  119. "wrap-iife": [2, "inside"], // require immediate function invocation to be wrapped in parentheses (off by default)
  120. "yoda": 0, // require or disallow Yoda conditions
  121. // Strict mode
  122. "strict": 0, // controls location of Use Strict Directives
  123. // Variables
  124. "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)
  125. "no-delete-var": 2, // disallow deletion of variables
  126. "no-label-var": 2, // disallow labels that share a name with a variable
  127. "no-shadow": 2, // disallow declaration of variables already declared in the outer scope
  128. "no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments
  129. "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
  130. "no-undef-init": 2, // disallow use of undefined when initializing variables
  131. "no-undefined": 0, // disallow use of undefined variable (off by default)
  132. "no-unused-vars": [2, { // disallow declaration of variables that are not used in the code
  133. "vars": "all",
  134. "args": "after-used"
  135. }],
  136. "no-use-before-define": 2, // disallow use of variables before they are defined
  137. // Node.js
  138. "handle-callback-err": 2, // enforce error handling in callbacks (off by default) (on by default in the node environment)
  139. "no-mixed-requires": 0, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment)
  140. "no-new-require": 2, // disallow use of new operator with the require function (off by default) (on by default in the node environment)
  141. "no-path-concat": 2, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment)
  142. "no-process-exit": 0, // disallow process.exit() (on by default in the node environment)
  143. "no-restricted-modules": 0, // restrict usage of specified node modules (off by default)
  144. "no-sync": 0, // disallow use of synchronous methods (off by default)
  145. // Style
  146. /* "indent": [2, "tab", { // this option sets a specific tab width for your code (off by default) */
  147. /* "SwitchCase": 1 */
  148. /* }], */
  149. "brace-style": [2, "stroustrup"], // enforce one true brace style (off by default)
  150. "camelcase": [2, { // require camel case names
  151. "properties": "always"
  152. }],
  153. "comma-spacing": [2, { // enforce spacing before and after comma
  154. "before": false,
  155. "after": true
  156. }],
  157. "comma-style": [2, "last"], // enforce one true comma style (off by default)
  158. "consistent-this": [0, "self"], // enforce consistent naming when capturing the current execution context (off by default)
  159. "eol-last": 2, // enforce newline at the end of file, with no multiple empty lines
  160. "func-names": 0, // require function expressions to have a name (off by default)
  161. "func-style": [2, "declaration"], // enforce use of function declarations or expressions (off by default)
  162. "key-spacing": [2, { // enforce spacing between keys and values in object literal properties
  163. "beforeColon": false,
  164. "afterColon": true
  165. }],
  166. "max-nested-callbacks": [2, 4], // specify the maximum depth callbacks can be nested (off by default)
  167. "new-cap": 2, // require a capital letter for constructors
  168. "new-parens": 2, // disallow the omission of parentheses when invoking a constructor with no arguments
  169. "newline-after-var": [2, "always"], // allow/disallow an empty newline after var statement (off by default)
  170. "no-array-constructor": 2, // disallow use of the Array constructor
  171. "no-continue": 0, // disallow use of the continue statement (off by default)
  172. "no-inline-comments": 0, // disallow comments inline after code (off by default)
  173. "no-lonely-if": 2, // disallow if as the only statement in an else block (off by default)
  174. "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
  175. "no-multiple-empty-lines": [2, { // disallow multiple empty lines (off by default)
  176. "max": 1
  177. }],
  178. "no-nested-ternary": 2, // disallow nested ternary expressions (off by default)
  179. "no-new-object": 2, // disallow use of the Object constructor
  180. "no-spaced-func": 2, // disallow space between function identifier and application
  181. "no-ternary": 0, // disallow the use of ternary operators (off by default)
  182. "no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines
  183. "no-underscore-dangle": 0, // disallow dangling underscores in identifiers
  184. "one-var": [2, "always"], // allow or disallow one variable declaration per function (off by default)
  185. "operator-assignment": [2, "always"], // require assignment operator shorthand where possible or prohibit it entirely (off by default)
  186. "operator-linebreak": [2, "before"], // enforce operators to be placed before or after line breaks (off by default)
  187. "padded-blocks": [2, "never"], // enforce padding within blocks (off by default)
  188. "quote-props": [2, "as-needed"], // require quotes around object literal property names (off by default)
  189. "quotes": [2, "single", "avoid-escape"], // specify whether backticks, double or single quotes should be used
  190. "semi": [2, "always"], // require or disallow use of semicolons instead of ASI
  191. "semi-spacing": [2, { // enforce spacing before and after semicolons
  192. "before": false,
  193. "after": true
  194. }],
  195. "sort-vars": 0, // sort variables within the same declaration block (off by default)
  196. "space-after-keywords": [2, "always"], // require a space after certain keywords (off by default)
  197. "space-before-blocks": [2, "always"], // require or disallow space before blocks (off by default)
  198. "space-before-function-paren": [2, { // require or disallow space before function opening parenthesis (off by default)
  199. "anonymous": "always",
  200. "named": "never"
  201. }],
  202. "space-in-brackets": 0, // require or disallow spaces inside brackets (off by default)
  203. "space-in-parens": [2, "never"], // require or disallow spaces inside parentheses (off by default)
  204. "space-infix-ops": 2, // require spaces around operators
  205. "space-return-throw-case": 2, // require a space after return, throw, and case
  206. "space-unary-ops": [1, { // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
  207. "words": true,
  208. "nonwords": false
  209. }],
  210. "spaced-comment": 0, // require or disallow a whitespace (space or tab) beginning a comment
  211. "wrap-regex": 2, // require regex literals to be wrapped in parentheses (off by default)
  212. // ES6
  213. "no-var": 0, // require let or const instead of var (off by default)
  214. "object-shorthand": 0, // require method and property shorthand syntax for object literals (off by default)
  215. // Complexity
  216. "max-depth": [2, 7], // specify the maximum depth that blocks can be nested (off by default)
  217. "max-len": [2, 120, 4], // specify the maximum length of a line in your program (off by default)
  218. "max-params": [2, 5], // limits the number of parameters that can be used in the function declaration. (off by default)
  219. "max-statements": [2, 50] // specify the maximum number of statement allowed in a function (off by default)
  220. }
  221. }