.eslintrc.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. {
  2. "env": {
  3. "jasmine": true,
  4. "node": true
  5. },
  6. "rules": {
  7. // Possible errors
  8. "for-direction": "error",
  9. "no-await-in-loop": "error",
  10. "no-compare-neg-zero": "error",
  11. "no-cond-assign": "error",
  12. "no-console": "off",
  13. "no-constant-condition": "off",
  14. "no-control-regex": "error",
  15. "no-debugger": "error",
  16. "no-dupe-args": "error",
  17. "no-dupe-keys": "error",
  18. "no-duplicate-case": "error",
  19. "no-empty": "error",
  20. "no-empty-character-class": "error",
  21. "no-ex-assign": "error",
  22. "no-extra-boolean-cast": "error",
  23. "no-extra-parens": "off",
  24. "no-extra-semi": "error",
  25. "no-func-assign": "error",
  26. "no-inner-declarations": ["error", "functions"],
  27. "no-invalid-regexp": "error",
  28. "no-irregular-whitespace": "error",
  29. "no-obj-calls": "error",
  30. "no-prototype-builtins": "error",
  31. "no-regex-spaces": "error",
  32. "no-sparse-arrays": "error",
  33. "no-template-curly-in-string": "error",
  34. "no-unexpected-multiline": "error",
  35. "no-unreachable": "error",
  36. "no-unsafe-finally": "error",
  37. "no-unsafe-negation": "error",
  38. "use-isnan": "error",
  39. "valid-jsdoc": "off",
  40. "valid-typeof": "error",
  41. // Best practices
  42. "accessor-pairs": "error",
  43. "array-callback-return": "error",
  44. "block-scoped-var": "off",
  45. "class-methods-use-this": "off",
  46. "complexity": "off", // TODO: enable
  47. "consistent-return": "error",
  48. "curly": ["error", "all"],
  49. "default-case": "error",
  50. "dot-location": ["error", "property"],
  51. "dot-notation": "error",
  52. "eqeqeq": ["error", "smart"],
  53. "guard-for-in": "error",
  54. "no-alert": "error",
  55. "no-caller": "error",
  56. "no-case-declarations": "error",
  57. "no-div-regex": "error",
  58. "no-else-return": "off",
  59. "no-empty-function": "error",
  60. "no-empty-pattern": "error",
  61. "no-eq-null": "error",
  62. "no-eval": "error",
  63. "no-extend-native": "error",
  64. "no-extra-bind": "error",
  65. "no-fallthrough": "off", // disabled due to bug in ESLint
  66. "no-floating-decimal": "error",
  67. "no-global-assign": "error",
  68. "no-implicit-coercion": "error",
  69. "no-implicit-globals": "error",
  70. "no-implied-eval": "error",
  71. "no-invalid-this": "error",
  72. "no-iterator": "error",
  73. "no-labels": "error",
  74. "no-lone-blocks": "error",
  75. "no-loop-func": "error",
  76. "no-magic-numbers": "off", // TODO: enable?
  77. "no-multi-spaces": "error",
  78. "no-multi-str": "error",
  79. "no-new": "error",
  80. "no-new-func": "error",
  81. "no-new-wrappers": "error",
  82. "no-octal": "error",
  83. "no-octal-escape": "error",
  84. "no-param-reassign": "off",
  85. "no-proto": "error",
  86. "no-redeclare": "error",
  87. "no-restricted-properties": "off",
  88. "no-return-assign": "error",
  89. "no-return-await": "error",
  90. "no-script-url": "error",
  91. "no-self-assign": "error",
  92. "no-self-compare": "error",
  93. "no-sequences": "error",
  94. "no-throw-literal": "error",
  95. "no-unmodified-loop-condition": "error",
  96. "no-unused-expressions": "error",
  97. "no-unused-labels": "error",
  98. "no-useless-call": "error",
  99. "no-useless-concat": "error",
  100. "no-useless-escape": "error",
  101. "no-useless-return": "error",
  102. "no-void": "error",
  103. "no-warning-comments": "off",
  104. "no-with": "error",
  105. "prefer-promise-reject-errors": "error",
  106. "radix": "error",
  107. "require-await": "error",
  108. "vars-on-top": "off", // TODO: enable
  109. "wrap-iife": ["error", "inside"],
  110. "yoda": "error",
  111. // Strict mode
  112. "strict": ["error", "global"],
  113. // Variables
  114. "init-declarations": "off",
  115. "no-catch-shadow": "off",
  116. "no-delete-var": "error",
  117. "no-label-var": "error",
  118. "no-restricted-globals": ["error", "app", "env"],
  119. "no-shadow": "error",
  120. "no-shadow-restricted-names": "error",
  121. "no-undef": "error",
  122. "no-undef-init": "error",
  123. "no-undefined": "off",
  124. "no-unused-vars": "error",
  125. "no-use-before-define": "error",
  126. // Node.js and CommonJS
  127. "callback-return": "off",
  128. "global-require": "off", // TODO: enable
  129. "handle-callback-err": "error",
  130. "no-buffer-constructor": "off", // TODO: enable when we stop supporting Node.js 4.x
  131. "no-mixed-requires": "error",
  132. "no-new-require": "error",
  133. "no-path-concat": "error",
  134. "no-process-env": "error",
  135. "no-process-exit": "error",
  136. "no-restricted-modules": "off",
  137. "no-sync": "off",
  138. // Stylistic issues
  139. "array-bracket-newline": "off",
  140. "array-bracket-spacing": ["error", "never"],
  141. "array-element-newline": "off",
  142. "block-spacing": ["error", "always"],
  143. "brace-style": "off", // TODO: enable with "stroustrup" (or "1tbsp" + lots of cleanup)
  144. "camelcase": "error",
  145. "capitalized-comments": "off",
  146. "comma-dangle": "error",
  147. "comma-spacing": ["error", {
  148. "before": false,
  149. "after": true
  150. }],
  151. "comma-style": ["error", "last"],
  152. "computed-property-spacing": ["error", "never"],
  153. "consistent-this": ["error", "self"],
  154. "eol-last": "error",
  155. "func-call-spacing": ["error", "never"],
  156. "func-name-matching": ["error", "always"],
  157. "func-names": "off",
  158. "func-style": "off",
  159. "id-blacklist": "off",
  160. "id-length": "off",
  161. "id-match": "off",
  162. "indent": ["error", 4, {
  163. "SwitchCase": 1
  164. }],
  165. "jsx-quotes": ["error", "prefer-double"],
  166. "key-spacing": ["error", {
  167. "beforeColon": false,
  168. "afterColon": true
  169. }],
  170. "keyword-spacing": ["error", {
  171. "before": true,
  172. "after": true
  173. }],
  174. "line-comment-position": "off",
  175. "linebreak-style": "off",
  176. "lines-around-comment": "off",
  177. "max-depth": "off", // TODO: enable
  178. "max-len": "off", // TODO: enable
  179. "max-lines": "off",
  180. "max-nested-callbacks": "off",
  181. "max-params": "off", // TODO: enable
  182. "max-statements": "off",
  183. "max-statements-per-line": "off",
  184. "multiline-ternary": "off",
  185. "new-cap": "error",
  186. "new-parens": "error",
  187. "newline-per-chained-call": "off", // TODO: enable
  188. "no-array-constructor": "error",
  189. "no-bitwise": "error",
  190. "no-continue": "off",
  191. "no-inline-comments": "off",
  192. "no-lonely-if": "error",
  193. "no-mixed-operators": "error",
  194. "no-mixed-spaces-and-tabs": "error",
  195. "no-multi-assign": "off",
  196. "no-multiple-empty-lines": ["error", {
  197. "max": 2
  198. }],
  199. "no-negated-condition": "off",
  200. "no-nested-ternary": "error",
  201. "no-new-object": "error",
  202. "no-plusplus": "off",
  203. "no-restricted-syntax": "off",
  204. "no-tabs": "error",
  205. "no-ternary": "off",
  206. "no-trailing-spaces": "error",
  207. "no-underscore-dangle": "off",
  208. "no-unneeded-ternary": "error",
  209. "no-whitespace-before-property": "error",
  210. "nonblock-statement-body-position": "off",
  211. "object-curly-newline": "off",
  212. "object-curly-spacing": "off",
  213. "object-property-newline": "error",
  214. "one-var": "off",
  215. "one-var-declaration-per-line": "error",
  216. "operator-assignment": "off",
  217. "operator-linebreak": ["error", "after"],
  218. "padded-blocks": ["error", "never"],
  219. "padding-line-between-statements": ["error", {
  220. "blankLine": "always",
  221. "prev": "*",
  222. "next": "return"
  223. }, {
  224. "blankLine": "always",
  225. "prev": ["const", "let", "var"],
  226. "next": "*"
  227. }, {
  228. "blankLine": "any",
  229. "prev": ["const", "let", "var"],
  230. "next": ["const", "let", "var"]
  231. }],
  232. "quote-props": "off",
  233. "quotes": ["error", "single", "avoid-escape"],
  234. "require-jsdoc": "off",
  235. "semi": ["error", "always"],
  236. "semi-spacing": "error",
  237. "semi-style": ["error", "last"],
  238. "sort-keys": "off",
  239. "sort-vars": "off", // TODO: enable?
  240. "space-before-blocks": ["error", "always"],
  241. "space-before-function-paren": ["error", "never"],
  242. "space-in-parens": "off", // TODO: enable?
  243. "space-infix-ops": "error",
  244. "space-unary-ops": "error",
  245. "spaced-comment": ["error", "always"],
  246. "switch-colon-spacing": ["error", {
  247. "after": true,
  248. "before": false
  249. }],
  250. "template-tag-spacing": ["error", "never"],
  251. "unicode-bom": ["error", "never"],
  252. "wrap-regex": "off",
  253. // ECMAScript 2015
  254. "arrow-body-style": ["error", "as-needed"],
  255. "arrow-parens": ["error", "always"],
  256. "arrow-spacing": ["error", {
  257. "before": true,
  258. "after": true
  259. }],
  260. "constructor-super": "error",
  261. "generator-star-spacing": ["error", {
  262. "before": true,
  263. "after": false
  264. }],
  265. "no-class-assign": "error",
  266. "no-confusing-arrow": "error",
  267. "no-const-assign": "error",
  268. "no-dupe-class-members": "error",
  269. "no-duplicate-imports": ["error", {
  270. "includeExports": true
  271. }],
  272. "no-new-symbol": "error",
  273. "no-restricted-imports": "off",
  274. "no-this-before-super": "error",
  275. "no-useless-computed-key": "error",
  276. "no-useless-constructor": "off",
  277. "no-useless-rename": "error",
  278. "no-var": "off",
  279. "object-shorthand": "off",
  280. "prefer-arrow-callback": "off",
  281. "prefer-const": "off",
  282. "prefer-destructuring": "off",
  283. "prefer-numeric-literals": "off",
  284. "prefer-rest-params": "off",
  285. "prefer-spread": "off",
  286. "prefer-template": "off",
  287. "require-yield": "error",
  288. "rest-spread-spacing": ["error", "never"],
  289. "sort-imports": "error",
  290. "symbol-description": "error",
  291. "template-curly-spacing": ["error", "never"],
  292. "yield-star-spacing": ["error", "before"]
  293. }
  294. }