Skip to content

Commit 7061ce1

Browse files
committed
[optimize] upgrade to Node.js 20, ESLint 9 & other latest Upstream packages/actions
1 parent a9f0db4 commit 7061ce1

22 files changed

+2569
-1201
lines changed

.eslintrc.json

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

.github/workflows/main.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,29 @@ jobs:
77
Build-and-Publish:
88
runs-on: ubuntu-latest
99
permissions:
10+
contents: write
1011
id-token: write
1112
steps:
12-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1314

14-
- uses: pnpm/action-setup@v2
15+
- uses: pnpm/action-setup@v4
1516
with:
1617
version: 9
17-
- uses: actions/setup-node@v3
18+
- uses: actions/setup-node@v4
1819
with:
19-
node-version: 18
20+
node-version: 20
2021
registry-url: https://registry.npmjs.org
2122
cache: pnpm
2223
- name: Install Dependencies
2324
run: pnpm i --frozen-lockfile
2425

2526
- name: Build & Publish
26-
run: npm publish
27+
run: npm publish --access public provenance
2728
env:
2829
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2930

3031
- name: Update document
31-
uses: peaceiris/actions-gh-pages@v3
32+
uses: peaceiris/actions-gh-pages@v4
3233
with:
3334
publish_dir: ./docs
3435
personal_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/push.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515

16-
- uses: pnpm/action-setup@v2
16+
- uses: pnpm/action-setup@v4
1717
with:
1818
version: 9
19-
- uses: actions/setup-node@v3
19+
- uses: actions/setup-node@v4
2020
with:
21-
node-version: 18
21+
node-version: 20
2222
cache: pnpm
2323
- name: Install & Build
2424
run: |

.npmignore

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
*.sh
2-
.parcel*
3-
.eslintrc.json
2+
.*
3+
eslint.config.mjs
44
jest.config.ts
55
test/
66
preview/
77
Contributing.md
8-
docs/
9-
.husky/
10-
.github/
11-
.vscode/
12-
.gitpod.yml
13-
.vercel/
8+
docs/

.npmrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
provenance = true
21
auto-install-peers = false

eslint.config.mjs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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 { fileURLToPath } from 'url';
9+
10+
const tsconfigRootDir = 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+
// @ts-expect-error https://github.com/jsx-eslint/eslint-plugin-react/issues/3699
18+
react: fixupPluginRules(reactPlugin),
19+
'simple-import-sort': simpleImportSortPlugin
20+
}
21+
},
22+
// config with just ignores is the replacement for `.eslintignore`
23+
{ ignores: ['**/node_modules/**', '**/dist/**', '**/.parcel-cache/**'] },
24+
25+
// extends ...
26+
eslint.configs.recommended,
27+
...tsEslint.configs.recommended,
28+
29+
// base config
30+
{
31+
languageOptions: {
32+
globals: { ...globals.es2022, ...globals.browser, ...globals.node },
33+
parserOptions: {
34+
projectService: true,
35+
tsconfigRootDir,
36+
warnOnUnsupportedTypeScriptVersion: false
37+
}
38+
},
39+
rules: {
40+
'simple-import-sort/exports': 'error',
41+
'simple-import-sort/imports': 'error',
42+
'@typescript-eslint/no-unused-vars': 'warn',
43+
'@typescript-eslint/no-explicit-any': 'warn',
44+
'@typescript-eslint/no-empty-object-type': 'off',
45+
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
46+
'react/jsx-no-target-blank': 'warn',
47+
'react/jsx-sort-props': [
48+
'error',
49+
{
50+
reservedFirst: true,
51+
callbacksLast: true,
52+
noSortAlphabetically: true
53+
}
54+
]
55+
}
56+
},
57+
{
58+
files: ['**/*.js'],
59+
extends: [tsEslint.configs.disableTypeChecked],
60+
rules: {
61+
// turn off other type-aware rules
62+
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',
63+
64+
// turn off rules that don't apply to JS code
65+
'@typescript-eslint/explicit-function-return-type': 'off'
66+
}
67+
},
68+
eslintConfigPrettier
69+
);

package.json

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,46 +26,51 @@
2626
"source": "source/index.ts",
2727
"types": "dist/index.d.ts",
2828
"dependencies": {
29-
"@swc/helpers": "^0.5.12",
30-
"dom-renderer": "^2.3.0",
29+
"@swc/helpers": "^0.5.13",
30+
"dom-renderer": "^2.4.1",
3131
"mobx": ">=6.11",
3232
"regenerator-runtime": "^0.14.1",
33-
"web-utility": "^4.4.0"
33+
"web-utility": "^4.4.2"
3434
},
3535
"peerDependencies": {
3636
"@webcomponents/webcomponentsjs": "^2.8",
3737
"core-js": "^3",
3838
"jsdom": ">=23.1"
3939
},
4040
"devDependencies": {
41+
"@eslint/compat": "^1.2.2",
42+
"@eslint/js": "^9.14.0",
4143
"@parcel/config-default": "~2.12.0",
4244
"@parcel/packager-ts": "~2.12.0",
4345
"@parcel/transformer-typescript-tsc": "~2.12.0",
4446
"@parcel/transformer-typescript-types": "~2.12.0",
45-
"@types/dom-view-transitions": "^1.0.5",
46-
"@types/jest": "^29.5.12",
47-
"@typescript-eslint/eslint-plugin": "^8.1.0",
48-
"@typescript-eslint/parser": "^8.1.0",
49-
"core-js": "^3.38.0",
50-
"element-internals-polyfill": "^1.3.11",
51-
"eslint": "^8.57.0",
47+
"@types/eslint-config-prettier": "^6.11.3",
48+
"@types/jest": "^29.5.14",
49+
"@types/node": "^20.17.6",
50+
"core-js": "^3.39.0",
51+
"element-internals-polyfill": "^1.3.12",
52+
"eslint": "^9.14.0",
5253
"eslint-config-prettier": "^9.1.0",
53-
"husky": "^9.1.4",
54+
"eslint-plugin-react": "^7.37.2",
55+
"eslint-plugin-simple-import-sort": "^12.1.1",
56+
"globals": "^15.12.0",
57+
"husky": "^9.1.6",
5458
"jest": "^29.7.0",
5559
"jest-environment-jsdom": "^29.7.0",
56-
"jsdom": "^24.1.1",
57-
"lint-staged": "^15.2.9",
60+
"jsdom": "^25.0.1",
61+
"lint-staged": "^15.2.10",
5862
"open-cli": "^8.0.0",
5963
"parcel": "~2.12.0",
6064
"prettier": "^3.3.3",
6165
"prettier-plugin-sh": "^0.14.0",
6266
"replace": "^1.2.2",
63-
"rimraf": "^5.0.10",
64-
"ts-jest": "^29.2.4",
67+
"rimraf": "^6.0.1",
68+
"ts-jest": "^29.2.5",
6569
"ts-node": "^10.9.2",
66-
"typedoc": "^0.26.5",
67-
"typedoc-plugin-mdn-links": "^3.2.8",
68-
"typescript": "~5.5.4"
70+
"typedoc": "^0.26.11",
71+
"typedoc-plugin-mdn-links": "^3.3.6",
72+
"typescript": "~5.6.3",
73+
"typescript-eslint": "^8.13.0"
6974
},
7075
"scripts": {
7176
"prepare": "husky",

0 commit comments

Comments
 (0)