errors.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. 'use strict';
  2. module.exports = {
  3. rules: {
  4. /**
  5. * require trailing commas in multiline object literals
  6. * @see http://eslint.org/docs/rules/comma-dangle
  7. * @see http://blog.hotoo.me/post/trailing-commas
  8. */
  9. 'comma-dangle': [ 'error', {
  10. arrays: 'always-multiline',
  11. objects: 'always-multiline',
  12. imports: 'always-multiline',
  13. exports: 'always-multiline',
  14. functions: 'never',
  15. }],
  16. /**
  17. * @see http://eslint.org/docs/rules/no-cond-assign
  18. * @example
  19. *
  20. * ```js
  21. * // Incorrect
  22. * function setHeight(someNode) {
  23. * do {
  24. * someNode.height = '100px';
  25. * } while (someNode = someNode.parentNode);
  26. * }
  27. *
  28. * // correct
  29. * function setHeight(someNode) {
  30. * do {
  31. * someNode.height = '100px';
  32. * } while ((someNode = someNode.parentNode));
  33. * }
  34. * ```
  35. */
  36. 'no-cond-assign': [ 'error', 'except-parens' ],
  37. /**
  38. * This rule warns the usage of `console`
  39. * @see http://eslint.org/docs/rules/no-console
  40. */
  41. 'no-console': 'off',
  42. /**
  43. * disallow use of constant expressions in conditions
  44. * @see http://eslint.org/docs/rules/no-constant-condition
  45. */
  46. 'no-constant-condition': 'error',
  47. /**
  48. * disallow control characters in regular expressions
  49. * @see http://eslint.org/docs/rules/no-control-regex
  50. */
  51. 'no-control-regex': 'error',
  52. /**
  53. * disallow use of debugger
  54. * @see http://eslint.org/docs/rules/no-debugger
  55. */
  56. 'no-debugger': 'error',
  57. /**
  58. * disallow duplicate arguments in functions
  59. * @see http://eslint.org/docs/rules/no-dupe-args
  60. */
  61. 'no-dupe-args': 'error',
  62. /**
  63. * disallow duplicate keys when creating object literals
  64. * @see http://eslint.org/docs/rules/no-dupe-keys
  65. */
  66. 'no-dupe-keys': 'error',
  67. /**
  68. * disallow a duplicate case label.
  69. * @see http://eslint.org/docs/rules/no-duplicate-case
  70. */
  71. 'no-duplicate-case': 'error',
  72. /**
  73. * disallow empty statements
  74. * @see http://eslint.org/docs/rules/no-empty
  75. */
  76. 'no-empty': 'error',
  77. /**
  78. * disallow the use of empty character classes in regular expressions
  79. * @see http://eslint.org/docs/rules/no-empty-character-class
  80. */
  81. 'no-empty-character-class': 'error',
  82. /**
  83. * disallow assigning to the exception in a catch block
  84. * @see http://eslint.org/docs/rules/no-ex-assign
  85. */
  86. 'no-ex-assign': 'error',
  87. /**
  88. * disallow double-negation boolean casts in a boolean context
  89. * @see http://eslint.org/docs/rules/no-extra-boolean-cast
  90. */
  91. 'no-extra-boolean-cast': 'error',
  92. /**
  93. * disallow unnecessary parentheses
  94. *
  95. * @example
  96. *
  97. * // allow
  98. * module.export = app => (
  99. * // some js docs
  100. * class Test extends app.Proxy {
  101. *
  102. * }
  103. * );
  104. *
  105. * @see http://eslint.org/docs/rules/no-extra-parens
  106. */
  107. 'no-extra-parens': [ 'error', 'functions' ],
  108. /**
  109. * disallow unnecessary semicolons
  110. * @see http://eslint.org/docs/rules/no-extra-semi
  111. */
  112. 'no-extra-semi': 'error',
  113. /**
  114. * disallow overwriting functions written as function declarations
  115. * @see http://eslint.org/docs/rules/no-func-assign
  116. */
  117. 'no-func-assign': 'error',
  118. /**
  119. * disallow function declarations in nested blocks
  120. * @see http://eslint.org/docs/rules/no-inner-declarations
  121. */
  122. 'no-inner-declarations': [ 'error', 'functions' ],
  123. /**
  124. * disallow invalid regular expression strings in the RegExp constructor
  125. * @see http://eslint.org/docs/rules/no-invalid-regexp
  126. */
  127. 'no-invalid-regexp': 'error',
  128. /**
  129. * disallow irregular whitespace outside of strings and comments
  130. * @see http://eslint.org/docs/rules/no-irregular-whitespace
  131. */
  132. 'no-irregular-whitespace': 'error',
  133. /**
  134. * disallow negation of the left operand of an in expression
  135. * @see http://eslint.org/docs/rules/no-negated-in-lhs
  136. */
  137. 'no-negated-in-lhs': 'error',
  138. /**
  139. * disallow the use of object properties of the global object (Math and JSON) as functions
  140. * @see http://eslint.org/docs/rules/no-obj-calls
  141. */
  142. 'no-obj-calls': 'error',
  143. /**
  144. * disallow multiple spaces in a regular expression literal
  145. * @see http://eslint.org/docs/rules/no-regex-spaces
  146. */
  147. 'no-regex-spaces': 'error',
  148. /**
  149. * disallow sparse arrays
  150. * @see http://eslint.org/docs/rules/no-sparse-arrays
  151. */
  152. 'no-sparse-arrays': 'error',
  153. /**
  154. * Avoid code that looks like two expressions but is actually one
  155. * @see http://eslint.org/docs/rules/no-unexpected-multiline
  156. */
  157. 'no-unexpected-multiline': 'off',
  158. /**
  159. * disallow unreachable statements after a return, throw, continue, or break statement
  160. * @see http://eslint.org/docs/rules/no-unreachable
  161. */
  162. 'no-unreachable': 'error',
  163. /**
  164. * disallow return/throw/break/continue inside finally blocks
  165. * @see http://eslint.org/docs/rules/no-unsafe-finally
  166. */
  167. 'no-unsafe-finally': 'error',
  168. /**
  169. * disallow comparisons with the value NaN
  170. * @see http://eslint.org/docs/rules/use-isnan
  171. */
  172. 'use-isnan': 'error',
  173. /**
  174. * This rule has deprecated https://eslint.org/blog/2018/11/jsdoc-end-of-life
  175. * ensure JSDoc comments are valid
  176. * @see http://eslint.org/docs/rules/valid-jsdoc
  177. */
  178. 'valid-jsdoc': 'off',
  179. /**
  180. * Doesn't enforce comparing typeof expressions against valid strings
  181. * @see http://eslint.org/docs/rules/valid-typeof
  182. */
  183. 'valid-typeof': 'off',
  184. },
  185. };