diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 09c2e42..0000000 --- a/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@antfu" -} diff --git a/.vscode/settings.json b/.vscode/settings.json index cf347de..a115cd5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,29 @@ "jsapi", "yunlefun" ], - "typescript.tsdk": "node_modules/typescript/lib" + "typescript.tsdk": "node_modules/typescript/lib", + // Enable the ESlint flat config support + "eslint.experimental.useFlatConfig": true, + // Disable the default formatter, use eslint instead + "prettier.enable": false, + "editor.formatOnSave": false, + // Auto fix + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + // Enable eslint for all supported languages + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml", + "toml" + ] } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..3b614a0 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +import antfu from '@antfu/eslint-config' + +export default antfu() diff --git a/package.json b/package.json index b26b5c9..6aa9ecb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@yunlefun/toolkit-monorepo", "type": "module", "version": "0.0.0", - "packageManager": "pnpm@8.1.0", + "packageManager": "pnpm@8.14.3", "description": "Toolkit for YunLeFun developing.", "author": { "name": "YunLeFun", @@ -22,16 +22,16 @@ "typecheck": "vue-tsc --noEmit" }, "devDependencies": { - "@antfu/eslint-config": "^0.38.4", - "@types/node": "^18.15.11", + "@antfu/eslint-config": "^2.6.3", + "@types/node": "^20.11.7", "@yunlefun/vueuse": "workspace:*", "@yunyoujun/utils": "^0.3.5", - "bumpp": "^9.1.0", - "eslint": "^8.37.0", - "typescript": "^4.8.3", - "unbuild": "^1.2.0", - "vite": "^4.2.1", - "vitest": "^0.29.8", - "vue-tsc": "^1.2.0" + "bumpp": "^9.3.0", + "eslint": "^8.56.0", + "typescript": "^5.3.3", + "unbuild": "^2.0.0", + "vite": "^5.0.12", + "vitest": "^1.2.2", + "vue-tsc": "^1.8.27" } } diff --git a/packages/constants/package.json b/packages/constants/package.json index dcd765a..2bd57fe 100644 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -4,8 +4,8 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "require": "./dist/index.cjs", - "import": "./dist/index.mjs" + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" } }, "main": "./dist/index.mjs", diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index a444c19..febf4a6 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -24,8 +24,8 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "require": "./dist/index.cjs", - "import": "./dist/index.mjs" + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" } }, "main": "./dist/index.mjs", diff --git a/packages/utils/package.json b/packages/utils/package.json index 69cde9e..9c49ef8 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -23,8 +23,8 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "require": "./dist/index.cjs", - "import": "./dist/index.mjs" + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" } }, "main": "./dist/index.mjs", diff --git a/packages/utils/src/lock/index.ts b/packages/utils/src/lock/index.ts index cbe25a3..0d13d2b 100644 --- a/packages/utils/src/lock/index.ts +++ b/packages/utils/src/lock/index.ts @@ -1,7 +1,6 @@ /** * @description can not run async function concurrently * @param fn - * @returns */ export function createAsyncLock(fn: () => Promise) { const state = { @@ -17,9 +16,8 @@ export function createAsyncLock(fn: () => Promise) { state.isLocked = true - return fn() - .finally(() => { - state.isLocked = false - }) + return fn().finally(() => { + state.isLocked = false + }) } } diff --git a/packages/utils/src/wx/helpers.ts b/packages/utils/src/wx/helpers.ts index 4f8df6a..7d12c00 100644 --- a/packages/utils/src/wx/helpers.ts +++ b/packages/utils/src/wx/helpers.ts @@ -1,6 +1,5 @@ /** * 是否在微信浏览器环境 - * @returns */ export function isInWxBrowser() { return /MicroMessenger/.test(navigator.userAgent) diff --git a/packages/utils/src/wx/jsApi/share.ts b/packages/utils/src/wx/jsApi/share.ts index 79ef2bf..16721d7 100644 --- a/packages/utils/src/wx/jsApi/share.ts +++ b/packages/utils/src/wx/jsApi/share.ts @@ -32,8 +32,6 @@ export interface RegisterWxShareOptions extends WxShareInfo { /** * Register Wx Share - * @param options - * @returns */ export function registerWxShare(shareOptions: RegisterWxShareOptions) { const wx = window.wx diff --git a/packages/utils/src/wx/register.ts b/packages/utils/src/wx/register.ts index 1adc7db..2287472 100644 --- a/packages/utils/src/wx/register.ts +++ b/packages/utils/src/wx/register.ts @@ -3,15 +3,14 @@ import { registerWxShare } from './jsApi' import type { WxConfig } from './types' export interface WxInitOptions { - config: WxConfig - onReady?: () => void - onError?: (res: any) => void + config?: Partial; + onReady?: () => void; + onError?: (res: any) => void; } /** * Create wx helpers * @param options - * @returns */ export function createWx(options: WxInitOptions) { if (!isClient) diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index a37979c..3c2e40a 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -1,14 +1,14 @@ { "compilerOptions": { "target": "es2018", - "module": "esnext", "lib": ["ESNext", "DOM", "DOM.Iterable"], + "module": "esnext", "moduleResolution": "node", - "esModuleInterop": true, + "resolveJsonModule": true, "strict": true, "strictNullChecks": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "skipDefaultLibCheck": true + "esModuleInterop": true, + "skipDefaultLibCheck": true, + "skipLibCheck": true } } diff --git a/packages/vueuse/package.json b/packages/vueuse/package.json index 7a850d5..e4fe7e8 100644 --- a/packages/vueuse/package.json +++ b/packages/vueuse/package.json @@ -23,8 +23,8 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "require": "./dist/index.cjs", - "import": "./dist/index.mjs" + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" } }, "main": "./dist/index.mjs", @@ -58,7 +58,7 @@ "@yunlefun/utils": "workspace:*" }, "devDependencies": { - "@vueuse/core": "^9.13.0", - "vue": "^3.2.47" + "@vueuse/core": "^10.7.2", + "vue": "^3.4.15" } } diff --git a/packages/vueuse/src/wx/demo.vue b/packages/vueuse/src/wx/demo.vue index 2555b14..7227688 100644 --- a/packages/vueuse/src/wx/demo.vue +++ b/packages/vueuse/src/wx/demo.vue @@ -1,27 +1,15 @@