.eslintrc.js 5.7 KB

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