From e11b0cef47dba6226053a4bb3bf9a00ad6c0974b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 24 Aug 2022 11:08:26 +0100 Subject: [PATCH] Add static analysis for tsc --strict (#9212) * Add static analysis for tsc --strict * Make tsconfig legal * Make tsconfig more legal * Update static_analysis.yaml * Test strict mode check * Revert "Test strict mode check" This reverts commit 879df9879738fabfa02466ce07634a0f5c132311. --- .github/workflows/static_analysis.yaml | 37 +++++++++++++++++++++++++- tsconfig.json | 4 +-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.github/workflows/static_analysis.yaml b/.github/workflows/static_analysis.yaml index 4df819375a..f6e78eda96 100644 --- a/.github/workflows/static_analysis.yaml +++ b/.github/workflows/static_analysis.yaml @@ -90,5 +90,40 @@ jobs: - name: Dead Code Analysis run: | - cd element-web + cd element-web yarn run analyse:unused-exports + + tsc-strict: + name: Typescript Strict Error Checker + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + permissions: + pull-requests: read + checks: write + steps: + - uses: actions/checkout@v3 + + - name: Get diff lines + id: diff + uses: Equip-Collaboration/diff-line-numbers@v1.0.0 + with: + include: '["\\.tsx?$"]' + + - name: Detecting files changed + id: files + uses: futuratrepadeira/changed-files@v3.2.1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + pattern: '^.*\.tsx?$' + + - uses: t3chguy/typescript-check-action@main + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + use-check: false + check-fail-mode: added + output-behaviour: annotate + ts-extra-args: '--strict' + files-changed: ${{ steps.files.outputs.files_updated }} + files-added: ${{ steps.files.outputs.files_created }} + files-deleted: ${{ steps.files.outputs.files_deleted }} + line-numbers: ${{ steps.diff.outputs.lineNumbers }} diff --git a/tsconfig.json b/tsconfig.json index ec0d70c8e0..27b0f94864 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,13 +17,13 @@ "es2020", "dom", "dom.iterable" - ], + ] }, "include": [ "./src/**/*.ts", "./src/**/*.tsx", "./test/**/*.ts", - "./test/**/*.tsx", + "./test/**/*.tsx" ], "exclude": [ "./test/end-to-end-tests/"