// ESLint 9 flat config(monorepo 根,遍历 packages/ + apps/):vue3 + TS strict 配套。 // // 与 PC 端(单项目)差异: // ① ignores 补 monorepo 路径(apps/*/dist、packages/shared/dist、各 node_modules、vendor/); // ② 禁值 import 清单**只含 UMD 全局框架**(vue/vue-router/pinia/axios)—— // Vant 4 走 npm 编译(官方无 UMD 构建,混合方案),`import Vant from 'vant'` 仅允许 // 出现在 apps/*/src/main.ts 的 app.use(Vant) 装配点,不在本清单限内。 import js from '@eslint/js'; import tseslint from 'typescript-eslint'; import pluginVue from 'eslint-plugin-vue'; import prettier from 'eslint-config-prettier'; /** * 框架运行时模块名(UMD 全局框架;业务代码禁"值 import",见 README 编码规范)。 * * 精确边界(同 PC 端): * - `import type { Ref } from 'vue'` 属**类型导入**(编译期擦除、零运行时足迹)——放行; * - `import { ref } from 'vue'` 属**值导入**——会把框架运行时打包进 dist,必须拦。 * * 实现用 `no-restricted-syntax`(importKind='value' 只匹配值导入,放行 type 导入)。 */ const FRAMEWORK_MODULE_SELECTOR = ":is([source.value='vue'],[source.value='vue-router'],[source.value='pinia'],[source.value='axios'])"; export default [ js.configs.recommended, ...tseslint.configs.recommended, ...pluginVue.configs['flat/essential'], prettier, { // shims/ 由 scripts/gen-shims.cjs 生成(含逐行 eslint-disable 注释); // scripts/ 是 Node CJS 工具脚本;vendor/ 是 UMD 源文件——均不 lint。 ignores: [ 'dist/**', 'vendor/**', 'node_modules/**', 'shims/**', 'scripts/**', 'packages/*/dist/**', 'apps/*/dist/**', '**/node_modules/**', '**/*.cjs', ], }, { // .vue:SFC 内