演示项目-图书馆
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

277 lines
5.8 KiB

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