Skip to content

Commit 9d4b58a

Browse files
committed
[fix] Giscus language bug in Requirement page (fix #74)
[add] Stylistic rules in ESLint configuration [optimize] update Upstream packages
1 parent 526a029 commit 9d4b58a

File tree

8 files changed

+386
-348
lines changed

8 files changed

+386
-348
lines changed

eslint.config.mjs

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import cspellPlugin from '@cspell/eslint-plugin';
22
import eslint from '@eslint/js';
33
// @ts-expect-error eslint-plugin-next doesn't come with TypeScript definitions
44
import nextPlugin from '@next/eslint-plugin-next';
5+
import stylistic from '@stylistic/eslint-plugin';
56
import eslintConfigPrettier from 'eslint-config-prettier';
67
import react from 'eslint-plugin-react';
78
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
@@ -20,11 +21,12 @@ export default tsEslint.config(
2021
// register all of the plugins up-front
2122
{
2223
plugins: {
24+
'@cspell': cspellPlugin,
25+
'@stylistic': stylistic,
2326
'simple-import-sort': simpleImportSortPlugin,
2427
'@typescript-eslint': tsEslint.plugin,
2528
react,
2629
'@next/next': nextPlugin,
27-
'@cspell': cspellPlugin,
2830
},
2931
},
3032
{
@@ -47,8 +49,28 @@ export default tsEslint.config(
4749
},
4850
},
4951
rules: {
50-
...nextPlugin.configs.recommended.rules,
51-
...nextPlugin.configs['core-web-vitals'].rules,
52+
// spellchecker
53+
'@cspell/spellchecker': [
54+
'warn',
55+
{
56+
cspell: {
57+
language: 'en',
58+
dictionaries: ['typescript', 'node', 'html', 'css', 'bash', 'npm', 'pnpm'],
59+
},
60+
},
61+
],
62+
// stylistic
63+
'@stylistic/padding-line-between-statements': [
64+
'error',
65+
{ blankLine: 'always', prev: '*', next: 'return' },
66+
{ blankLine: 'always', prev: 'directive', next: '*' },
67+
{ blankLine: 'any', prev: 'directive', next: 'directive' },
68+
{
69+
blankLine: 'always',
70+
prev: '*',
71+
next: ['enum', 'interface', 'type'],
72+
},
73+
],
5274
'arrow-body-style': ['error', 'as-needed'],
5375
'no-empty-pattern': 'warn',
5476
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
@@ -64,13 +86,13 @@ export default tsEslint.config(
6486
// simple-import-sort
6587
'simple-import-sort/exports': 'error',
6688
'simple-import-sort/imports': 'error',
67-
// typescript
89+
// TypeScript
6890
'@typescript-eslint/no-unused-vars': 'warn',
6991
'@typescript-eslint/no-explicit-any': 'warn',
7092
'@typescript-eslint/no-empty-object-type': 'off',
7193
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
7294
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
73-
// react
95+
// React
7496
'react/no-unescaped-entities': 'off',
7597
'react/self-closing-comp': ['error', { component: true, html: true }],
7698
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
@@ -83,18 +105,10 @@ export default tsEslint.config(
83105
noSortAlphabetically: true,
84106
},
85107
],
86-
// next
108+
// Next.js
109+
...nextPlugin.configs.recommended.rules,
110+
...nextPlugin.configs['core-web-vitals'].rules,
87111
'@next/next/no-sync-scripts': 'warn',
88-
// spellchecker
89-
'@cspell/spellchecker': [
90-
'warn',
91-
{
92-
cspell: {
93-
language: 'en',
94-
dictionaries: ['typescript', 'node', 'html', 'css', 'bash', 'npm', 'pnpm'],
95-
},
96-
},
97-
],
98112
},
99113
},
100114
eslintConfigPrettier,

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010
"@emotion/react": "^11.14.0",
1111
"@emotion/styled": "^11.14.0",
1212
"@giscus/react": "^3.1.0",
13-
"@mui/lab": "6.0.0-beta.30",
14-
"@mui/material": "^6.4.7",
15-
"@sentry/nextjs": "^9.5.0",
13+
"@mui/lab": "6.0.0-beta.31",
14+
"@mui/material": "^6.4.8",
15+
"@sentry/nextjs": "^9.6.0",
1616
"file-type": "^20.4.1",
1717
"koajax": "^3.1.1",
1818
"lodash": "^4.17.21",
1919
"marked": "^15.0.7",
2020
"mime": "^4.0.6",
21-
"mobx": "^6.13.6",
21+
"mobx": "^6.13.7",
2222
"mobx-github": "^0.3.5",
2323
"mobx-i18n": "^0.6.0",
24-
"mobx-lark": "^2.0.0",
24+
"mobx-lark": "^2.1.0",
2525
"mobx-react": "^9.2.0",
2626
"mobx-restful": "^2.1.0",
27-
"next": "^15.2.2",
27+
"next": "^15.2.3",
2828
"next-pwa": "~5.6.0",
29-
"next-ssr-middleware": "^0.8.9",
29+
"next-ssr-middleware": "^0.8.10",
3030
"react": "^19.0.0",
3131
"react-dom": "^19.0.0",
3232
"web-utility": "^4.4.3",
@@ -39,15 +39,16 @@
3939
"@cspell/eslint-plugin": "^8.17.5",
4040
"@eslint/compat": "^1.2.7",
4141
"@eslint/js": "^9.22.0",
42-
"@next/eslint-plugin-next": "^15.2.2",
43-
"@tailwindcss/postcss": "^4.0.13",
42+
"@next/eslint-plugin-next": "^15.2.3",
43+
"@stylistic/eslint-plugin": "^4.2.0",
44+
"@tailwindcss/postcss": "^4.0.14",
4445
"@types/eslint-config-prettier": "^6.11.3",
4546
"@types/lodash": "^4.17.16",
4647
"@types/next-pwa": "^5.6.9",
4748
"@types/node": "^22.13.10",
48-
"@types/react": "^19.0.10",
49+
"@types/react": "^19.0.11",
4950
"eslint": "^9.22.0",
50-
"eslint-config-next": "^15.2.2",
51+
"eslint-config-next": "^15.2.3",
5152
"eslint-config-prettier": "^10.1.1",
5253
"eslint-plugin-react": "^7.37.4",
5354
"eslint-plugin-simple-import-sort": "^12.1.1",
@@ -58,7 +59,7 @@
5859
"prettier": "^3.5.3",
5960
"prettier-plugin-css-order": "^2.1.2",
6061
"prettier-plugin-tailwindcss": "^0.6.11",
61-
"tailwindcss": "^4.0.13",
62+
"tailwindcss": "^4.0.14",
6263
"typescript": "~5.8.2",
6364
"typescript-eslint": "^8.26.1"
6465
},

