Skip to content

Commit 4d49d36

Browse files
authored
SF-2996 Warn on unused private class members and fix current warnings (#3256)
1 parent c25590f commit 4d49d36

File tree

8 files changed

+15
-33
lines changed

8 files changed

+15
-33
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/checking/checking/checking.component.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export class CheckingComponent extends DataLoadingComponent implements OnInit, A
155155
};
156156
private questionsRemoteChangesSub?: Subscription;
157157
private text?: TextInfo;
158-
private isProjectAdmin: boolean = false;
159158
private _scriptureAudioPlayer?: CheckingScriptureAudioPlayerComponent;
160159
private _showScriptureAudioPlayer: boolean = false;
161160

@@ -562,10 +561,6 @@ export class CheckingComponent extends DataLoadingComponent implements OnInit, A
562561
this.projectDeleteSub = this.projectDoc.delete$
563562
.pipe(quietTakeUntilDestroyed(this.destroyRef))
564563
.subscribe(() => this.onRemovedFromProject());
565-
566-
this.projectService
567-
.isProjectAdmin(routeProjectId, this.userService.currentUserId)
568-
.then(isAdmin => (this.isProjectAdmin = isAdmin));
569564
}
570565

571566
this.activeQuestionScope = routeScope;

src/SIL.XForge.Scripture/ClientApp/src/app/project/project.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { SFProjectUserConfig } from 'realtime-server/lib/esm/scriptureforge/mode
66
import { lastValueFrom, Observable } from 'rxjs';
77
import { distinctUntilChanged, filter, first, map } from 'rxjs/operators';
88
import { DataLoadingComponent } from 'xforge-common/data-loading-component';
9-
import { DialogService } from 'xforge-common/dialog.service';
109
import { NoticeService } from 'xforge-common/notice.service';
1110
import { UserService } from 'xforge-common/user.service';
1211
import { quietTakeUntilDestroyed } from 'xforge-common/util/rxjs-util';
@@ -29,7 +28,6 @@ export class ProjectComponent extends DataLoadingComponent implements OnInit {
2928
private readonly userService: UserService,
3029
private readonly permissions: PermissionsService,
3130
private readonly resumeCheckingService: ResumeCheckingService,
32-
private readonly dialogService: DialogService,
3331
noticeService: NoticeService,
3432
private destroyRef: DestroyRef
3533
) {

src/SIL.XForge.Scripture/ClientApp/src/app/shared/text/text.component.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,15 +1998,6 @@ class TestEnvironment {
19981998
resolver(textDocBeingGotten);
19991999
this.waitForEditor();
20002000
}
2001-
2002-
/** Assert that in `parentNode`, there are only immediate children with name and order specified in
2003-
* `nodeOrderings`. */
2004-
private assertNodeOrder(parentNode: Node, nodeOrderings: string[]): void {
2005-
const childNodes: string[] = Array.from(parentNode.childNodes).map((n: ChildNode) => n.nodeName.toLowerCase());
2006-
expect(childNodes)
2007-
.withContext(`not expected list of nodes: [${childNodes}] does not match expected [${nodeOrderings}]`)
2008-
.toEqual(nodeOrderings);
2009-
}
20102001
}
20112002

20122003
function basicSimpleText(): { env: TestEnvironment; segmentRange: QuillRange } {

src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ describe('DraftGenerationComponent', () => {
255255
});
256256

257257
it('does not subscribe to build when project does not have drafting enabled', () => {
258-
const _ = new TestEnvironment(() => TestEnvironment.initProject('user01', false));
258+
new TestEnvironment(() => TestEnvironment.initProject('user01', false));
259259
expect(mockDraftGenerationService.getLastCompletedBuild).not.toHaveBeenCalled();
260260
expect(mockDraftGenerationService.getBuildProgress).not.toHaveBeenCalled();
261261
});

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/lynx-insights-panel/lynx-insights-panel-header/lynx-insights-panel-header.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
LynxInsightType,
1010
LynxInsightTypes
1111
} from 'realtime-server/lib/esm/scriptureforge/models/lynx-insight';
12-
import { I18nService } from 'xforge-common/i18n.service';
1312
import { quietTakeUntilDestroyed } from 'xforge-common/util/rxjs-util';
1413
import { LynxInsightStateService } from '../../lynx-insight-state.service';
1514

