From 8f9c989815033a913feaa2791d6f6ea143f56537 Mon Sep 17 00:00:00 2001 From: alger Date: Sun, 14 Sep 2025 00:21:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=B5=81=E7=A8=8B=20=E6=B7=BB=E5=8A=A0lint-s?= =?UTF-8?q?taged?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-commit | 7 ++++++- .husky/pre-push | 7 ++++++- package.json | 13 +++++++++++-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index f80aed3..6b7a3b7 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,7 @@ +echo "对已暂存文件运行 lint-staged..." +npx lint-staged + echo "运行类型检查..." -npm run typecheck \ No newline at end of file +npm run typecheck + +echo "所有检查通过,准备提交..." \ No newline at end of file diff --git a/.husky/pre-push b/.husky/pre-push index f80aed3..6b7a3b7 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,2 +1,7 @@ +echo "对已暂存文件运行 lint-staged..." +npx lint-staged + echo "运行类型检查..." -npm run typecheck \ No newline at end of file +npm run typecheck + +echo "所有检查通过,准备提交..." \ No newline at end of file diff --git a/package.json b/package.json index a74e856..fe71ce9 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "homepage": "https://github.com/algerkong/AlgerMusicPlayer", "scripts": { "prepare": "husky", - "format": "prettier --write .", - "lint": "eslint . --fix", + "format": "prettier --write ./src", + "lint": "eslint ./src --fix", "typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false", "typecheck": "npm run typecheck:node && npm run typecheck:web", @@ -22,6 +22,14 @@ "build:mac": "npm run build && electron-builder --mac", "build:linux": "npm run build && electron-builder --linux" }, + "lint-staged": { + "*.{ts,tsx,vue,js}": [ + "eslint --fix" + ], + "*.{ts,tsx,vue,js,css,scss,md,json}": [ + "prettier --write" + ] + }, "dependencies": { "@electron-toolkit/preload": "^3.0.1", "@electron-toolkit/utils": "^4.0.0", @@ -76,6 +84,7 @@ "eslint-plugin-vue": "^10.3.0", "eslint-plugin-vue-scoped-css": "^2.11.0", "globals": "^16.3.0", + "lint-staged": "^15.2.10", "howler": "^2.2.4", "lodash": "^4.17.21", "marked": "^15.0.4",