.eslintrc.js 5.3 KB

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