@@ -32,7 +31,6 @@ export class LynxInsightsPanelHeaderComponent implements OnInit {
3231

3332
constructor(
3433
private readonly destroyRef: DestroyRef,
35-
private readonly i18n: I18nService,
3634
readonly state: LynxInsightStateService
3735
) {}
3836

src/SIL.XForge.Scripture/ClientApp/src/xforge-common/feature-flags/feature-flag.service.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,21 +221,21 @@ export class FeatureFlagService {
221221
this.featureFlagStore
222222
);
223223

224-
private readonly showNmtDrafting: FeatureFlag = new ServerOnlyFeatureFlag(
224+
readonly showNmtDrafting: FeatureFlag = new ServerOnlyFeatureFlag(
225225
'SHOW_NMT_DRAFTING',
226226
'Show NMT drafting',
227227
2,
228228
this.featureFlagStore
229229
);
230230

231-
private readonly allowForwardTranslationNmtDrafting: FeatureFlag = new ServerOnlyFeatureFlag(
231+
readonly allowForwardTranslationNmtDrafting: FeatureFlag = new ServerOnlyFeatureFlag(
232232
'ALLOW_FORWARD_TRANSLATION_NMT_DRAFTING',
233233
'Allow Forward Translation NMT drafting',
234234
3,
235235
this.featureFlagStore
236236
);
237237

238-
private readonly scriptureAudio: FeatureFlag = new ServerOnlyFeatureFlag(
238+
readonly scriptureAudio: FeatureFlag = new ServerOnlyFeatureFlag(
239239
'SCRIPTURE_AUDIO',
240240
'Scripture audio',
241241
4,
@@ -263,49 +263,49 @@ export class FeatureFlagService {
263263
this.featureFlagStore
264264
);
265265

266-
private readonly machineInProcess: FeatureFlag = new ServerOnlyFeatureFlag(
266+
readonly machineInProcess: FeatureFlag = new ServerOnlyFeatureFlag(
267267
'MachineInProcess',
268268
'Use In-Process Machine for Suggestions',
269269
8,
270270
this.featureFlagStore
271271
);
272272

273-
private readonly serval: FeatureFlag = new ServerOnlyFeatureFlag(
273+
readonly serval: FeatureFlag = new ServerOnlyFeatureFlag(
274274
'Serval',
275275
'Use Serval for Suggestions',
276276
9,
277277
this.featureFlagStore
278278
);
279279

280-
private readonly useEchoForPreTranslation: FeatureFlag = new ServerOnlyFeatureFlag(
280+
readonly useEchoForPreTranslation: FeatureFlag = new ServerOnlyFeatureFlag(
281281
'UseEchoForPreTranslation',
282282
'Allow Echo for Pre-Translation Drafting',
283283
10,
284284
this.featureFlagStore
285285
);
286286

287-
private readonly allowFastTraining: FeatureFlag = new ServerOnlyFeatureFlag(
287+
readonly allowFastTraining: FeatureFlag = new ServerOnlyFeatureFlag(
288288
'ALLOW_FAST_TRAINING',
289289
'Allow Fast Pre-Translation Training',
290290
11,
291291
this.featureFlagStore
292292
);
293293

294-
private readonly uploadParatextZipForPreTranslation: FeatureFlag = new ServerOnlyFeatureFlag(
294+
readonly uploadParatextZipForPreTranslation: FeatureFlag = new ServerOnlyFeatureFlag(
295295
'UploadParatextZipForPreTranslation',
296296
'Upload Paratext Zip Files for Pre-Translation Drafting',
297297
12,
298298
this.featureFlagStore
299299
);
300300

301-
private readonly allowAdditionalTrainingSource: FeatureFlag = new ServerOnlyFeatureFlag(
301+
readonly allowAdditionalTrainingSource: FeatureFlag = new ServerOnlyFeatureFlag(
302302
'AllowAdditionalTrainingSource',
303303
'Allow mixing in an additional training source',
304304
13,
305305
this.featureFlagStore
306306
);
307307

308-
private readonly updatedLearningRateForServal: FeatureFlag = new ServerOnlyFeatureFlag(
308+
readonly updatedLearningRateForServal: FeatureFlag = new ServerOnlyFeatureFlag(
309309
'UpdatedLearningRateForServal',
310310
'Updated Learning Rate For Serval',
311311
14,

src/SIL.XForge.Scripture/ClientApp/src/xforge-common/memory-realtime-remote-store.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@ import { RealtimeDocAdapter, RealtimeQueryAdapter, RealtimeRemoteStore } from '.
1111
* This is the memory-based implementation of the real-time remote store. It is useful for testing.
1212
*/
1313
export class MemoryRealtimeRemoteStore extends RealtimeRemoteStore {
14-
private getAccessToken?: () => Promise<string | undefined>;
1514
private readonly snapshots = new Map<string, Map<string, Snapshot>>();
1615

17-
async init(getAccessToken: () => Promise<string | undefined>): Promise<void> {
18-
this.getAccessToken = getAccessToken;
16+
async init(_getAccessToken: () => Promise<string | undefined>): Promise<void> {
17+
// getAccessToken is not used in this memory implementation
1918
}
2019

2120
addSnapshot<T>(collection: string, snapshot: Snapshot<T>): void {

src/SIL.XForge.Scripture/ClientApp/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"paths": {
2626
"xforge-common/*": ["./src/xforge-common/*"]
2727
},
28-
"useDefineForClassFields": false
28+
"useDefineForClassFields": false,
29+
"noUnusedLocals": true
2930
},
3031
"angularCompilerOptions": {
3132
"enableI18nLegacyMessageIdFormat": false,

0 commit comments

Comments
 (0)