.eslintrc.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. // 全局变量
  14. globals: {
  15. "sa": true,
  16. "layer": true
  17. },
  18. // add your custom rules here
  19. //it is base on https://github.com/vuejs/eslint-config-vue
  20. rules: {
  21. "vue/max-attributes-per-line": [0, {
  22. "singleline": 10,
  23. "multiline": {
  24. "max": 1,
  25. "allowFirstLine": false
  26. }
  27. }],
  28. "vue/singleline-html-element-content-newline": "off",
  29. "vue/multiline-html-element-content-newline":"off",
  30. "vue/name-property-casing": ["off", "PascalCase"],
  31. "vue/no-v-html": "off",
  32. 'accessor-pairs': 2,
  33. 'arrow-spacing': [2, {
  34. 'before': true,
  35. 'after': true
  36. }],
  37. 'block-spacing': [2, 'always'],
  38. 'brace-style': [2, '1tbs', {
  39. 'allowSingleLine': true
  40. }],
  41. 'camelcase': [0, {
  42. 'properties': 'always'
  43. }],
  44. 'comma-dangle': [0, 'never'],
  45. 'comma-spacing': [2, {
  46. 'before': false,
  47. 'after': true
  48. }],
  49. 'comma-style': [2, 'last'],
  50. 'constructor-super': 2,
  51. 'curly': [2, 'multi-line'],
  52. 'dot-location': [2, 'property'],
  53. 'eol-last': 2,
  54. 'eqeqeq': ["off", "always", {"null": "ignore"}],
  55. 'generator-star-spacing': [0, {
  56. 'before': true,
  57. 'after': true
  58. }],
  59. 'handle-callback-err': [2, '^(err|error)$'],
  60. 'indent': [2, 2, {
  61. 'SwitchCase': 1
  62. }],
  63. 'jsx-quotes': [2, 'prefer-single'],
  64. 'key-spacing': [2, {
  65. 'beforeColon': false,
  66. 'afterColon': true
  67. }],
  68. 'keyword-spacing': [2, {
  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': 0,
  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': [2, {
  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': [2, 'never'],
  169. 'quotes': [2, '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': [2, 'never'],
  180. 'space-in-parens': [2, 'never'],
  181. 'space-infix-ops': 2,
  182. 'space-unary-ops': [2, {
  183. 'words': true,
  184. 'nonwords': false
  185. }],
  186. 'spaced-comment': [2, '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': [2, 'always', {
  198. objectsInObjects: false
  199. }],
  200. 'array-bracket-spacing': [2, 'never']
  201. }
  202. }