Skip to content

Commit

Permalink
[optimize] upgrade to Node.js 20, ESLint 9 & other latest Upstream pa…
Browse files Browse the repository at this point in the history
…ckages/actions
  • Loading branch information
TechQuery committed Nov 8, 2024
1 parent a9f0db4 commit 24b7c99
Show file tree
Hide file tree
Showing 22 changed files with 2,569 additions and 1,201 deletions.
32 changes: 0 additions & 32 deletions .eslintrc.json

This file was deleted.

13 changes: 7 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,29 @@ jobs:
Build-and-Publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
registry-url: https://registry.npmjs.org
cache: pnpm
- name: Install Dependencies
run: pnpm i --frozen-lockfile

- name: Build & Publish
run: npm publish
run: npm publish --access public provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Update document
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./docs
personal_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: pnpm
- name: Install & Build
run: |
Expand Down
11 changes: 3 additions & 8 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
*.sh
.parcel*
.eslintrc.json
.*
eslint.config.mjs
jest.config.ts
test/
preview/
Contributing.md
docs/
.husky/
.github/
.vscode/
.gitpod.yml
.vercel/
docs/
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
provenance = true
auto-install-peers = false
69 changes: 69 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { fixupPluginRules } from '@eslint/compat';
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import reactPlugin from 'eslint-plugin-react';
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
import { fileURLToPath } from 'url';

const tsconfigRootDir = fileURLToPath(new URL('.', import.meta.url));

export default tsEslint.config(
// register all of the plugins up-front
{
plugins: {
'@typescript-eslint': tsEslint.plugin,
// @ts-expect-error https://github.com/jsx-eslint/eslint-plugin-react/issues/3699
react: fixupPluginRules(reactPlugin),
'simple-import-sort': simpleImportSortPlugin
}
},
// config with just ignores is the replacement for `.eslintignore`
{ ignores: ['**/node_modules/**', '**/dist/**', '**/.parcel-cache/**'] },

// extends ...
eslint.configs.recommended,
...tsEslint.configs.recommended,

// base config
{
languageOptions: {
globals: { ...globals.es2022, ...globals.browser, ...globals.node },
parserOptions: {
projectService: true,
tsconfigRootDir,
warnOnUnsupportedTypeScriptVersion: false
}
},
rules: {
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
'react/jsx-no-target-blank': 'warn',
'react/jsx-sort-props': [
'error',
{
reservedFirst: true,
callbacksLast: true,
noSortAlphabetically: true
}
]
}
},
{
files: ['**/*.js'],
extends: [tsEslint.configs.disableTypeChecked],
rules: {
// turn off other type-aware rules
'@typescript-eslint/internal/no-poorly-typed-ts-props': 'off',

// turn off rules that don't apply to JS code
'@typescript-eslint/explicit-function-return-type': 'off'
}
},
eslintConfigPrettier
);
41 changes: 23 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,51 @@
"source": "source/index.ts",
"types": "dist/index.d.ts",
"dependencies": {
"@swc/helpers": "^0.5.12",
"dom-renderer": "^2.3.0",
"@swc/helpers": "^0.5.13",
"dom-renderer": "^2.4.1",
"mobx": ">=6.11",
"regenerator-runtime": "^0.14.1",
"web-utility": "^4.4.0"
"web-utility": "^4.4.2"
},
"peerDependencies": {
"@webcomponents/webcomponentsjs": "^2.8",
"core-js": "^3",
"jsdom": ">=23.1"
},
"devDependencies": {
"@eslint/compat": "^1.2.2",
"@eslint/js": "^9.14.0",
"@parcel/config-default": "~2.12.0",
"@parcel/packager-ts": "~2.12.0",
"@parcel/transformer-typescript-tsc": "~2.12.0",
"@parcel/transformer-typescript-types": "~2.12.0",
"@types/dom-view-transitions": "^1.0.5",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^8.1.0",
"@typescript-eslint/parser": "^8.1.0",
"core-js": "^3.38.0",
"element-internals-polyfill": "^1.3.11",
"eslint": "^8.57.0",
"@types/eslint-config-prettier": "^6.11.3",
"@types/jest": "^29.5.14",
"@types/node": "^20.17.6",
"core-js": "^3.39.0",
"element-internals-polyfill": "^1.3.12",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.1.4",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^15.12.0",
"husky": "^9.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^24.1.1",
"lint-staged": "^15.2.9",
"jsdom": "^25.0.1",
"lint-staged": "^15.2.10",
"open-cli": "^8.0.0",
"parcel": "~2.12.0",
"prettier": "^3.3.3",
"prettier-plugin-sh": "^0.14.0",
"replace": "^1.2.2",
"rimraf": "^5.0.10",
"ts-jest": "^29.2.4",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typedoc": "^0.26.5",
"typedoc-plugin-mdn-links": "^3.2.8",
"typescript": "~5.5.4"
"typedoc": "^0.26.11",
"typedoc-plugin-mdn-links": "^3.3.6",
"typescript": "~5.6.3",
"typescript-eslint": "^8.13.0"
},
"scripts": {
"prepare": "husky",
Expand Down
Loading

0 comments on commit 24b7c99

Please sign in to comment.