.eslintrc.js 5.5 KB

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