Files
photo-live/eslint.config.js
T
浅念 f9cb72ed06 feat(viewer): vite vue3 scaffold with routing and i18n
- apps/viewer (@photo/viewer): Vite 5 + Vue 3.4 + TS 最小骨架(无 Pinia/UI 库)
- router: /a/:token 活动页 + /a/:token/p/:photoId 单图深链(复用活动页组件)
- i18n: vue-i18n 9,zh-CN/en 词条,localStorage(viewer.locale) 持久 +
  navigator.language 检测兜底 zh-CN;顶栏语言切换组件;文案全量走 i18n
- api client: 类型化 fetch 封装(契约生成类型直连),错误信封 → ApiError,
  错误码 → i18n key 映射表(src/api/errors.ts)
- scripts: dev/build/preview/test(vitest 10 例)/test:e2e(Playwright 冒烟,
  webServer 自拉 dev)/lint/vue-tsc 全部接入 turbo
- root: +@playwright/test、+eslint-plugin-vue(flat config 收敛到 apps/**/*.vue)、
  pnpm.onlyBuiltDependencies 放行 esbuild

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-18 09:12:45 +08:00

52 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// eslint.config.js —— 根 flat config(覆盖 packages/services/apps 全部 TS + apps 的 Vue SFC)。
// 各包 lint 脚本为 `eslint .`,在包目录执行时向上发现本文件,turbo 不会静默跳过。
// 仅 typescript-eslint recommended(无类型感知规则,无需 project service),
// 避免跨包 tsconfig 差异(contracts NodeNext / api node16)带来的配置负担。
// Vue SFC(P1b Task 5 起,apps 前端):vue-eslint Parser 解析 .vue,script 块交给
// @typescript-eslint/parser;逐项收敛 files 到 apps/**/*.vue,不影响既有纯 TS 包。
// @ts-check
const globals = require('globals');
const tseslint = require('typescript-eslint');
const pluginVue = require('eslint-plugin-vue');
module.exports = tseslint.config(
{
ignores: [
'**/node_modules/',
'**/dist/',
'**/coverage/',
'**/.turbo/',
// 生成产物不参与 lint(契约生成类型已提交入库,改动随 `pnpm gen` 审查)
'**/generated/',
// Playwright 运行产物
'**/playwright-report/',
'**/test-results/',
'**/blob-report/',
],
},
...tseslint.configs.recommended,
{
files: ['apps/**/*.{ts,tsx}', 'packages/**/*.ts', 'services/**/*.ts'],
languageOptions: {
globals: { ...globals.node },
},
},
// eslint-plugin-vue flat/recommended 的每一段都显式限定到 apps/**/*.vue,
// 避免其无 files 的基础段作用于全部包。
...pluginVue.configs['flat/recommended'].map((config) => ({ ...config, files: ['apps/**/*.vue'] })),
{
files: ['apps/**/*.vue'],
languageOptions: {
globals: { ...globals.browser },
parserOptions: { parser: tseslint.parser, sourceType: 'module' },
},
rules: {
// 根组件 App.vue 是约定俗成的单词名,其余组件仍要求多词命名
'vue/multi-word-component-names': ['error', { ignores: ['App'] }],
// 模板排版类规则与 prettier 职责重叠,交给格式化工具(与官方建议一致)
'vue/max-attributes-per-line': 'off',
'vue/singleline-html-element-content-newline': 'off',
},
},
);