From f2fb191b52cdb86f36d9b352d2877d8243e162a6 Mon Sep 17 00:00:00 2001 From: hi2hi Date: Fri, 6 Dec 2024 09:38:41 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=20ESLint=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E4=BB=A5=E6=94=AF=E6=8C=81Pull=20Re?= =?UTF-8?q?quests=E4=B8=AD=E7=9A=84=E4=BB=A3=E7=A0=81=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E5=9C=A8=20package.json=20=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20lint=20=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/eslint.yml | 31 +++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/eslint.yml diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..4b37fb0 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,31 @@ +name: ESLint Lint for Pull Requests + +on: + pull_request: + paths: + - '**/*.js' + - '**/*.ts' + - '**/*.vue' + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + # 检出代码 + - name: Checkout code + uses: actions/checkout@v3 + + # 设置 Node.js 环境 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '20' + + # 安装依赖 + - name: Install dependencies + run: npm install + + # 运行 ESLint + - name: Run ESLint + run: npm run lint diff --git a/package.json b/package.json index 44078cd..6027afc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "scripts": { "dev": "vite", "build": "vite build", - "preview": "vite preview" + "preview": "vite preview", + "lint": "eslint ." }, "dependencies": { "axios": "^1.7.7",