Skip to content

Commit 5392390

Browse files
committed
[migrate] upgrade to Node.js 20, ESLint 9, KoAJAX 3 & MobX-RESTful 2
[add] Prettier CSS plugins [optimize] update Upstream packages
1 parent 4f0996f commit 5392390

File tree

7 files changed

+2836
-2507
lines changed

7 files changed

+2836
-2507
lines changed

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: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,48 +19,60 @@
1919
"url": "https://github.com/EasyWebApp/WebCell-dashboard/issues"
2020
},
2121
"dependencies": {
22-
"boot-cell": "^2.0.0-beta.27",
22+
"boot-cell": "^2.0.0-beta.29",
2323
"browser-unhandled-rejection": "^1.0.2",
24-
"cell-router": "^3.0.0-rc.7",
24+
"cell-router": "^3.0.0-rc.8",
2525
"classnames": "^2.5.1",
26-
"dom-renderer": "^2.1.8",
27-
"echarts-jsx": "^1.2.0",
28-
"koajax": "^1.1.2",
29-
"mobx": "^6.12.4",
30-
"mobx-restful": "1.0.0-rc.5",
31-
"web-cell": "^3.0.0-rc.16",
32-
"web-utility": "^4.4.0"
26+
"dom-renderer": "^2.4.2",
27+
"echarts-jsx": "^1.2.1",
28+
"koajax": "^3.0.3",
29+
"mobx": "^6.13.5",
30+
"mobx-downloader": "^0.3.0",
31+
"mobx-restful": "2.0.0",
32+
"web-cell": "^3.0.0",
33+
"web-utility": "^4.4.2"
3334
},
3435
"devDependencies": {
36+
"@eslint/compat": "^1.2.2",
37+
"@eslint/js": "^9.14.0",
3538
"@octokit/openapi-types": "^22.2.0",
3639
"@parcel/config-default": "~2.12.0",
3740
"@parcel/packager-raw-url": "~2.12.0",
3841
"@parcel/transformer-less": "~2.12.0",
3942
"@parcel/transformer-typescript-tsc": "~2.12.0",
4043
"@parcel/transformer-webmanifest": "~2.12.0",
44+
"@softonus/prettier-plugin-duplicate-remover": "^1.0.1",
4145
"@types/chart.js": "^2.9.41",
42-
"@types/node": "^18.19.34",
43-
"@typescript-eslint/eslint-plugin": "^7.13.0",
44-
"@typescript-eslint/parser": "^7.13.0",
46+
"@types/eslint-config-prettier": "^6.11.3",
47+
"@types/node": "^20.17.6",
4548
"buffer": "^6.0.3",
46-
"eslint": "^8.57.0",
49+
"eslint": "^9.14.0",
4750
"eslint-config-prettier": "^9.1.0",
48-
"husky": "^9.0.11",
49-
"lint-staged": "^15.2.7",
51+
"eslint-plugin-react": "^7.37.2",
52+
"eslint-plugin-simple-import-sort": "^12.1.1",
53+
"globals": "^15.12.0",
54+
"husky": "^9.1.6",
55+
"lint-staged": "^15.2.10",
5056
"parcel": "~2.12.0",
51-
"prettier": "^3.3.2",
52-
"typescript": "~5.4.5",
53-
"workbox-cli": "^7.1.0"
57+
"prettier": "^3.3.3",
58+
"prettier-plugin-css-order": "^2.1.2",
59+
"typescript": "~5.6.3",
60+
"typescript-eslint": "^8.13.0",
61+
"workbox-cli": "^7.3.0"
5462
},
5563
"prettier": {
5664
"singleQuote": true,
5765
"trailingComma": "none",
5866
"arrowParens": "avoid",
59-
"tabWidth": 4
67+
"tabWidth": 4,
68+
"plugins": [
69+
"prettier-plugin-css-order",
70+
"@softonus/prettier-plugin-duplicate-remover"
71+
]
6072
},
6173
"lint-staged": {
62-
"*.{html,md,css,less,json,yml,js,ts,tsx}": "prettier --write",
63-
"*.{js,ts,tsx}": "eslint --fix"
74+
"*.{html,md,css,less,json,yml,js,mjs,ts,tsx}": "prettier --write",
75+
"*.{js,mjs,ts,tsx}": "eslint --fix"
6476
},
6577
"scripts": {
6678
"prepare": "husky",

0 commit comments

Comments
 (0)