strict.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. export default {
  2. extends: ['@vben'],
  3. plugins: ['simple-import-sort'],
  4. rules: {
  5. 'simple-import-sort/imports': 'error',
  6. 'simple-import-sort/exports': 'error',
  7. '@typescript-eslint/ban-ts-comment': [
  8. 'error',
  9. {
  10. 'ts-expect-error': 'allow-with-description',
  11. 'ts-ignore': 'allow-with-description',
  12. 'ts-nocheck': 'allow-with-description',
  13. 'ts-check': false,
  14. },
  15. ],
  16. /**
  17. * 【强制】关键字前后有一个空格
  18. * @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/keyword-spacing.md
  19. */
  20. 'keyword-spacing': 'off',
  21. '@typescript-eslint/keyword-spacing': [
  22. 'error',
  23. {
  24. before: true,
  25. after: true,
  26. overrides: {
  27. return: { after: true },
  28. throw: { after: true },
  29. case: { after: true },
  30. },
  31. },
  32. ],
  33. /**
  34. * 禁止出现空函数,普通函数(非 async/await/generator)、箭头函数、类上的方法除外
  35. * @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
  36. */
  37. 'no-empty-function': 'off',
  38. '@typescript-eslint/no-empty-function': [
  39. 'error',
  40. {
  41. allow: ['arrowFunctions', 'functions', 'methods'],
  42. },
  43. ],
  44. /**
  45. * 优先使用 interface 而不是 type 定义对象类型
  46. * @link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/consistent-type-definitions.md
  47. */
  48. '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
  49. 'vue/attributes-order': 'error',
  50. 'vue/require-default-prop': 'error',
  51. },
  52. };