eslint.config.mjs 1.6 KB

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