GAAS GFrame项目web前端
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.

208 lines
4.8 KiB

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