.eslintrc.js 5.0 KB

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