Files
photo-live/eslint.config.js
T
浅念 a6cc190751 feat(admin): art-design-pro integration with local session auth
P1b Task 9: apps/admin based on art-design-pro v3.0.2 (tag, commit
d224dd4; source recorded in apps/admin/SOURCE.md), trimmed to
layout/login/i18n/request/table-form core. Login wired to real
POST /v1/auth/password (single-token session), Bearer header on all
requests, 401 interceptor logout+redirect, request-driven sliding
renewal (refresh at ~80% TTL, single-flight), best-effort
POST /v1/auth/logout on user-menu logout. One protected stub page
(相册管理). Dev port 5176 strictPort + /v1 proxy to 8080. Admin keeps
its own eslint9 flat config; root eslint ignores apps/admin/**.
vitest unit tests for renewal pacing + Playwright e2e (guard redirect,
localized wrong-password error, login lands on stub, token persists
across reload, logout clears session).

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

56 lines
2.4 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/',
// apps/admin(P1b Task 9,art-design-pro 模板)自带 eslint9 flat config
// (eslint.config.mjs + prettier/stylelint 规则集),与根配置的规则集不同;
// 计划「执行注意」注册的偏差:根配置不覆盖 admin,admin `lint` 脚本跑自己的配置。
'apps/admin/**',
],
},
...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',
},
},
);