From 4b21a6c792e1bc42ce0f824c7dd7d1426aad2d3b Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 15 Jan 2025 21:26:17 +0100 Subject: [PATCH] Enable Typescript `noImplicitThis` (#33250) - Enable https://www.typescriptlang.org/tsconfig/#noImplicitThis - Wrap Vue Template-Syntax SFCs in [`defineComponent`](https://vuejs.org/api/general#definecomponent) which makes type inference and linter work better - Move `createApp` calls outside the SFCs into separate files - Use [`PropType`](https://vuejs.org/api/utility-types#proptype-t) where appropriate - Some top-level component properties changed order as dictated by the linter - Fix all tsc and lint issues that popped up during these refactors --- tsconfig.json | 1 + web_src/js/components/DashboardRepoList.vue | 14 +-- web_src/js/components/DiffCommitSelector.vue | 13 ++- web_src/js/components/DiffFileList.vue | 4 +- web_src/js/components/DiffFileTree.vue | 6 +- web_src/js/components/DiffFileTreeItem.vue | 4 +- .../js/components/PullRequestMergeForm.vue | 2 +- web_src/js/components/RepoActionView.vue | 104 ++++++------------ .../js/components/RepoActivityTopAuthors.vue | 18 +-- .../js/components/RepoBranchTagSelector.vue | 95 ++++++++-------- web_src/js/components/RepoContributors.vue | 9 +- web_src/js/features/common-organization.ts | 2 +- web_src/js/features/comp/WebHookEditor.ts | 6 +- web_src/js/features/dashboard.ts | 9 ++ web_src/js/features/install.ts | 14 +-- web_src/js/features/pull-view-file.ts | 2 +- web_src/js/features/repo-actions.ts | 47 ++++++++ web_src/js/features/repo-commit.ts | 2 +- web_src/js/features/repo-home.ts | 2 +- web_src/js/features/repo-issue.ts | 2 +- web_src/js/features/repo-settings.ts | 6 +- web_src/js/features/sshkey-helper.ts | 2 +- web_src/js/features/user-settings.ts | 2 +- web_src/js/index.ts | 5 +- web_src/js/modules/fomantic/dimmer.ts | 2 +- web_src/js/modules/fomantic/dropdown.ts | 12 +- web_src/js/modules/fomantic/modal.ts | 2 +- web_src/js/modules/tippy.ts | 2 +- web_src/js/svg.ts | 10 +- 29 files changed, 209 insertions(+), 190 deletions(-) create mode 100644 web_src/js/features/dashboard.ts create mode 100644 web_src/js/features/repo-actions.ts diff --git a/tsconfig.json b/tsconfig.json index d32cca0aaa..c41f9646d6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,6 +23,7 @@ "stripInternal": true, "strict": false, "strictFunctionTypes": true, + "noImplicitThis": true, "noUnusedLocals": true, "noUnusedParameters": true, "noPropertyAccessFromIndexSignature": false, diff --git a/web_src/js/components/DashboardRepoList.vue b/web_src/js/components/DashboardRepoList.vue index 41793d60ed..40ecbba5e3 100644 --- a/web_src/js/components/DashboardRepoList.vue +++ b/web_src/js/components/DashboardRepoList.vue @@ -1,5 +1,5 @@