.eslintrc.js 5.2 KB

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