.eslintrc.js 6.9 KB

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