Skip to content

Commit 3275163

Browse files
committed
[add] Stylistic in ESLint configuration (fix #225)
[optimize] upgrade to React 19
1 parent 6ccf1d7 commit 3275163

File tree

8 files changed

+245
-177
lines changed

8 files changed

+245
-177
lines changed

eslint.config.mjs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// @ts-check
21
import cspellPlugin from '@cspell/eslint-plugin';
32
import eslint from '@eslint/js';
43
// @ts-expect-error eslint-plugin-next doesn't come with TypeScript definitions
54
import nextPlugin from '@next/eslint-plugin-next';
5+
import stylistic from '@stylistic/eslint-plugin';
66
import eslintConfigPrettier from 'eslint-config-prettier';
77
import react from 'eslint-plugin-react';
88
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
@@ -22,6 +22,7 @@ export default tsEslint.config(
2222
{
2323
plugins: {
2424
'@cspell': cspellPlugin,
25+
'@stylistic': stylistic,
2526
'simple-import-sort': simpleImportSortPlugin,
2627
'@typescript-eslint': tsEslint.plugin,
2728
react,
@@ -30,7 +31,12 @@ export default tsEslint.config(
3031
},
3132
{
3233
// config with just ignores is the replacement for `.eslintignore`
33-
ignores: ['**/node_modules/**', '**/public/**', '**/.next/**'],
34+
ignores: [
35+
'**/node_modules/**',
36+
'**/public/**',
37+
'**/.next/**',
38+
'.github/scripts/**',
39+
],
3440
},
3541

3642
// extends ...
@@ -66,6 +72,18 @@ export default tsEslint.config(
6672
},
6773
},
6874
],
75+
// stylistic
76+
'@stylistic/padding-line-between-statements': [
77+
'error',
78+
{ blankLine: 'always', prev: '*', next: 'return' },
79+
{ blankLine: 'always', prev: 'directive', next: '*' },
80+
{ blankLine: 'any', prev: 'directive', next: 'directive' },
81+
{
82+
blankLine: 'always',
83+
prev: '*',
84+
next: ['enum', 'interface', 'type'],
85+
},
86+
],
6987
'arrow-body-style': ['error', 'as-needed'],
7088
'no-empty-pattern': 'warn',
7189
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"next": "^15.2.2",
3333
"next-ssr-middleware": "^0.8.9",
3434
"open-react-map": "^0.8.1",
35-
"react": "^18.3.1",
35+
"react": "^19.0.0",
3636
"react-bootstrap": "^2.10.9",
37-
"react-bootstrap-editor": "^2.0.4",
38-
"react-dom": "^18.3.1",
39-
"react-leaflet": "^4.2.1",
37+
"react-bootstrap-editor": "^2.0.7",
38+
"react-dom": "^19.0.0",
39+
"react-leaflet": "^5.0.0",
4040
"web-utility": "^4.4.3"
4141
},
4242
"devDependencies": {
@@ -52,12 +52,13 @@
5252
"@next/eslint-plugin-next": "^15.2.2",
5353
"@octokit/openapi-types": "^24.0.0",
5454
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
55+
"@stylistic/eslint-plugin": "^4.2.0",
5556
"@types/eslint-config-prettier": "^6.11.3",
5657
"@types/jsonwebtoken": "^9.0.9",
5758
"@types/leaflet": "^1.9.16",
5859
"@types/next-pwa": "^5.6.9",
5960
"@types/node": "^22.13.10",
60-
"@types/react": "^18.3.18",
61+
"@types/react": "^19.0.10",
6162
"eslint": "^9.22.0",
6263
"eslint-config-next": "^15.2.2",
6364
"eslint-config-prettier": "^10.1.1",

pages/activity/[name]/manage/evaluation.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class EvalationEditor extends Component<EvaluationPageProps> {
7474
const { keywords } = formToJSON<{ keywords: string }>(event.currentTarget);
7575

7676
this.store.clear();
77+
7778
return this.store.getList({ keywords });
7879
};
7980

pages/activity/[name]/manage/questionnaire.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class ActivityQuestionnaireEditor extends Component<ActivityQuestionnairePagePro
9696
const curQuestionnaire = activityStore.questionnaire.filter(
9797
v => v.id !== id,
9898
);
99+
99100
return activityStore.editQuestionnaireStatus(curQuestionnaire);
100101
};
101102

@@ -109,6 +110,7 @@ class ActivityQuestionnaireEditor extends Component<ActivityQuestionnairePagePro
109110
1,
110111
curQuestionnaire[index],
111112
)[0];
113+
112114
return activityStore.editQuestionnaireStatus(curQuestionnaire);
113115
};
114116

pages/activity/[name]/manage/team.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class TeamManageEditor extends Component<TeamManagePageProps> {
4848
const { keywords } = formToJSON<{ keywords: string }>(event.currentTarget);
4949

5050
this.store.clear();
51+
5152
return this.store.getList({ keywords });
5253
};
5354

pages/api/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function safeAPI(handler: NextAPI): NextAPI {
2424
} catch (error) {
2525
if (!(error instanceof HTTPError)) {
2626
console.error(error);
27+
2728
return res.end(error);
2829
}
2930
const { message, response } = error;

pages/open-source.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const OpenSourcePage: FC<OpenSourcePageProps> = observer(
4343
const repository = repositories.find(
4444
({ full_name }) => full_name === name,
4545
);
46+
4647
return (
4748
<Col key={name}>
4849
<GitCard

0 commit comments

Comments
 (0)