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.

192 lines
4.9 KiB

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