eslintrc.js 5.5 KB

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