Skip to content

Commit 17e6e6e

Browse files
Nateowamimarksvc
andauthored
Enable promise linting in RealtimeServer (#3414)
Co-authored-by: marksvc <marksvc@gmail.com>
1 parent fa3da55 commit 17e6e6e

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

src/RealtimeServer/.eslintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
],
3636
"@typescript-eslint/naming-convention": ["error", { "selector": "enumMember", "format": ["PascalCase"] }],
3737
"@typescript-eslint/no-explicit-any": "off",
38+
"@typescript-eslint/no-floating-promises": "error",
39+
"@typescript-eslint/no-misused-promises": "error",
3840
"@typescript-eslint/no-non-null-assertion": "off",
3941
"@typescript-eslint/no-unused-vars": [
4042
"error",
@@ -63,6 +65,10 @@
6365
],
6466
"no-underscore-dangle": "off"
6567
}
68+
},
69+
{
70+
"files": ["*.spec.ts"],
71+
"rules": { "@typescript-eslint/no-floating-promises": "off", "@typescript-eslint/no-misused-promises": "off" }
6672
}
6773
]
6874
}

src/RealtimeServer/scriptureforge/migrator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ async function runMigrations() {
6868
}
6969
}
7070

71-
runMigrations();
71+
void runMigrations();

src/RealtimeServer/scriptureforge/services/note-thread-service.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,22 @@ export class NoteThreadService extends SFProjectDataService<NoteThread> {
222222
return applicableDomains;
223223
}
224224

225-
protected onDelete(userId: string, docId: string, projectDomain: string, entity: OwnedData): Promise<void> {
225+
protected async onDelete(userId: string, docId: string, projectDomain: string, entity: OwnedData): Promise<void> {
226226
if (projectDomain === SFProjectDomain.Notes) {
227-
this.removeEntityHaveReadRefs(userId, docId, projectDomain, entity);
227+
await this.removeEntityHaveReadRefs(userId, docId, projectDomain, entity);
228228
}
229-
return Promise.resolve();
230229
}
231230

232-
protected onBeforeDelete(userId: string, docId: string, projectDomain: string, entity: OwnedData): Promise<void> {
231+
protected async onBeforeDelete(
232+
userId: string,
233+
docId: string,
234+
projectDomain: string,
235+
entity: OwnedData
236+
): Promise<void> {
233237
// Process an incoming deletion for a NoteThread before it happens so we can look at its list of notes.
234238
if (projectDomain === SFProjectDomain.PTNoteThreads) {
235-
this.removeEntityHaveReadRefs(userId, docId, projectDomain, entity);
239+
await this.removeEntityHaveReadRefs(userId, docId, projectDomain, entity);
236240
}
237-
return Promise.resolve();
238241
}
239242

240243
private async removeEntityHaveReadRefs(

src/RealtimeServer/scriptureforge/services/question-service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,15 @@ export class QuestionService extends SFProjectDataService<Question> {
238238
];
239239
}
240240

241-
protected onDelete(userId: string, docId: string, projectDomain: SFProjectDomain, entity: OwnedData): Promise<void> {
241+
protected async onDelete(
242+
userId: string,
243+
docId: string,
244+
projectDomain: SFProjectDomain,
245+
entity: OwnedData
246+
): Promise<void> {
242247
if (projectDomain === SFProjectDomain.Answers || projectDomain === SFProjectDomain.AnswerComments) {
243-
this.removeEntityReadRefs(userId, docId, projectDomain, entity);
248+
await this.removeEntityReadRefs(userId, docId, projectDomain, entity);
244249
}
245-
return Promise.resolve();
246250
}
247251

248252
private async removeEntityReadRefs(

0 commit comments

Comments
 (0)