From d226cfcd7a74bef41b842891c270ca464c680426 Mon Sep 17 00:00:00 2001 From: TonyRL Date: Wed, 15 Feb 2023 11:43:58 +0000 Subject: [PATCH] chore: replace reviewdog with eslint with sarif --- .github/workflows/pr-lint.yml | 47 +++++++++++++++++++++-------------- package.json | 1 + yarn.lock | 22 +++++++++++++++- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml index b49b484c9..7ef28c4ea 100644 --- a/.github/workflows/pr-lint.yml +++ b/.github/workflows/pr-lint.yml @@ -3,7 +3,22 @@ name: Linter on: [push, pull_request, pull_request_target] jobs: - linter: + eslint: + name: ESLint + if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: 'yarn' + - run: yarn + - name: Lint + run: yarn lint + + eslint-warning: name: Lint if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} runs-on: ubuntu-latest @@ -17,22 +32,15 @@ jobs: - run: yarn - name: Lint run: yarn lint - reviewdog: - name: reviewdog - if: ${{ github.event_name == 'pull_request' }} - runs-on: ubuntu-latest - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + --format @microsoft/eslint-formatter-sarif + --output-file eslint-results.sarif + continue-on-error: true + - name: Upload analysis results to GitHub + uses: github/codeql-action/upload-sarif@v2 with: - node-version: 18 - cache: 'yarn' - - run: yarn - - name: Lint - uses: reviewdog/action-eslint@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + sarif_file: eslint-results.sarif + wait-for-processing: true + titleLint: if: ${{ github.event_name == 'pull_request_target' }} name: Validate PR title @@ -45,6 +53,7 @@ jobs: ignoreLabels: | dependencies wip: true + labeler: name: Pull Request Labeler if: ${{ github.event_name == 'pull_request_target' }} @@ -54,6 +63,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/labeler@v4 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/labeler@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index 7934776f7..0fc0d843c 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ }, "homepage": "https://github.com/DIYgod/RSSHub#readme", "devDependencies": { + "@microsoft/eslint-formatter-sarif": "3.0.0", "@napi-rs/pinyin": "1.7.1", "@types/koa": "2.13.5", "@vercel/nft": "0.22.6", diff --git a/yarn.lock b/yarn.lock index e7a809c04..a7dc8ee12 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1343,6 +1343,16 @@ semver "^7.3.5" tar "^6.1.11" +"@microsoft/eslint-formatter-sarif@3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@microsoft/eslint-formatter-sarif/-/eslint-formatter-sarif-3.0.0.tgz#422382a1759c35a014fb96e77799cbce47fdb2fd" + integrity sha512-KIKkT44hEqCzqxODYwFMUvYEK0CrdHx/Ll9xiOWgFbBSRuzbxmVy4d/tzfgoucGz72HJZNOMjuyzFTBKntRK5Q== + dependencies: + eslint "^8.9.0" + jschardet latest + lodash "^4.17.14" + utf8 "^3.0.0" + "@mrmlnc/readdir-enhanced@^2.2.1": version "2.2.1" resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde" @@ -5713,7 +5723,7 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@8.34.0: +eslint@8.34.0, eslint@^8.9.0: version "8.34.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.34.0.tgz#fe0ab0ef478104c1f9ebc5537e303d25a8fb22d6" integrity sha512-1Z8iFsucw+7kSqXNZVslXS8Ioa4u2KM7GPwuKtkTFAqZ/cHMcEaR+1+Br0wLlot49cNxIiZk5wp8EAbPcYZxTg== @@ -8612,6 +8622,11 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== +jschardet@latest: + version "3.0.0" + resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-3.0.0.tgz#898d2332e45ebabbdb6bf2feece9feea9a99e882" + integrity sha512-lJH6tJ77V8Nzd5QWRkFYCLc13a3vADkh3r/Fi8HupZGWk2OVVDfnZP8V/VgQgZ+lzW0kG2UGb5hFgt3V3ndotQ== + jsdom@21.1.0: version "21.1.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-21.1.0.tgz#d56ba4a84ed478260d83bd53dc181775f2d8e6ef" @@ -13928,6 +13943,11 @@ use@^3.1.0: resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== +utf8@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" + integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== + util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"