Skip to content

Commit 3dad4d2

Browse files
authored
style: enforce curly brace style for all control statements across the codebase (#2176)
1 parent 0b8338c commit 3dad4d2

File tree

13 files changed

+56
-17
lines changed

13 files changed

+56
-17
lines changed

.eslintrc.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
"files": ["*.ts", "*.tsx", "*.mts"],
2626
"extends": ["plugin:@nx/typescript"],
2727
"rules": {
28-
"@typescript-eslint/no-unused-vars": "off"
28+
"@typescript-eslint/no-unused-vars": "off",
29+
"curly": [
30+
"error",
31+
"all"
32+
]
2933
}
3034
},
3135
{
@@ -55,6 +59,10 @@
5559
"leadingUnderscore": "forbid",
5660
"trailingUnderscore": "forbid"
5761
}
62+
],
63+
"curly": [
64+
"error",
65+
"all"
5866
]
5967
}
6068
}

apps/nuxt/src/components/program/detail/ProgramDetail.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ if (currentProgram.value) {
122122
}
123123
124124
const scrollToRef = (targetRef: HTMLElement | null | undefined) => {
125-
if (!targetRef) return
125+
if (!targetRef) {
126+
return
127+
}
126128
if (targetRef) {
127129
Scroll.toWithEligibilityBarOffset(targetRef)
128130
}

apps/nuxt/src/components/project/details/ProjectSideNav.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ const scrollTo = (id: string) => {
4141
}
4242
4343
const hasTestimony = computed(() => {
44-
if (!props.project) return false
44+
if (!props.project) {
45+
return false
46+
}
4547
return testimonies.some((testimony) => testimony.projects?.includes(props.project!.id))
4648
})
4749

apps/nuxt/src/components/project/details/ProjectTestimonies.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ const props = defineProps<{
2929
}>()
3030
3131
const testimoniesToDisplay = computed(() => {
32-
if (!props.project) return []
32+
if (!props.project) {
33+
return []
34+
}
3335
return testimonies.filter((testimony) => testimony.projects?.includes(props.project!.id))
3436
})
3537
3638
const hasTestimony = computed(() => {
37-
if (!props.project) return false
39+
if (!props.project) {
40+
return false
41+
}
3842
return testimonies.some((testimony) => testimony.projects?.includes(props.project!.id))
3943
})
4044
</script>

apps/nuxt/src/pages/TeeBudgetPage.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,14 @@ const formatCurrency = (value: number): string => {
192192
}
193193
194194
const drawBudgetChart = async () => {
195-
if (!budgetChartCanvas.value) return
195+
if (!budgetChartCanvas.value) {
196+
return
197+
}
196198
197199
const chartContext = budgetChartCanvas.value.getContext('2d')
198-
if (!chartContext) return
200+
if (!chartContext) {
201+
return
202+
}
199203
200204
// Import Chart.js de manière asynchrone
201205
const { default: Chart } = await import('chart.js/auto')

apps/nuxt/src/tools/analytic/useExternalLinkTracker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export function useExternalLinkTracker(type: 'program' | 'project') {
88
const trackExternalLinks = (event: Event) => {
99
if (import.meta.client) {
1010
const trackedContainer = document.getElementById('externalLinksTracking')
11-
if (!trackedContainer) return
11+
if (!trackedContainer) {
12+
return
13+
}
1214

1315
const target = event.target as HTMLElement
1416
const link = target.closest('a') as HTMLAnchorElement | null

apps/nuxt/src/tools/companyData/companyData.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ export class CompanyData {
111111
}
112112

113113
static hasSiret() {
114-
if (!this.company) return false
114+
if (!this.company) {
115+
return false
116+
}
115117

116118
return !!(this.company as EstablishmentFront)?.siret
117119
}

libs/backend-ddd/src/common/domain/error/errors.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import ServiceNotFoundError from '../api/serviceNotFoundError'
1212
* @arg value - expected to be an error, e.g. retrieved with the `catch` keyword.
1313
*/
1414
export function ensureError(value: unknown): Error {
15-
if (value instanceof Error) return value
15+
if (value instanceof Error) {
16+
return value
17+
}
1618

1719
let stringified = '[Unable to stringify the thrown value]'
1820
try {

libs/backend-ddd/src/opportunity/infrastructure/api/brevo/brevoDeal.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ const addBrevoDeal: OpportunityRepository['create'] = async (
3131

3232
if (!dealId.isErr) {
3333
const maybeError = await associateBrevoDealToContact(dealId.value, domainOpportunity.contactId)
34-
if (maybeError.isJust)
34+
if (maybeError.isJust) {
3535
return Result.err(new Error('Something went wrong while attaching contact to opportunity', { cause: maybeError.value }))
36+
}
3637
}
3738

3839
return dealId

libs/data/src/program/dataPipeline.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ export const readPrograms = (log = false): ProgramType[] => {
2727
const __dirname = path.dirname(fileURLToPath(import.meta.url))
2828
const dataDirPath: string = path.join(__dirname, PROGRAMS_FOLDER_PATH)
2929

30-
if (log) console.log('📂 Reading data at', dataDirPath, '\n')
30+
if (log) {
31+
console.log('📂 Reading data at', dataDirPath, '\n')
32+
}
3133

3234
const filenames: string[] = fs.readdirSync(dataDirPath)
3335

@@ -52,11 +54,15 @@ export const prependInterface = (programs: ProgramType[], log = false): ProgramT
5254
const __dirname = path.dirname(fileURLToPath(import.meta.url))
5355
const fullPath: string = path.join(__dirname, INTERFACE_PATH)
5456

55-
if (log) console.log('🗎 reading constants at', fullPath)
57+
if (log) {
58+
console.log('🗎 reading constants at', fullPath)
59+
}
5660
const file: string = fs.readFileSync(fullPath, 'utf8')
5761
const constants = yaml.load(file) as Record<string, unknown>
5862

59-
if (log) console.log('➕ prepending publicodes with common constants')
63+
if (log) {
64+
console.log('➕ prepending publicodes with common constants')
65+
}
6066

6167
return programs.map((p) => {
6268
p.publicodes = { ...constants, ...p.publicodes }

0 commit comments

Comments
 (0)