pages/api/Lark/bitable/v1/[...slug].ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export default proxyLark((path, data) => {
1010
for (const { fields } of items)
1111
for (const key of Object.keys(fields)) if (!/^\w+$/.test(key)) delete fields[key];
1212
}
13+
1314
return data;
1415
});

pages/api/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export function safeAPI(handler: NextAPI): NextAPI {
1616
console.error(error);
1717

1818
res.status(400);
19+
1920
return res.send({ message: (error as Error).message });
2021
}
2122
const { message, response } = error;

pages/member/[nickname].tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default class MemberDetailPage extends Component<MemberDetailPageProps> {
5151
[t('projects_as_leader')]: leaderProjects,
5252
[t('projects_as_member')]: memberProjects,
5353
});
54+
5455
return (
5556
<div className="container mx-auto mt-16 max-w-(--breakpoint-xl) px-4 py-6">
5657
<PageHead title={member.nickname as string} />

pages/project/[id].tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export const getServerSideProps = compose<{ id: string }, ProjectDetailPageProps
3333

3434
repositories = await new GitRepositoryModel('idea2app').getGroup(openSource);
3535
}
36+
3637
return { props: JSON.parse(JSON.stringify({ project, repositories })) };
3738
},
3839
);

pages/requirement/[title].tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export const getServerSideProps = compose(router, translator(i18n));
1111

1212
const RequirementDetailPage: NextPage<RouteProps<{ title: string }>> = observer(
1313
({ route: { params } }) => {
14-
const title = `${params!.title} - ${t('AI_requirement_evaluation')}`;
14+
const { currentLanguage } = i18n,
15+
title = `${params!.title} - ${t('AI_requirement_evaluation')}`;
1516

1617
return (
1718
<div className="container mx-auto flex max-w-(--breakpoint-xl) flex-col gap-4 px-4 pt-16 pb-6">
@@ -32,7 +33,7 @@ const RequirementDetailPage: NextPage<RouteProps<{ title: string }>> = observer(
3233
categoryId="DIC_kwDOOHPqjc4Cn5sg"
3334
mapping="og:title"
3435
emitMetadata="1"
35-
lang={i18n.currentLanguage}
36+
lang={currentLanguage.startsWith('zh-') ? currentLanguage : currentLanguage.split('-')[0]}
3637
/>
3738
</div>
3839
);

0 commit comments

Comments
 (0)