diff --git a/frontend/cypress/e2e/check-in.cy.ts b/frontend/cypress/e2e/check-in.cy.ts index bc30992a16..c53320ec5d 100644 --- a/frontend/cypress/e2e/check-in.cy.ts +++ b/frontend/cypress/e2e/check-in.cy.ts @@ -312,8 +312,12 @@ function getCurrentDate() { let dd_str = '' + dd; let mm_str = '' + mm; - if (dd < 10) dd_str = '0' + dd_str; - if (mm < 10) mm_str = '0' + mm_str; + if (dd < 10) { + dd_str = '0' + dd_str; + } + if (mm < 10) { + mm_str = '0' + mm_str; + } return dd_str + '.' + mm_str + '.' + yyyy; } diff --git a/frontend/cypress/support/helper/scoringSupport.ts b/frontend/cypress/support/helper/scoringSupport.ts index a0f2446911..93992f39b2 100644 --- a/frontend/cypress/support/helper/scoringSupport.ts +++ b/frontend/cypress/support/helper/scoringSupport.ts @@ -20,7 +20,9 @@ export function validateScoring(isOverview: boolean, percentage: number) { validateScoringWidth('commit', scoringValue.commitPercent, isOverview); validateScoringWidth('target', scoringValue.targetPercent, isOverview); - if (percentage == 0) return; + if (percentage == 0) { + return; + } validateScoringColor('fail', rgbCode, isOverview); validateScoringColor('commit', rgbCode, isOverview); validateScoringColor('target', rgbCode, isOverview); @@ -34,10 +36,18 @@ export function getPercentageMetric(baseline: number, stretchGoal: number, value } export function getPercentageOrdinal(zone: string) { - if (zone == 'stretch') return 101; - if (zone == 'target') return 99.99; - if (zone == 'commit') return 70; - if (zone == 'fail') return 30; + if (zone == 'stretch') { + return 101; + } + if (zone == 'target') { + return 99.99; + } + if (zone == 'commit') { + return 70; + } + if (zone == 'fail') { + return 30; + } return 0; } @@ -79,9 +89,15 @@ function checkVisibilityOfScoringComponent(isOverview: boolean, displayProperty: } function colorFromPercentage(percentage: number) { - if (percentage >= 100) return 'rgba(0, 0, 0, 0)'; - if (percentage > 70) return 'rgb(30, 138, 41)'; - if (percentage > 30) return 'rgb(255, 214, 0)'; + if (percentage >= 100) { + return 'rgba(0, 0, 0, 0)'; + } + if (percentage > 70) { + return 'rgb(30, 138, 41)'; + } + if (percentage > 30) { + return 'rgb(255, 214, 0)'; + } return 'rgb(186, 56, 56)'; } diff --git a/frontend/cypress/support/helper/utils.ts b/frontend/cypress/support/helper/utils.ts index 454ba2433c..3600ff1b54 100644 --- a/frontend/cypress/support/helper/utils.ts +++ b/frontend/cypress/support/helper/utils.ts @@ -30,7 +30,9 @@ function doUntil( limit = 100, count = 0 ) { - if (count >= limit) return; + if (count >= limit) { + return; + } cy.focused() .then((element) => { diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index c84d853cc1..4a24788704 100644 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -59,6 +59,7 @@ export default tsEslint.config( //eslint rules 'unused-imports/no-unused-imports': 'error', 'no-undef': 'error', + curly: 'error', 'prefer-rest-params': 'error', 'space-before-function-paren': ['error', 'never'], diff --git a/frontend/src/app/components/team/team.component.ts b/frontend/src/app/components/team/team.component.ts index 6e86c8f7fb..5b83190569 100644 --- a/frontend/src/app/components/team/team.component.ts +++ b/frontend/src/app/components/team/team.component.ts @@ -28,7 +28,9 @@ export class TeamComponent { this.configService.config$.pipe(first()) .subscribe((config: ClientConfig) => { const configuredIconSrc = config.customStyles['okr-add-objective-icon']; - if (configuredIconSrc) this.addIconSrc.next(configuredIconSrc); + if (configuredIconSrc) { + this.addIconSrc.next(configuredIconSrc); + } }); } diff --git a/frontend/src/app/interceptors/error-interceptor.service.ts b/frontend/src/app/interceptors/error-interceptor.service.ts index 8386c3a1aa..6b1279fa1e 100644 --- a/frontend/src/app/interceptors/error-interceptor.service.ts +++ b/frontend/src/app/interceptors/error-interceptor.service.ts @@ -51,7 +51,9 @@ export class ErrorInterceptor implements HttpInterceptor { handleSuccessToaster(response: any, method: HttpType) { const successMessageObj = this.getSuccessMessageKey(response.url, response.status, method); - if (!successMessageObj) return; + if (!successMessageObj) { + return; + } let messageKey = successMessageObj.key; const isBacklogQuarter = !GJ_REGEX_PATTERN.test(response.body?.quarterLabel); @@ -65,7 +67,9 @@ export class ErrorInterceptor implements HttpInterceptor { getSuccessMessageKey(url: string, statusCode: number, method: HttpType) { for (const key in SUCCESS_MESSAGE_MAP) { const value = SUCCESS_MESSAGE_MAP[key]; - if (!url.includes(key)) continue; + if (!url.includes(key)) { + continue; + } for (const toasterMessage of value.methods) { if (toasterMessage.method == method) { diff --git a/frontend/src/app/shared/common.ts b/frontend/src/app/shared/common.ts index ca41ce46ba..23a66c5638 100644 --- a/frontend/src/app/shared/common.ts +++ b/frontend/src/app/shared/common.ts @@ -20,7 +20,9 @@ export function getValueFromQuery(query: any, fallback?: number): number[] { .flat() .map((id: any) => Number(id)) .filter((id: number) => Number.isInteger(id)); - if (fallback === undefined) return values; + if (fallback === undefined) { + return values; + } return values.length > 0 ? values : [fallback]; } @@ -47,8 +49,12 @@ export function calculateCurrentPercentage(keyResultMetric: KeyResultMetricMin): const value: number = +(keyResultMetric.lastCheckIn?.value ?? 0); const baseline: number = +keyResultMetric.baseline; const stretchGoal: number = +keyResultMetric.stretchGoal; - if (isLastCheckInNegative(baseline, stretchGoal, value)) return 0; - if (value == stretchGoal) return 100; + if (isLastCheckInNegative(baseline, stretchGoal, value)) { + return 0; + } + if (value == stretchGoal) { + return 100; + } return Math.abs(value - baseline) / Math.abs(stretchGoal - baseline) * 100; } @@ -72,7 +78,9 @@ export function optionalReplaceWithNulls(param: object): Record { } export function areEqual(arr1: number[], arr2: number[]) { - if (arr1.length !== arr2.length) return false; + if (arr1.length !== arr2.length) { + return false; + } // implement custom sort if necessary arr1.sort((a, b) => a - b); @@ -80,7 +88,9 @@ export function areEqual(arr1: number[], arr2: number[]) { // use normal for loop so we can return immediately if not equal for (let i = 0; i < arr1.length; i++) { - if (arr1[i] !== arr2[i]) return false; + if (arr1[i] !== arr2[i]) { + return false; + } } return true; diff --git a/frontend/src/app/shared/custom/scoring/scoring.component.ts b/frontend/src/app/shared/custom/scoring/scoring.component.ts index fa6755e82b..de635c75d6 100644 --- a/frontend/src/app/shared/custom/scoring/scoring.component.ts +++ b/frontend/src/app/shared/custom/scoring/scoring.component.ts @@ -74,9 +74,15 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { * Define width of scoring elements * All checked individually because that if one is undefined, the others can still be set */ - if (this.failElement) this.failElement.nativeElement.style.width = this.failPercent + '%'; - if (this.commitElement) this.commitElement.nativeElement.style.width = this.commitPercent + '%'; - if (this.targetElement) this.targetElement.nativeElement.style.width = this.targetPercent + '%'; + if (this.failElement) { + this.failElement.nativeElement.style.width = this.failPercent + '%'; + } + if (this.commitElement) { + this.commitElement.nativeElement.style.width = this.commitPercent + '%'; + } + if (this.targetElement) { + this.targetElement.nativeElement.style.width = this.targetPercent + '%'; + } if (this.keyResult.keyResultType == 'metric') { this.labelPercentage.subscribe((value) => { @@ -91,9 +97,15 @@ export class ScoringComponent implements OnInit, AfterViewInit, OnChanges { const scoringClass = this.getScoringColorClassAndSetBorder(); if (scoringClass !== null) { // All checked individually because that if one is undefined, the others can still be set - if (this.targetElement) this.targetElement.nativeElement.classList.add(scoringClass); - if (this.commitElement) this.commitElement.nativeElement.classList.add(scoringClass); - if (this.failElement) this.failElement.nativeElement.classList.add(scoringClass); + if (this.targetElement) { + this.targetElement.nativeElement.classList.add(scoringClass); + } + if (this.commitElement) { + this.commitElement.nativeElement.classList.add(scoringClass); + } + if (this.failElement) { + this.failElement.nativeElement.classList.add(scoringClass); + } } // Fill out icon if target percent has reached 100 percent or more diff --git a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts index 31093a6156..93d708be75 100644 --- a/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts +++ b/frontend/src/app/shared/dialog/objective-dialog/objective-form.component.ts @@ -159,7 +159,9 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { // Subscribe to teams$ to find and update the current team this.teams$.subscribe((teams) => { const currentTeam = teams.find((team) => team.id === teamId); - if (currentTeam) this.currentTeam.next(currentTeam); + if (currentTeam) { + this.currentTeam.next(currentTeam); + } }); this.objectiveForm.patchValue({ @@ -193,7 +195,9 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { })) }); } else { - if (this.data.action == 'releaseBacklog') objectiveDTO.state = 'ONGOING' as State; + if (this.data.action == 'releaseBacklog') { + objectiveDTO.state = 'ONGOING' as State; + } if (this.data.objective.objectiveId && id) { objectiveDTO.id = id; return this.objectiveService.updateObjective(objectiveDTO); @@ -261,7 +265,9 @@ export class ObjectiveFormComponent implements OnInit, OnDestroy { const currentQuarter: Quarter | undefined = this.quarters.find((quarter) => quarter.id == this.objectiveForm.value.quarter); if (currentQuarter) { const isBacklogCurrent = !this.isBacklogQuarter(currentQuarter.label); - if (this.data.action == 'duplicate') return true; + if (this.data.action == 'duplicate') { + return true; + } if (this.data.objective.objectiveId) { return isBacklogCurrent ? this.state == 'DRAFT' : true; } else { diff --git a/frontend/src/app/team-management/delete-user/delete-user.component.ts b/frontend/src/app/team-management/delete-user/delete-user.component.ts index c2253dcaaa..c5f02577df 100644 --- a/frontend/src/app/team-management/delete-user/delete-user.component.ts +++ b/frontend/src/app/team-management/delete-user/delete-user.component.ts @@ -69,7 +69,9 @@ export class DeleteUserComponent implements OnInit, OnDestroy { } hasOkrUserRoleOkrChampion() { - if (this.okrUser == undefined) return false; + if (this.okrUser == undefined) { + return false; + } return this.okrUser.isOkrChampion; }