Skip to content

Commit 4a6b3f6

Browse files
SoeckaTechQuery
andauthored
[migrate] upgrade to ESLint 9, Node.js 20 & other latest Upstream packages/actions (#16)
Co-authored-by: South Drifted <[email protected]>
1 parent dfc2a85 commit 4a6b3f6

File tree

20 files changed

+3092
-1854
lines changed

20 files changed

+3092
-1854
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,29 @@ on:
66
jobs:
77
Build-and-Deploy:
88
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
911
env:
1012
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1113
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1214
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1315
steps:
14-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1517

16-
- uses: pnpm/action-setup@v2
18+
- uses: pnpm/action-setup@v4
1719
with:
1820
version: 9
19-
- uses: actions/setup-node@v3
20-
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
21+
- uses: actions/setup-node@v4
2122
with:
22-
node-version: 18
23+
node-version: 20
2324
cache: pnpm
24-
- name: Install Dependencies
25-
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
26-
run: pnpm i --frozen-lockfile
25+
- name: Install & Build
26+
run: |
27+
pnpm i --frozen-lockfile
28+
pnpm build
2729
28-
- name: Build Production
29-
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
30-
run: pnpm build
31-
32-
- name: Deploy Production
33-
uses: peaceiris/actions-gh-pages@v3
34-
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }}
30+
- name: Deploy to GitHub pages
31+
uses: peaceiris/actions-gh-pages@v4
3532
with:
3633
publish_dir: ./dist
3734
personal_token: ${{ secrets.GITHUB_TOKEN }}
@@ -45,5 +42,5 @@ jobs:
4542
github-token: ${{ secrets.GITHUB_TOKEN }}
4643
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
4744
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
48-
working-directory: ./
45+
working-directory: ./dist
4946
vercel-args: --prod

.github/workflows/pull-request.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,30 @@ on:
66
jobs:
77
Build-and-Deploy:
88
runs-on: ubuntu-latest
9-
permissions:
10-
contents: write
119
env:
1210
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
1311
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1412
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1513
steps:
1614
- uses: actions/checkout@v4
17-
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
1815

19-
- name: Deploy to Vercel
20-
uses: amondnet/vercel-action@v25
16+
- uses: pnpm/action-setup@v4
17+
with:
18+
version: 9
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: pnpm
23+
- name: Install & Build
24+
run: |
25+
pnpm i --frozen-lockfile
26+
pnpm build
27+
28+
- uses: amondnet/vercel-action@v25
2129
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
2230
with:
2331
vercel-token: ${{ secrets.VERCEL_TOKEN }}
2432
github-token: ${{ secrets.GITHUB_TOKEN }}
2533
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
2634
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
27-
working-directory: ./
35+
working-directory: ./dist

.gitpod.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ vscode:
2121
- eamodio.gitlens
2222
- github.vscode-pull-request-github
2323
- github.vscode-github-actions
24+
- streetsidesoftware.code-spell-checker
25+
2426
tasks:
2527
- init: pnpm i
2628
command: npm start

ReadMe.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
## Technology stack
1313

1414
- Language: [TypeScript v5][2]
15-
- Component engine: [PReact v10][9]
15+
- Component engine: [React v18][1]
1616
- State management: [MobX v6][3]
1717
- Component suite: [React Bootstrap v2][10]
1818
- HTTP Client: [KoAJAX v1][11]
@@ -72,7 +72,6 @@ pnpm build
7272
[6]: https://github.com/idea2app/React-MobX-Bootstrap-ts/actions/workflows/main.yml
7373
[7]: https://codespaces.new/idea2app/React-MobX-Bootstrap-ts
7474
[8]: https://gitpod.io/?autostart=true#https://github.com/idea2app/React-MobX-Bootstrap-ts
75-
[9]: https://preactjs.com/
7675
[10]: https://react-bootstrap.github.io/
7776
[11]: https://github.com/EasyWebApp/KoAJAX
7877
[12]: https://developers.google.com/web/tools/workbox

eslint.config.mjs

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

