eslint.config.mjs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import uniHelper from '@uni-helper/eslint-config'
  2. export default uniHelper({
  3. unocss: true,
  4. vue: true,
  5. markdown: false,
  6. ignores: [
  7. 'src/uni_modules/',
  8. 'dist',
  9. // unplugin-auto-import 生成的类型文件,每次提交都改变,所以加入这里吧,与 .gitignore 配合使用
  10. 'auto-import.d.ts',
  11. // vite-plugin-uni-pages 生成的类型文件,每次切换分支都一堆不同的,所以直接 .gitignore
  12. 'uni-pages.d.ts',
  13. // 插件生成的文件
  14. 'src/pages.json',
  15. 'src/manifest.json',
  16. // 忽略自动生成文件
  17. 'src/service/app/**',
  18. ],
  19. // https://eslint-config.antfu.me/rules
  20. rules: {
  21. 'no-useless-return': 'off',
  22. 'no-console': 'off',
  23. 'no-unused-vars': 'off',
  24. 'vue/no-unused-refs': 'off',
  25. 'unused-imports/no-unused-vars': 'off',
  26. 'eslint-comments/no-unlimited-disable': 'off',
  27. 'jsdoc/check-param-names': 'off',
  28. 'jsdoc/require-returns-description': 'off',
  29. 'ts/no-empty-object-type': 'off',
  30. 'no-extend-native': 'off',
  31. 'vue/singleline-html-element-content-newline': [
  32. 'error',
  33. {
  34. externalIgnores: ['text'],
  35. },
  36. ],
  37. // vue SFC 调换顺序改这里
  38. 'vue/block-order': ['error', {
  39. order: [['script', 'template'], 'style'],
  40. }],
  41. },
  42. formatters: {
  43. /**
  44. * Format CSS, LESS, SCSS files, also the `<style>` blocks in Vue
  45. * By default uses Prettier
  46. */
  47. css: true,
  48. /**
  49. * Format HTML files
  50. * By default uses Prettier
  51. */
  52. html: true,
  53. },
  54. })