.eslintrc.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. module.exports = {
  2. parserOptions: {
  3. parser: '@babel/eslint-parser',
  4. ecmaVersion: 8,
  5. sourceType: 'module'
  6. },
  7. extends: ['plugin:prettier/recommended', 'airbnb-base'],
  8. root: true,
  9. env: {
  10. node: true,
  11. jest: true
  12. },
  13. ignorePatterns: ['.eslintrc.js'],
  14. rules: {
  15. 'accessor-pairs': 2,
  16. 'arrow-spacing': [
  17. 2,
  18. {
  19. before: true,
  20. after: true
  21. }
  22. ],
  23. 'block-spacing': [2, 'always'],
  24. 'brace-style': [
  25. 2,
  26. '1tbs',
  27. {
  28. allowSingleLine: true
  29. }
  30. ],
  31. camelcase: [
  32. 0,
  33. {
  34. properties: 'always'
  35. }
  36. ],
  37. 'comma-dangle': [2, 'never'],
  38. 'comma-spacing': [
  39. 2,
  40. {
  41. before: false,
  42. after: true
  43. }
  44. ],
  45. 'comma-style': [2, 'last'],
  46. 'constructor-super': 2,
  47. curly: [2, 'multi-line'],
  48. 'dot-location': [2, 'property'],
  49. 'eol-last': 2,
  50. eqeqeq: ['error', 'always', { null: 'ignore' }],
  51. 'generator-star-spacing': [
  52. 2,
  53. {
  54. before: true,
  55. after: true
  56. }
  57. ],
  58. 'handle-callback-err': [2, '^(err|error)$'],
  59. indent: [
  60. 2,
  61. 2,
  62. {
  63. SwitchCase: 1
  64. }
  65. ],
  66. 'jsx-quotes': [2, 'prefer-single'],
  67. 'key-spacing': [
  68. 2,
  69. {
  70. beforeColon: false,
  71. afterColon: true
  72. }
  73. ],
  74. 'keyword-spacing': [
  75. 2,
  76. {
  77. before: true,
  78. after: true
  79. }
  80. ],
  81. 'new-cap': [
  82. 2,
  83. {
  84. newIsCap: true,
  85. capIsNew: false
  86. }
  87. ],
  88. 'new-parens': 2,
  89. 'no-array-constructor': 2,
  90. 'no-caller': 2,
  91. 'no-console': 'off',
  92. 'no-class-assign': 2,
  93. 'no-cond-assign': 2,
  94. 'no-const-assign': 2,
  95. 'no-control-regex': 0,
  96. 'no-delete-var': 2,
  97. 'no-dupe-args': 2,
  98. 'no-dupe-class-members': 2,
  99. 'no-dupe-keys': 2,
  100. 'no-duplicate-case': 2,
  101. 'no-empty-character-class': 2,
  102. 'no-empty-pattern': 2,
  103. 'no-eval': 2,
  104. 'no-ex-assign': 2,
  105. 'no-extend-native': 2,
  106. 'no-extra-bind': 2,
  107. 'no-extra-boolean-cast': 2,
  108. 'no-extra-parens': [2, 'functions'],
  109. 'no-fallthrough': 2,
  110. 'no-floating-decimal': 2,
  111. 'no-func-assign': 2,
  112. 'no-implied-eval': 2,
  113. 'no-inner-declarations': [2, 'functions'],
  114. 'no-invalid-regexp': 2,
  115. 'no-irregular-whitespace': 2,
  116. 'no-iterator': 2,
  117. 'no-label-var': 2,
  118. 'no-labels': [
  119. 2,
  120. {
  121. allowLoop: false,
  122. allowSwitch: false
  123. }
  124. ],
  125. 'no-lone-blocks': 2,
  126. 'no-mixed-spaces-and-tabs': 2,
  127. 'no-multi-spaces': 2,
  128. 'no-multi-str': 2,
  129. 'no-multiple-empty-lines': [
  130. 2,
  131. {
  132. max: 1
  133. }
  134. ],
  135. 'no-native-reassign': 2,
  136. 'no-negated-in-lhs': 2,
  137. 'no-new-object': 2,
  138. 'no-new-require': 2,
  139. 'no-new-symbol': 2,
  140. 'no-new-wrappers': 2,
  141. 'no-obj-calls': 2,
  142. 'no-octal': 2,
  143. 'no-octal-escape': 2,
  144. 'no-path-concat': 2,
  145. 'no-proto': 2,
  146. 'no-redeclare': 2,
  147. 'no-regex-spaces': 2,
  148. 'no-return-assign': [2, 'except-parens'],
  149. 'no-self-assign': 2,
  150. 'no-self-compare': 2,
  151. 'no-sequences': 2,
  152. 'no-shadow-restricted-names': 2,
  153. 'no-spaced-func': 2,
  154. 'no-sparse-arrays': 2,
  155. 'no-this-before-super': 2,
  156. 'no-throw-literal': 2,
  157. 'no-trailing-spaces': 2,
  158. 'no-undef': 2,
  159. 'no-undef-init': 2,
  160. 'no-unexpected-multiline': 2,
  161. 'no-unmodified-loop-condition': 2,
  162. 'no-unneeded-ternary': [
  163. 2,
  164. {
  165. defaultAssignment: false
  166. }
  167. ],
  168. 'no-unreachable': 2,
  169. 'no-unsafe-finally': 2,
  170. 'no-unused-vars': [
  171. 2,
  172. {
  173. vars: 'all',
  174. args: 'none'
  175. }
  176. ],
  177. 'no-useless-call': 2,
  178. 'no-useless-computed-key': 2,
  179. 'no-useless-constructor': 2,
  180. 'no-useless-escape': 0,
  181. 'no-whitespace-before-property': 2,
  182. 'no-with': 2,
  183. 'one-var': [
  184. 2,
  185. {
  186. initialized: 'never'
  187. }
  188. ],
  189. 'operator-linebreak': [
  190. 2,
  191. 'after',
  192. {
  193. overrides: {
  194. '?': 'before',
  195. ':': 'before'
  196. }
  197. }
  198. ],
  199. 'padded-blocks': [2, 'never'],
  200. quotes: [
  201. 2,
  202. 'single',
  203. {
  204. avoidEscape: true,
  205. allowTemplateLiterals: true
  206. }
  207. ],
  208. semi: [2, 'never'],
  209. 'semi-spacing': [
  210. 2,
  211. {
  212. before: false,
  213. after: true
  214. }
  215. ],
  216. 'space-before-blocks': [2, 'always'],
  217. 'space-before-function-paren': 0,
  218. 'space-in-parens': [2, 'never'],
  219. 'space-infix-ops': 2,
  220. 'space-unary-ops': [
  221. 2,
  222. {
  223. words: true,
  224. nonwords: false
  225. }
  226. ],
  227. 'spaced-comment': [
  228. 2,
  229. 'always',
  230. {
  231. markers: [
  232. 'global',
  233. 'globals',
  234. 'eslint',
  235. 'eslint-disable',
  236. '*package',
  237. '!',
  238. ','
  239. ]
  240. }
  241. ],
  242. 'template-curly-spacing': [2, 'never'],
  243. 'use-isnan': 2,
  244. 'valid-typeof': 2,
  245. 'wrap-iife': [2, 'any'],
  246. 'yield-star-spacing': [2, 'both'],
  247. yoda: [2, 'never'],
  248. 'prefer-const': 2,
  249. 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
  250. 'object-curly-spacing': [
  251. 2,
  252. 'always',
  253. {
  254. objectsInObjects: false
  255. }
  256. ],
  257. 'array-bracket-spacing': [2, 'never']
  258. }
  259. }