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",