Skip to content

Commit

Permalink
Add static analysis for tsc --strict (matrix-org#2615)
Browse files Browse the repository at this point in the history
* Initial attempt at CI to annotate new TSC errors

* Make tsconfig file valid

* enable debug

* Specify commit

* Fix commit specification

* Switch back to main

* Tweak permissions

* Add strict mode failure

* Attempt number two

* Fix ts-extra-args

* Add static analysis for tsc --strict
  • Loading branch information
t3chguy authored Aug 23, 2022
1 parent 1df329d commit 8e646ea
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,38 @@ jobs:

- name: Generate Docs
run: "yarn run gendoc"

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/[email protected]
with:
include: '["\\.tsx?$"]'

- name: Detecting files changed
id: files
uses: futuratrepadeira/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pattern: '^.*\.tsx?$'

- uses: t3chguy/typescript-check-action@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
use-check: true
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 }}
3 changes: 1 addition & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export function decodeParams(query: string): QueryDict {
* variables with. E.g. { "$bar": "baz" }.
* @return {string} The result of replacing all template variables e.g. '/foo/baz'.
*/
export function encodeUri(pathTemplate: string,
variables: Record<string, string>): string {
export function encodeUri(pathTemplate: string, variables: Record<string, string>): string {
for (const key in variables) {
if (!variables.hasOwnProperty(key)) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
},
"include": [
"./src/**/*.ts",
"./spec/**/*.ts",
"./spec/**/*.ts"
]
}

0 comments on commit 8e646ea

Please sign in to comment.