Skip to content

Commit 2797031

Browse files
committed
[migrate] upgrade to Node.js 22, Next.js 15, ESLint 9 & other latest Upstream packages
[optimize] merge GitHub actions of main & other branches [remove] useless Example pages
1 parent 98bd4b6 commit 2797031

File tree

23 files changed

+2728
-2807
lines changed

23 files changed

+2728
-2807
lines changed

.eslintrc.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI & CD
22
on:
33
push:
44
branches:
5-
- main
5+
- '*'
66
jobs:
77
Build-and-Deploy:
88
env:
@@ -25,4 +25,4 @@ jobs:
2525
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
2626
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
2727
working-directory: ./
28-
vercel-args: --prod
28+
vercel-args: ${{ github.ref == 'refs/heads/main' && ' --prod' || '' }}

.github/workflows/pull-request.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20-slim AS base
1+
FROM node:22-slim AS base
22
RUN apt-get update && \
33
apt-get install ca-certificates curl libjemalloc-dev -y --no-install-recommends && \
44
rm -rf /var/lib/apt/lists/*

components/DrawerNav.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class DrawerNav extends Component {
2121
break;
2222
}
2323
scrollTop = document.scrollingElement?.scrollTop;
24+
// eslint-disable-next-line no-constant-condition
2425
} while (true);
2526
};
2627

components/Git/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const GitCard: FC<GitCardProps> = observer(
4747
</nav>
4848
<Row as="ul" className="list-unstyled g-4" xs={4}>
4949
{languages.map(language => (
50-
<Col as="li" key={language}>
50+
<Col key={language} as="li">
5151
<GitLogo name={language} />
5252
</Col>
5353
))}

components/conference/Guest.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export const GuestInfo: FC = () => (
1212
<Row as="ul" className="list-unstyled" xs={2} sm={4}>
1313
{guestData.map(({ pic, name, position }) => (
1414
<PersonCard
15-
avatar={`/image/speaker/${pic}`}
1615
key={name}
16+
avatar={`/image/speaker/${pic}`}
1717
{...{ name, position }}
1818
/>
1919
))}

components/conference/Organization.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ export const OrganizationInfo: FC = () => (
5353

5454
{Object.values(groupBy(sponsors, 'level')).map(sponsors => (
5555
<Row
56+
key={sponsors[0].level}
5657
as="ul"
5758
className="list-unstyled justify-content-around p-0"
5859
xs={2}
5960
sm={5}
60-
key={sponsors[0].level}
6161
>
6262
{sponsors.map(({ level, href, imgSrc }) => (
63-
<Col as="li" className={styles.sponsor_item} key={imgSrc}>
63+
<Col key={imgSrc} as="li" className={styles.sponsor_item}>
6464
<Badge className="d-inline-block align-middle m-1 w-75" bg="info">
6565
{renderLevel(level)}
6666
</Badge>
@@ -89,7 +89,7 @@ export const OrganizationInfo: FC = () => (
8989
sm={5}
9090
>
9191
{partners.map(({ href, imgSrc }) => (
92-
<Col as="li" className={styles.partner} key={href}>
92+
<Col key={href} as="li" className={styles.partner}>
9393
<a href={href} target="_blank" rel="noreferrer">
9494
<Image className="object-fit-contain" src={imgSrc} />
9595
</a>

eslint.config.mjs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// @ts-check
2+
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
3+
import { FlatCompat } from '@eslint/eslintrc';
4+
import eslint from '@eslint/js';
5+
import eslintConfigPrettier from 'eslint-config-prettier';
6+
import reactPlugin from 'eslint-plugin-react';
7+
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
8+
import globals from 'globals';
9+
import tsEslint from 'typescript-eslint';
10+
import { fileURLToPath } from 'url';
11+
12+
const tsconfigRootDir = fileURLToPath(new URL('.', import.meta.url)),
13+
flatCompat = new FlatCompat();
14+
15+
export default tsEslint.config(
16+
// register all of the plugins up-front
17+
{
18+
plugins: {
19+
'@typescript-eslint': tsEslint.plugin,
20+
react: fixupPluginRules(reactPlugin),
21+
'simple-import-sort': simpleImportSortPlugin,
22+
},
23+
},
24+
{
25+
// config with just ignores is the replacement for `.eslintignore`
26+
ignores: ['**/node_modules/**', '**/public/**', '**/.next/**'],
27+
},
28+
29+
// extends ...
30+
eslint.configs.recommended,
31+
...tsEslint.configs.recommended,
32+
...fixupConfigRules(flatCompat.extends('plugin:@next/next/core-web-vitals')),
33+
34+
// base config
35+
{
36+
languageOptions: {
37+
globals: { ...globals.es2020, ...globals.browser, ...globals.node },
38+
parserOptions: {
39+
projectService: true,
40+
tsconfigRootDir,
41+
warnOnUnsupportedTypeScriptVersion: false,
42+
},
43+
},
44+
rules: {
45+
'no-empty-pattern': 'warn',
46+
'simple-import-sort/exports': 'error',
47+
'simple-import-sort/imports': 'error',
48+
'@typescript-eslint/no-unused-vars': 'warn',
49+
'@typescript-eslint/no-explicit-any': 'warn',
50+
'@typescript-eslint/no-empty-object-type': 'off',
51+
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
52+
'react/jsx-no-target-blank': 'warn',
53+
'react/jsx-sort-props': [
54+
'error',
55+
{
56+
reservedFirst: true,
57+
callbacksLast: true,
58+
noSortAlphabetically: true,
59+
},
60+
],
61+
'@next/next/no-sync-scripts': 'warn',
62+
},
63+
},
64+
{
65+
files: ['**/*.js'],
66+
extends: [tsEslint.configs.disableTypeChecked],
67+
rules: {
68+
// turn off other type-aware rules
69+
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',
70+
71+
// turn off rules that don't apply to JS code
72+
'@typescript-eslint/explicit-function-return-type': 'off',
73+
},
74+
},
75+
eslintConfigPrettier,
76+
);

models/Translation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export const i18n = new TranslationModel({
88
'en-US': () => import('../translation/en-US'),
99
});
1010

11+
export const { t } = i18n;
12+
1113
export const LanguageName: Record<(typeof i18n)['currentLanguage'], string> = {
1214
'zh-CN': '简体中文',
1315
'zh-TW': '繁體中文',

0 commit comments

Comments
 (0)