From 75ab20c276528686f811c06243e905b7b9ed3427 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 9 May 2026 12:04:16 +0800 Subject: [PATCH] ci: integrate react-doctor for PR health checks Add react-doctor CI workflow to automatically scan PRs for React anti-patterns and code health issues. Configure advisory mode (failOn: none) with project-specific ignore rules for mock, auto-generated, and non-component directories. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/react-doctor.yml | 18 ++++++++++++++++++ package.json | 2 ++ react-doctor.config.json | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 .github/workflows/react-doctor.yml create mode 100644 react-doctor.config.json diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml new file mode 100644 index 00000000..ff885edc --- /dev/null +++ b/.github/workflows/react-doctor.yml @@ -0,0 +1,18 @@ +name: 🏥 React Doctor + +on: push + +permissions: + contents: read + pull-requests: write + +jobs: + react-doctor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: millionco/react-doctor@main + continue-on-error: true + with: + diff: true + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index 198cf253..9513fbb0 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "test": "jest", "test:coverage": "jest --coverage", "test:update": "jest -u", + "doctor": "react-doctor .", "tsc": "tsc --noEmit" }, "browserslist": [ @@ -73,6 +74,7 @@ "@umijs/max-plugin-openapi": "^2.0.3", "@umijs/request-record": "^1.1.4", "cross-env": "^10.1.0", + "react-doctor": "^0.1.2", "express": "^5.2.1", "geojson": "^0.5.0", "gh-pages": "^6.3.0", diff --git a/react-doctor.config.json b/react-doctor.config.json new file mode 100644 index 00000000..37473957 --- /dev/null +++ b/react-doctor.config.json @@ -0,0 +1,18 @@ +{ + "ignore": { + "files": [ + "mock/**", + "src/services/**", + "scripts/**", + "cloudflare-worker/**", + "src/.umi/**", + "src/.umi-production/**", + "src/.umi-test/**", + "**/*.md", + "**/*.less", + "**/*.css" + ] + }, + "failOn": "none", + "adoptExistingLintConfig": true +} \ No newline at end of file