package.json

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,77 @@
55
"author": "[email protected]",
66
"dependencies": {
77
"@editorjs/code": "^2.9.0",
8-
"@editorjs/editorjs": "^2.29.1",
9-
"@editorjs/header": "^2.8.1",
10-
"@editorjs/image": "^2.9.0",
8+
"@editorjs/editorjs": "^2.30.5",
9+
"@editorjs/header": "^2.8.7",
10+
"@editorjs/image": "^2.9.3",
1111
"@editorjs/link": "^2.6.2",
12-
"@editorjs/list": "^1.9.0",
13-
"@editorjs/paragraph": "^2.11.5",
14-
"@editorjs/quote": "^2.6.0",
12+
"@editorjs/list": "^1.10.0",
13+
"@editorjs/paragraph": "^2.11.6",
14+
"@editorjs/quote": "^2.7.2",
1515
"browser-fs-access": "^0.35.0",
1616
"browser-unhandled-rejection": "^1.0.2",
17-
"echarts-jsx": "^1.2.0",
17+
"echarts-jsx": "^1.2.1",
1818
"editorjs-html": "^3.4.3",
1919
"idea-react": "^2.0.0-rc.2",
20-
"koajax": "^1.1.2",
20+
"koajax": "^3.0.2",
2121
"lodash": "^4.17.21",
22-
"mobx": "^6.12.4",
23-
"mobx-github": "^0.3.2",
22+
"mobx": "^6.13.2",
23+
"mobx-github": "^0.3.4",
2424
"mobx-i18n": "^0.5.0",
2525
"mobx-react": "^9.1.1",
26-
"mobx-restful": "^1.0.0",
27-
"mobx-restful-table": "^2.0.0-rc.1",
28-
"preact": "^10.22.0",
29-
"react-bootstrap": "^2.10.3",
26+
"mobx-restful": "^1.0.1",
27+
"mobx-restful-table": "^2.0.0",
28+
"react": "^18.3.1",
29+
"react-dom": "^18.3.1",
30+
"react-bootstrap": "^2.10.4",
3031
"react-bootstrap-editor": "^2.0.4",
3132
"react-editor-js": "^2.1.0",
3233
"react-router-class-tools": "^0.1.3",
33-
"react-router-dom": "^6.24.0",
34+
"react-router-dom": "^6.26.2",
3435
"web-utility": "^4.4.0"
3536
},
3637
"devDependencies": {
37-
"@babel/runtime": "^7.24.7",
38+
"@babel/runtime": "^7.25.6",
39+
"@eslint/compat": "^1.1.1",
40+
"@eslint/js": "^9.10.0",
3841
"@parcel/config-default": "~2.12.0",
3942
"@parcel/packager-raw-url": "~2.12.0",
4043
"@parcel/transformer-less": "~2.12.0",
4144
"@parcel/transformer-typescript-tsc": "~2.12.0",
4245
"@parcel/transformer-webmanifest": "~2.12.0",
43-
"@types/lodash": "^4.17.5",
44-
"@types/node": "^18.19.39",
46+
"@types/lodash": "^4.17.7",
47+
"@types/node": "^20.16.5",
48+
"@types/react": "^18.3.5",
49+
"@types/react-dom": "^18.3.0",
50+
"@typescript-eslint/eslint-plugin": "^8.5.0",
51+
"@typescript-eslint/parser": "^8.5.0",
4552
"buffer": "^6.0.3",
46-
"husky": "^9.0.11",
47-
"lint-staged": "^15.2.7",
53+
"eslint": "^9.10.0",
54+
"eslint-config-prettier": "^9.1.0",
55+
"eslint-plugin-react": "^7.36.1",
56+
"eslint-plugin-simple-import-sort": "^12.1.1",
57+
"eslint-plugin-spellcheck": "^0.0.20",
58+
"globals": "^15.9.0",
59+
"husky": "^9.1.6",
60+
"lint-staged": "^15.2.10",
4861
"parcel": "~2.12.0",
49-
"parcel-transformer-mdx": "^0.3.3",
50-
"prettier": "^3.3.2",
62+
"parcel-transformer-mdx": "^0.4.2",
63+
"prettier": "^3.3.3",
5164
"prismjs": "^1.29.0",
5265
"process": "^0.11.10",
53-
"typescript": "~5.5.2",
66+
"typescript": "~5.6.2",
67+
"typescript-eslint": "^8.5.0",
5468
"workbox-cli": "^7.1.0"
5569
},
56-
"alias": {
57-
"react": "preact/compat",
58-
"react-dom/test-utils": "preact/test-utils",
59-
"react-dom": "preact/compat",
60-
"react/jsx-runtime": "preact/jsx-runtime"
61-
},
6270
"prettier": {
6371
"singleQuote": true,
6472
"trailingComma": "none",
6573
"arrowParens": "avoid",
6674
"tabWidth": 4
6775
},
6876
"lint-staged": {
69-
"*.{html,md,less,json,yml,js,ts,tsx}": "prettier --write"
77+
"*.{html,md,less,json,yml,js,mjs,ts,tsx}": "prettier --write",
78+
"*.{js,mjs,ts,tsx}": "eslint --fix"
7079
},
7180
"browserslist": "> 0.5%, last 2 versions, not dead, IE 11",
7281
"scripts": {

0 commit comments

Comments
 (0)