Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1 місяць тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. module.exports = {
  2. env: {
  3. browser: true,
  4. es2021: true,
  5. node: true
  6. },
  7. extends: [
  8. 'eslint:recommended', // 使用推荐的eslint
  9. 'plugin:vue/vue3-recommended' // 使用插件支持vue3
  10. ],
  11. parserOptions: {
  12. ecmaVersion: 13,
  13. sourceType: 'module',
  14. ecmaFeatures: {
  15. modules: true,
  16. jsx: true
  17. },
  18. requireConfigFile: false,
  19. parser: '@babel/eslint-parser'
  20. },
  21. // eslint-plugin-vue
  22. plugins: [
  23. 'vue' // 引入vue的插件 vue <==> eslint-plugin-vue
  24. ],
  25. globals: {
  26. defineProps: 'readonly',
  27. defineEmits: 'readonly',
  28. defineExpose: 'readonly',
  29. withDefaults: 'readonly'
  30. },
  31. // 配置规则
  32. rules: {
  33. // 'vue/max-attributes-per-line': [2, {
  34. // 'singleline': 10,
  35. // 'multiline': {
  36. // 'max': 1,
  37. // 'allowFirstLine': false
  38. // }
  39. // }],
  40. 'vue/singleline-html-element-content-newline': 'off',
  41. 'vue/multiline-html-element-content-newline': 'off',
  42. 'vue/no-v-html': 'off',
  43. 'vue/no-dupe-keys':'off',
  44. 'accessor-pairs': 2,
  45. 'arrow-spacing': [2, {
  46. 'before': true,
  47. 'after': true
  48. }],
  49. 'block-spacing': [2, 'always'],
  50. 'brace-style': [2, '1tbs', {
  51. 'allowSingleLine': true
  52. }],
  53. 'camelcase': [0, {
  54. 'properties': 'always'
  55. }],
  56. 'comma-dangle': [2, 'never'],
  57. 'comma-spacing': [2, {
  58. 'before': false,
  59. 'after': true
  60. }],
  61. 'comma-style': [2, 'last'],
  62. 'constructor-super': 2,
  63. 'curly': [2, 'multi-line'],
  64. 'dot-location': [2, 'property'],
  65. 'eol-last': 2,
  66. 'eqeqeq': [2, 'always', { 'null': 'ignore' }],
  67. 'generator-star-spacing': [2, {
  68. 'before': true,
  69. 'after': true
  70. }],
  71. 'handle-callback-err': [2, '^(err|error)$'],
  72. 'indent': [2, 2, {
  73. 'SwitchCase': 1
  74. }],
  75. 'jsx-quotes': [2, 'prefer-single'],
  76. 'key-spacing': [2, {
  77. 'beforeColon': false,
  78. 'afterColon': true
  79. }],
  80. 'keyword-spacing': [2, {
  81. 'before': true,
  82. 'after': true
  83. }],
  84. 'new-cap': [2, {
  85. 'newIsCap': true,
  86. 'capIsNew': false
  87. }],
  88. 'new-parens': 2,
  89. 'no-array-constructor': 2,
  90. 'no-caller': 2,
  91. 'no-console': 'off',
  92. 'no-class-assign': 2,
  93. 'no-cond-assign': 2,
  94. 'no-const-assign': 2,
  95. 'no-control-regex': 0,
  96. 'no-delete-var': 2,
  97. 'no-dupe-args': 2,
  98. 'no-dupe-class-members': 2,
  99. 'no-dupe-keys': 2,
  100. 'no-duplicate-case': 2,
  101. 'no-empty-character-class': 2,
  102. 'no-empty-pattern': 2,
  103. 'no-eval': 2,
  104. 'no-ex-assign': 2,
  105. 'no-extend-native': 2,
  106. 'no-extra-bind': 2,
  107. 'no-extra-boolean-cast': 2,
  108. 'no-extra-parens': [2, 'functions'],
  109. 'no-fallthrough': 2,
  110. 'no-floating-decimal': 2,
  111. 'no-func-assign': 2,
  112. 'no-implied-eval': 2,
  113. 'no-inner-declarations': [2, 'functions'],
  114. 'no-invalid-regexp': 2,
  115. 'no-irregular-whitespace': 2,
  116. 'no-iterator': 2,
  117. 'no-label-var': 2,
  118. 'no-labels': [2, {
  119. 'allowLoop': false,
  120. 'allowSwitch': false
  121. }],
  122. 'no-lone-blocks': 2,
  123. 'no-mixed-spaces-and-tabs': 2,
  124. 'no-multi-spaces': 2,
  125. 'no-multi-str': 2,
  126. 'no-multiple-empty-lines': [2, {
  127. 'max': 1
  128. }],
  129. 'no-native-reassign': 2,
  130. 'no-negated-in-lhs': 2,
  131. 'no-new-object': 2,
  132. 'no-new-require': 2,
  133. 'no-new-symbol': 2,
  134. 'no-new-wrappers': 2,
  135. 'no-obj-calls': 2,
  136. 'no-octal': 2,
  137. 'no-octal-escape': 2,
  138. 'no-path-concat': 2,
  139. 'no-proto': 2,
  140. 'no-redeclare': 2,
  141. 'no-regex-spaces': 2,
  142. 'no-return-assign': [2, 'except-parens'],
  143. 'no-self-assign': 2,
  144. 'no-self-compare': 2,
  145. 'no-sequences': 2,
  146. 'no-shadow-restricted-names': 2,
  147. 'no-spaced-func': 2,
  148. 'no-sparse-arrays': 2,
  149. 'no-this-before-super': 2,
  150. 'no-throw-literal': 2,
  151. 'no-trailing-spaces': 2,
  152. 'no-undef': 2,
  153. 'no-undef-init': 2,
  154. 'no-unexpected-multiline': 2,
  155. 'no-unmodified-loop-condition': 2,
  156. 'no-unneeded-ternary': [2, {
  157. 'defaultAssignment': false
  158. }],
  159. 'no-unreachable': 2,
  160. 'no-unsafe-finally': 2,
  161. 'no-unused-vars': [2, {
  162. 'vars': 'all',
  163. 'args': 'none'
  164. }],
  165. 'no-useless-call': 2,
  166. 'no-useless-computed-key': 2,
  167. 'no-useless-constructor': 2,
  168. 'no-useless-escape': 0,
  169. 'no-whitespace-before-property': 2,
  170. 'no-with': 2,
  171. 'operator-linebreak': [2, 'after', {
  172. 'overrides': {
  173. '?': 'before',
  174. ':': 'before'
  175. }
  176. }],
  177. 'padded-blocks': [2, 'never'],
  178. 'quotes': [2, 'single', {
  179. 'avoidEscape': true,
  180. 'allowTemplateLiterals': true
  181. }],
  182. 'semi': [2, 'never'],
  183. 'semi-spacing': [2, {
  184. 'before': false,
  185. 'after': true
  186. }],
  187. 'space-before-blocks': [2, 'always'],
  188. 'space-before-function-paren': [2, 'always'],
  189. 'space-in-parens': [2, 'never'],
  190. 'space-infix-ops': 2,
  191. 'space-unary-ops': [2, {
  192. 'words': true,
  193. 'nonwords': false
  194. }],
  195. 'spaced-comment': [2, 'always', {
  196. 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
  197. }],
  198. 'template-curly-spacing': [2, 'never'],
  199. 'use-isnan': 2,
  200. 'valid-typeof': 2,
  201. 'wrap-iife': [2, 'any'],
  202. 'yield-star-spacing': [2, 'both'],
  203. 'yoda': [2, 'never'],
  204. 'prefer-const': 2,
  205. 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
  206. 'object-curly-spacing': [2, 'always', {
  207. objectsInObjects: false
  208. }],
  209. 'array-bracket-spacing': [2, 'never'],
  210. 'vue/multi-word-component-names': 'off',
  211. 'vue/no-unused-vars': [
  212. 2,
  213. {
  214. ignorePattern: '^_'
  215. }
  216. ],
  217. 'vue/require-default-prop': 0, // 关闭属性参数必须默认值
  218. // // 要求每一行标签的最大属性不超三个
  219. 'vue/max-attributes-per-line': [2, { singleline: 3 }],
  220. // 要求html标签的缩进为需要2个空格
  221. 'vue/html-indent': [
  222. 2,
  223. 2,
  224. {
  225. attribute: 1,
  226. baseIndent: 1,
  227. closeBracket: 0,
  228. alignAttributesVertically: true,
  229. ignores: []
  230. }
  231. ],
  232. // 取消关闭标签不能自闭合的限制设置
  233. 'vue/html-self-closing': [
  234. 2,
  235. {
  236. html: {
  237. void: 'always',
  238. normal: 'never',
  239. component: 'always'
  240. },
  241. svg: 'always',
  242. math: 'always'
  243. }
  244. ]
  245. },
  246. settings: {
  247. 'import/resolver': {
  248. alias: {
  249. map: [['@', './src']]
  250. }
  251. }
  252. }
  253. }