eslint.config.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import antfu from '@antfu/eslint-config'
  2. // https://github.com/antfu/eslint-config
  3. export default antfu(
  4. {
  5. vue: {
  6. overrides: {
  7. 'vue/block-order': ['error', {
  8. order: [['script', 'template'], 'style'],
  9. }], // 强制组件顶级元素的顺序
  10. 'vue/define-macros-order': ['error', {
  11. order: ['defineOptions', 'defineModel', 'defineProps', 'defineEmits', 'defineSlots'],
  12. defineExposeLast: true,
  13. }], // 强制执行定义限制和定义弹出编译器宏的顺序
  14. 'vue/singleline-html-element-content-newline': 'off', // 要求在单行元素的内容前后换行
  15. 'vue/html-self-closing': ['off', {
  16. html: {
  17. void: 'never',
  18. normal: 'always',
  19. component: 'never',
  20. },
  21. }], // 强制自结束样式
  22. 'vue/custom-event-name-casing': ['error', 'kebab-case'], // 对自定义事件名称强制使用特定大小写
  23. },
  24. },
  25. typescript: true,
  26. ignores: [
  27. '**/*.md',
  28. '.github',
  29. '.image',
  30. 'src/types/shims-vue.d.ts',
  31. ],
  32. },
  33. {
  34. rules: {
  35. 'curly': ['off', 'all'], // 对所有控制语句强制使用一致的大括号样式
  36. 'no-new': 'off', // 不允许在赋值或比较之外使用 new 运算符
  37. // 'no-console': 'error', // 禁止使用 console
  38. 'style/arrow-parens': ['error', 'always'], // 箭头函数参数需要括号
  39. 'style/brace-style': ['error', '1tbs', { allowSingleLine: true }], // 对块执行一致的大括号样式
  40. 'regexp/no-unused-capturing-group': 'off',
  41. 'regexp/no-super-linear-backtracking': 'off',
  42. 'node/prefer-global/process': 'off',
  43. 'antfu/top-level-function': 'off',
  44. 'antfu/if-newline': 'off',
  45. },
  46. },
  47. )