Skip to content

Commit 6201bfc

Browse files
committed
Remove unnecessary conditions found by no-unnecessary-condition lint
1 parent 185881d commit 6201bfc

31 files changed

+122
-147
lines changed

src/common/retry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ export type RetryOptions = Merge<
3030

3131
const parseOptions = (options: RetryOptions = {}): Options => ({
3232
...options,
33-
maxRetryTime: options?.maxRetryTime
33+
maxRetryTime: options.maxRetryTime
3434
? Duration.from(options.maxRetryTime).toMillis()
3535
: undefined,
36-
minTimeout: options?.minTimeout
36+
minTimeout: options.minTimeout
3737
? Duration.from(options.minTimeout).toMillis()
3838
: undefined,
39-
maxTimeout: options?.maxTimeout
39+
maxTimeout: options.maxTimeout
4040
? Duration.from(options.maxTimeout).toMillis()
4141
: undefined,
4242
});

src/components/authorization/policy/executor/policy-dumper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ const searchResources = (
275275
if (isWildcard(r)) {
276276
return resNames.map((n) => [n, propsIn] as const);
277277
}
278-
r = r?.replace(/[{}]/g, '');
278+
r = r.replace(/[{}]/g, '');
279279
return csv(r).map((n) => [n, propsIn] as const);
280280
})
281281
.flatMap(([r, propsIn]) => {

src/components/ceremony/handlers/delete-engagement-default-ceremony.handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class DetachEngagementRootDirectoryHandler
1616
return;
1717
}
1818

19-
const ceremonyId = engagement?.ceremony?.value?.id;
19+
const ceremonyId = engagement.ceremony.value?.id;
2020
if (!ceremonyId) {
2121
return;
2222
}

src/components/engagement/engagement.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ export class EngagementRepository extends CommonRepository {
512512
.union()
513513
.match([
514514
node('project', 'Project', {
515-
id: input.filter.project?.id,
515+
id: input.filter.project.id,
516516
}),
517517
relation('out', '', 'engagement', INACTIVE),
518518
node('node', 'Engagement'),
@@ -635,7 +635,7 @@ export class EngagementRepository extends CommonRepository {
635635
}
636636

637637
const label = isInternship ? 'person' : 'language';
638-
if (!result?.other) {
638+
if (!result.other) {
639639
throw new NotFoundException(
640640
`Could not find ${label}`,
641641
`engagement.${property}Id`,

src/components/file/file.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ export class FileRepository extends CommonRepository {
119119
])
120120
.apply((q) => {
121121
const conditions: AnyConditions = {};
122-
if (input?.filter?.name) {
122+
if (input.filter?.name) {
123123
q.match([
124124
node('node'),
125125
relation('out', '', 'name', ACTIVE),
126126
node('name', 'Property'),
127127
]);
128128
conditions['name.value'] = contains(input.filter.name);
129129
}
130-
if (input?.filter?.type) {
130+
if (input.filter?.type) {
131131
conditions.node = hasLabel(input.filter.type);
132132
}
133133
return entries(conditions).length === 0 ? q : q.where(conditions);

src/components/file/local-bucket.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class LocalBucketController {
4040
@Request() req: IRequest,
4141
@Body() contents: Buffer,
4242
) {
43-
if (!contents || !Buffer.isBuffer(contents)) {
43+
if (!Buffer.isBuffer(contents)) {
4444
throw new InputException();
4545
}
4646

src/components/language/language.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class LanguageRepository extends DtoRepository<
8787
};
8888

8989
const ethnologueId = await this.ethnologueLanguageService.create(
90-
input?.ethnologue,
90+
input.ethnologue,
9191
);
9292

9393
const createLanguage = this.db

src/components/partnership/partnership.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export class PartnershipService {
254254
return;
255255
}
256256
if (
257-
!partner.financialReportingTypes.value?.includes(financialReportingType)
257+
!partner.financialReportingTypes.value.includes(financialReportingType)
258258
) {
259259
throw new InputException(
260260
`Partner does not have this financial reporting type available`,

src/components/periodic-report/handlers/abstract-periodic-report-sync.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ export abstract class AbstractPeriodicReportSync {
2020
},
2121
finalAt?: CalendarDate,
2222
) {
23-
if (!diff) {
24-
return;
25-
}
2623
await this.periodicReports.delete(parent, type, diff.removals);
2724

2825
await this.periodicReports.merge({

src/components/pnp/extract-scripture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const extractScripture = (
4343
// TODO I think this is a redundant check.
4444
// I don't think we will ever get here because the row is filtered out with
4545
// the isGoalRow function.
46-
result?.addProblem(MismatchScriptureAndVerseCount, bookCell, {
46+
result.addProblem(MismatchScriptureAndVerseCount, bookCell, {
4747
bookVal: bookCell.asString!,
4848
actualVerseCount: totalVersesInBookCol,
4949
declVerseCount: totalVersesCell.asNumber!,

0 commit comments

Comments
 (0)