.eslintrc.js 4.8 KB

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