import js from "@eslint/js"; import reactHooks from "eslint-plugin-react-hooks"; import reactRefresh from "eslint-plugin-react-refresh"; import tseslint from "typescript-eslint"; export default tseslint.config( { ignores: [ "node_modules/**", "dist/**", ".build/**", "*.bun-build", "openspec/**", ".opencode/**", ".claude/**", ".codex/**", ], }, js.configs.recommended, ...tseslint.configs.recommended, { files: ["**/*.{ts,tsx}"], rules: { "no-undef": "off", }, }, { files: ["src/web/**/*.{ts,tsx}"], plugins: { "react-hooks": reactHooks, "react-refresh": reactRefresh, }, rules: { ...reactHooks.configs.recommended.rules, "react-refresh/only-export-components": ["warn", { allowConstantExport: true }], "no-restricted-imports": [ "error", { patterns: [ { group: [ "../server/*", "../server/**", "../**/server/*", "../**/server/**", "../../server/*", "../../server/**", "src/server/*", "src/server/**", ], message: "前端不得导入 src/server 后端运行时实现;请改用 src/shared 类型或 HTTP API。", }, ], }, ], }, }, );