From 690f4faa56db1adf59ac0b7b79dba35a457f075e Mon Sep 17 00:00:00 2001 From: Filipe Casal Date: Thu, 3 Oct 2024 11:29:08 +0200 Subject: [PATCH] chore: add lint for missing return types --- .eslintrc.json | 1 + src/codeMarker.ts | 4 ++-- src/types.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e1bbe36..0003f18 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,6 +19,7 @@ ], "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", + "@typescript-eslint/explicit-function-return-type": "warn", "curly": "warn", "eqeqeq": "warn", "no-throw-literal": "warn", diff --git a/src/codeMarker.ts b/src/codeMarker.ts index bb11aea..2fd267b 100644 --- a/src/codeMarker.ts +++ b/src/codeMarker.ts @@ -1025,7 +1025,7 @@ class WARoot { * @param auditRemote The audit remote to be configured. * @param gitSha The git SHA digest to be configured. */ - updateGitConfig(clientRemote: string, auditRemote: string, gitSha: string) { + updateGitConfig(clientRemote: string, auditRemote: string, gitSha: string): void { this.clientRemote = clientRemote; this.gitRemote = auditRemote; this.gitSha = gitSha; @@ -1059,7 +1059,7 @@ class MultiRootManager { this.roots.map((root) => ({ rootPath: root.rootPath, rootLabel: root.getRootLabel() }) as RootPathAndLabel), ); // Add a listener for changes to the roots - const listener = async (event: vscode.WorkspaceFoldersChangeEvent) => { + const listener = async (event: vscode.WorkspaceFoldersChangeEvent): Promise => { // Any removed or added roots will execute weAudit.toggleSavedFindings, which will cause a refresh // of the tree, and hence a recreation of the pathToEntryMap (which is important in case there is // only one workspace root left) diff --git a/src/types.ts b/src/types.ts index 5101a6e..37a9b73 100644 --- a/src/types.ts +++ b/src/types.ts @@ -203,7 +203,7 @@ export interface EntryDetails { * Creates a default entry details object. * @returns the default entry details object */ -export function createDefaultEntryDetails() { +export function createDefaultEntryDetails(): EntryDetails { return { severity: FindingSeverity.Undefined, difficulty: FindingDifficulty.Undefined, @@ -376,7 +376,7 @@ export function getEntryIndexFromArray(entry: Entry, array: Entry[]): number { return -1; } -export function mergeTwoEntryArrays(a: Entry[], b: Entry[]) { +export function mergeTwoEntryArrays(a: Entry[], b: Entry[]): Entry[] { // merge two arrays of entries // without duplicates const result: Entry[] = a;