.eslintrc.js 5.7 KB

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