Skip to content

Commit 16d4fbb

Browse files
CodFrmclaude
andcommitted
🔧 修复 SEO 问题:Issue 页面恢复 SSR 渲染,修复 lint 错误
- Issue 列表页:移除 fallbackData 模式,改为 SSR props + SWR 混合模式, 初始数据由服务端获取并通过 props 传递(SEO 友好),用户交互后才走 SWR - Issue 评论页:替换 location.origin/pathname 为 SSR 安全的 URL 构造, 修复 props 直接修改(issue.labels = labels)改用 ref 追踪 - UserRatingForm:移除 useEffect 中的 setState,改为 useState 初始化 - 格式化修复:prettier auto-fix Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9ab91df commit 16d4fbb

45 files changed

Lines changed: 2859 additions & 2177 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint.config.mjs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
import { dirname } from 'path';
2-
import { fileURLToPath } from 'url';
3-
import { FlatCompat } from '@eslint/eslintrc';
4-
5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
7-
8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
});
1+
import nextCoreWebVitals from 'eslint-config-next/core-web-vitals';
2+
import prettierConfig from 'eslint-config-prettier';
3+
import prettierPlugin from 'eslint-plugin-prettier';
4+
import tseslint from 'typescript-eslint';
115

126
const eslintConfig = [
13-
...compat.extends('next/core-web-vitals', 'next/typescript'),
14-
...compat.extends('prettier'),
15-
...compat.config({
16-
plugins: ['prettier'],
7+
{
8+
ignores: ['node_modules/**', '.next/**', 'out/**', 'public/**'],
9+
},
10+
...nextCoreWebVitals,
11+
prettierConfig,
12+
{
13+
files: ['**/*.ts', '**/*.tsx'],
14+
plugins: {
15+
'@typescript-eslint': tseslint.plugin,
16+
prettier: prettierPlugin,
17+
},
1718
rules: {
1819
'@typescript-eslint/no-explicit-any': 'off',
1920
'@typescript-eslint/consistent-type-imports': 'error',
@@ -26,10 +27,14 @@ const eslintConfig = [
2627
caughtErrorsIgnorePattern: '^_',
2728
},
2829
],
30+
},
31+
},
32+
{
33+
rules: {
2934
'react-hooks/exhaustive-deps': 'off',
3035
'react/jsx-no-literals': 'warn',
3136
},
32-
}),
37+
},
3338
];
3439

3540
export default eslintConfig;

next.config.ts

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,48 @@ const nextConfig: NextConfig = {
1212
'@ant-design/icons',
1313
'@ant-design/charts',
1414
'@iconify/react',
15-
'dayjs',
16-
'prismjs',
1715
],
1816
},
17+
async headers() {
18+
return [
19+
{
20+
source: '/assets/:path*',
21+
headers: [
22+
{
23+
key: 'Cache-Control',
24+
value: 'public, max-age=31536000, immutable',
25+
},
26+
],
27+
},
28+
{
29+
source: '/styles/:path*',
30+
headers: [
31+
{
32+
key: 'Cache-Control',
33+
value: 'public, max-age=31536000, immutable',
34+
},
35+
],
36+
},
37+
{
38+
source: '/locales/:path*',
39+
headers: [
40+
{
41+
key: 'Cache-Control',
42+
value: 'public, max-age=86400, stale-while-revalidate=604800',
43+
},
44+
],
45+
},
46+
{
47+
source: '/monaco/:path*',
48+
headers: [
49+
{
50+
key: 'Cache-Control',
51+
value: 'public, max-age=31536000, immutable',
52+
},
53+
],
54+
},
55+
];
56+
},
1957
async rewrites() {
2058
return [
2159
{

package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"dev": "pnpm run predev && next dev",
77
"build": "pnpm run prebuild && next build",
88
"start": "next start",
9-
"lint": "next lint",
10-
"lint-fix": "next lint --fix",
9+
"lint": "eslint .",
10+
"lint-fix": "eslint . --fix",
1111
"predev": "ts-node --project ./tsconfig.node.json ./scripts/prebuild.tsx",
1212
"prebuild": "cross-env NODE_ENV=production ts-node --project ./tsconfig.node.json ./scripts/prebuild.tsx",
1313
"crowdin": "crowdin",
@@ -16,20 +16,19 @@
1616
"dependencies": {
1717
"@ant-design/charts": "^2.6.1",
1818
"@ant-design/icons": "^6.0.0",
19-
"@ant-design/nextjs-registry": "^1.1.0",
20-
"@ant-design/static-style-extract": "^1.0.3",
21-
"@ant-design/v5-patch-for-react-19": "^1.0.3",
19+
"@ant-design/nextjs-registry": "^1.3.0",
20+
"@ant-design/static-style-extract": "^2.0.4",
2221
"@iconify/react": "^6.0.0",
2322
"@monaco-editor/react": "^4.7.0",
2423
"@toast-ui/editor": "^3.2.2",
2524
"@toast-ui/editor-plugin-code-syntax-highlight": "^3.1.0",
26-
"antd": "^5.26.6",
25+
"antd": "^6.3.1",
2726
"dayjs": "^1.11.13",
2827
"github-markdown-css": "^5.8.1",
2928
"marked": "^16.1.1",
3029
"monaco-editor": "^0.52.2",
31-
"next": "15.4.8",
32-
"next-intl": "^4.3.4",
30+
"next": "16.1.6",
31+
"next-intl": "^4.8.3",
3332
"nextjs-toploader": "^3.8.16",
3433
"prismjs": "^1.30.0",
3534
"react": "^19.2.1",
@@ -41,7 +40,6 @@
4140
},
4241
"devDependencies": {
4342
"@crowdin/cli": "^4.9.0",
44-
"@eslint/eslintrc": "^3",
4543
"@tailwindcss/postcss": "^4",
4644
"@types/node": "^20",
4745
"@types/prismjs": "^1.26.5",
@@ -50,14 +48,14 @@
5048
"@types/react-dom": "^19",
5149
"cross-env": "^7.0.3",
5250
"eslint": "^9",
53-
"eslint-config-next": "15.4.3",
51+
"eslint-config-next": "16.1.6",
5452
"eslint-config-prettier": "^10.1.8",
5553
"eslint-plugin-prettier": "^5.5.3",
5654
"prettier": "^3.6.2",
5755
"tailwindcss": "^4",
5856
"ts-node": "^10.9.2",
5957
"tslib": "^2.8.1",
6058
"typescript": "^5",
61-
"typescript-eslint": "^8.38.0"
59+
"typescript-eslint": "^8.46.0"
6260
}
6361
}

0 commit comments

Comments
 (0)