.eslintrc.js 5.9 KB

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