Skip to content

Commit

Permalink
[migrate] upgrade to Node.js 20, PNPM 9, ESLint 9 & other latest Upst…
Browse files Browse the repository at this point in the history
…ream packages/actions
  • Loading branch information
TechQuery committed Nov 10, 2024
1 parent 12a2c5c commit eea65e4
Show file tree
Hide file tree
Showing 12 changed files with 6,006 additions and 4,682 deletions.
27 changes: 0 additions & 27 deletions .eslintrc.json

This file was deleted.

12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ jobs:
Build-and-Deploy:
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: 8
- uses: actions/setup-node@v3
version: 9
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: pnpm
- name: Install & Build
run: |
pnpm i --frozen-lockfile
pnpm build
- name: Deploy to GitHub pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./dist
personal_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
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
);
58 changes: 35 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,58 @@
"url": "https://github.com/TechQuery/OAF-event/issues"
},
"dependencies": {
"boot-cell": "^2.0.0-beta.20",
"boot-cell": "^2.0.0-beta.29",
"browser-unhandled-rejection": "^1.0.2",
"classnames": "^2.5.1",
"dom-renderer": "^2.1.3",
"web-cell": "^3.0.0-rc.15",
"web-utility": "^4.1.3"
"dom-renderer": "^2.4.4",
"iterable-observer": "^1.1.0",
"web-cell": "^3.0.1",
"web-utility": "^4.4.2"
},
"devDependencies": {
"@parcel/packager-raw-url": "~2.11.0",
"@parcel/transformer-less": "~2.11.0",
"@parcel/transformer-webmanifest": "~2.11.0",
"@types/node": "^18.19.15",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.56.0",
"@eslint/compat": "^1.2.2",
"@eslint/js": "^9.14.0",
"@parcel/packager-raw-url": "~2.12.0",
"@parcel/transformer-less": "~2.12.0",
"@parcel/transformer-webmanifest": "~2.12.0",
"@softonus/prettier-plugin-duplicate-remover": "^1.0.1",
"@types/eslint-config-prettier": "^6.11.3",
"@types/node": "^20.17.6",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.0.10",
"lint-staged": "^15.2.2",
"parcel": "~2.11.0",
"postcss": "^8.4.35",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"globals": "^15.12.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"parcel": "~2.12.0",
"postcss": "^8.4.48",
"postcss-modules": "^4.3.1",
"prettier": "^3.2.5",
"typescript": "~5.3.3",
"workbox-cli": "^7.0.0"
"prettier": "^3.3.3",
"prettier-plugin-css-order": "^2.1.2",
"typescript": "~5.6.3",
"typescript-eslint": "^8.13.0",
"workbox-cli": "^7.3.0"
},
"prettier": {
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"tabWidth": 4
"tabWidth": 4,
"plugins": [
"prettier-plugin-css-order",
"@softonus/prettier-plugin-duplicate-remover"
]
},
"lint-staged": {
"*.{html,md,css,less,json,yml,js,ts,tsx}": "prettier --write",
"*.{js,ts,tsx}": "eslint --fix"
"*.{html,md,css,less,json,yml,js,mjs,ts,tsx}": "prettier --write",
"*.{js,mjs,ts,tsx}": "eslint --fix"
},
"scripts": {
"prepare": "husky",
"test": "lint-staged",
"test": "lint-staged && tsc --noEmit",
"clean": "rm -rf .parcel-cache/ dist/",
"start": "npm run clean && parcel src/index.html --open",
"start": "npm run clean && parcel src/index.html",
"pack": "npm run clean && parcel build src/index.html --public-url .",
"build": "npm run pack && workbox generateSW"
}
Expand Down
Loading

0 comments on commit eea65e4

Please sign in to comment.