.eslintrc.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /* eslint-disable id-blacklist */
  2. module.exports = {
  3. ignorePatterns: [
  4. '*.js', '/bin'
  5. ],
  6. env: {
  7. browser: true,
  8. es6: true,
  9. node: true,
  10. },
  11. extends: [
  12. 'plugin:@typescript-eslint/recommended-requiring-type-checking',
  13. ],
  14. parser: '@typescript-eslint/parser',
  15. parserOptions: {
  16. project: 'tsconfig.json',
  17. sourceType: 'module',
  18. },
  19. plugins: [
  20. 'eslint-plugin-import',
  21. 'eslint-plugin-prefer-arrow',
  22. '@typescript-eslint',
  23. ],
  24. rules: {
  25. '@typescript-eslint/adjacent-overload-signatures': 'error',
  26. '@typescript-eslint/array-type': [
  27. 'error',
  28. {
  29. default: 'array',
  30. },
  31. ],
  32. '@typescript-eslint/ban-types': [
  33. 'error',
  34. {
  35. types: {
  36. Object: {
  37. message: 'Avoid using the `Object` type. Did you mean `object`?',
  38. },
  39. Function: {
  40. message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.',
  41. },
  42. Boolean: {
  43. message: 'Avoid using the `Boolean` type. Did you mean `boolean`?',
  44. },
  45. Number: {
  46. message: 'Avoid using the `Number` type. Did you mean `number`?',
  47. },
  48. String: {
  49. message: 'Avoid using the `String` type. Did you mean `string`?',
  50. },
  51. Symbol: {
  52. message: 'Avoid using the `Symbol` type. Did you mean `symbol`?',
  53. },
  54. },
  55. },
  56. ],
  57. '@typescript-eslint/consistent-type-assertions': 'error',
  58. '@typescript-eslint/dot-notation': 'error',
  59. '@typescript-eslint/indent': [
  60. 'error',
  61. 2,
  62. ],
  63. '@typescript-eslint/member-delimiter-style': [
  64. 'error',
  65. {
  66. multiline: {
  67. delimiter: 'comma',
  68. requireLast: true,
  69. },
  70. singleline: {
  71. delimiter: 'comma',
  72. requireLast: false,
  73. },
  74. overrides: {
  75. interface: {
  76. multiline: {
  77. delimiter: 'semi',
  78. requireLast: true,
  79. },
  80. },
  81. },
  82. },
  83. ],
  84. '@typescript-eslint/member-ordering': 'off',
  85. '@typescript-eslint/restrict-template-expressions': 'off',
  86. '@typescript-eslint/no-empty-function': 'error',
  87. '@typescript-eslint/no-empty-interface': 'error',
  88. '@typescript-eslint/no-explicit-any': 'off',
  89. '@typescript-eslint/no-floating-promises': 'off',
  90. '@typescript-eslint/no-misused-new': 'error',
  91. '@typescript-eslint/no-namespace': 'error',
  92. '@typescript-eslint/no-parameter-properties': 'off',
  93. '@typescript-eslint/no-require-imports': 'error',
  94. '@typescript-eslint/no-shadow': [
  95. 'error',
  96. {
  97. hoist: 'all',
  98. },
  99. ],
  100. '@typescript-eslint/no-unused-expressions': 'error',
  101. '@typescript-eslint/no-use-before-define': 'off',
  102. '@typescript-eslint/no-var-requires': 'off',
  103. '@typescript-eslint/prefer-for-of': 'error',
  104. '@typescript-eslint/prefer-function-type': 'error',
  105. '@typescript-eslint/prefer-namespace-keyword': 'error',
  106. '@typescript-eslint/quotes': [
  107. 'error',
  108. 'single',
  109. {
  110. avoidEscape: true,
  111. },
  112. ],
  113. '@typescript-eslint/semi': [
  114. 'error',
  115. 'always',
  116. ],
  117. '@typescript-eslint/triple-slash-reference': [
  118. 'error',
  119. {
  120. path: 'always',
  121. types: 'prefer-import',
  122. lib: 'always',
  123. },
  124. ],
  125. '@typescript-eslint/type-annotation-spacing': 'off',
  126. '@typescript-eslint/unified-signatures': 'error',
  127. 'arrow-body-style': [
  128. 'error',
  129. 'as-needed',
  130. ],
  131. 'arrow-parens': [
  132. 'off',
  133. 'always',
  134. ],
  135. 'brace-style': [
  136. 'error',
  137. '1tbs',
  138. {
  139. allowSingleLine: true,
  140. },
  141. ],
  142. 'capitalized-comments': [
  143. 'error',
  144. 'never',
  145. ],
  146. 'comma-dangle': [
  147. 'error',
  148. {
  149. objects: 'always-multiline',
  150. arrays: 'always-multiline',
  151. functions: 'never',
  152. imports: 'never',
  153. exports: 'never',
  154. },
  155. ],
  156. complexity: 'off',
  157. 'constructor-super': 'error',
  158. curly: [
  159. 'error',
  160. 'multi-line',
  161. ],
  162. 'eol-last': 'error',
  163. eqeqeq: [
  164. 'error',
  165. 'smart',
  166. ],
  167. 'guard-for-in': 'error',
  168. 'id-blacklist': [
  169. 'error',
  170. 'any',
  171. 'Number',
  172. 'number',
  173. 'String',
  174. 'string',
  175. 'Boolean',
  176. 'boolean',
  177. 'Undefined',
  178. 'undefined',
  179. ],
  180. 'id-match': 'error',
  181. 'import/order': 'error',
  182. 'linebreak-style': [
  183. 'error',
  184. 'unix',
  185. ],
  186. 'max-classes-per-file': 'off',
  187. 'max-len': 'off',
  188. 'new-parens': 'off',
  189. 'newline-per-chained-call': 'off',
  190. 'no-bitwise': 'off',
  191. 'no-caller': 'error',
  192. 'no-cond-assign': 'error',
  193. 'no-console': 'off',
  194. 'no-debugger': 'error',
  195. 'no-empty': 'error',
  196. 'no-eval': 'error',
  197. 'no-extra-semi': 'off',
  198. 'no-fallthrough': 'off',
  199. 'no-invalid-this': 'off',
  200. 'no-irregular-whitespace': 'error',
  201. 'no-multiple-empty-lines': 'error',
  202. 'no-new-wrappers': 'error',
  203. 'no-throw-literal': 'error',
  204. 'no-trailing-spaces': 'off',
  205. 'no-undef-init': 'error',
  206. 'no-underscore-dangle': 'off',
  207. 'no-unsafe-finally': 'error',
  208. 'no-unused-labels': 'error',
  209. 'no-var': 'error',
  210. 'object-shorthand': 'error',
  211. 'one-var': [
  212. 'error',
  213. 'never',
  214. ],
  215. 'prefer-arrow/prefer-arrow-functions': 'error',
  216. 'prefer-const': 'error',
  217. 'quote-props': [
  218. 'error',
  219. 'as-needed',
  220. ],
  221. radix: 'error',
  222. 'react/jsx-curly-spacing': 'off',
  223. 'react/jsx-equals-spacing': 'off',
  224. 'react/jsx-tag-spacing': [
  225. 'off',
  226. {
  227. afterOpening: 'allow',
  228. closingSlash: 'allow',
  229. },
  230. ],
  231. 'react/jsx-wrap-multilines': 'off',
  232. 'space-before-function-paren': [
  233. 'error',
  234. {
  235. anonymous: 'always',
  236. named: 'never',
  237. asyncArrow: 'always',
  238. },
  239. ],
  240. 'space-in-parens': [
  241. 'error',
  242. 'never',
  243. ],
  244. 'use-isnan': 'error',
  245. 'valid-typeof': 'off',
  246. },
  247. };