chore: add husky pre-commit hook and lint-staged configuration

- Created a pre-commit hook in .husky to run lint-staged.
- Added .lintstagedrc.mjs to format frontend files with Prettier and apply Spotless to backend Java files.
- Introduced .prettierignore to exclude specific directories from formatting.
This commit is contained in:
nessar committed 2026-08-17 14:18:16 +02:00
1 parent 5d2d85aa8c
commit 878da155bd
564 files changed
+61467 -47179

No files matched your search

@@ -12,55 +12,57 @@ import { RentPayment, RentPaymentService } from '../../services/rent-payment.ser
import { isRentPaymentDataStale, RENT_PAYMENT_DATA_STALE } from '../rent-payment-dialog-result';
@Component({
selector: 'app-rent-payment-reversal-dialog',
imports: [
ReactiveFormsModule,
MatButtonModule,
MatDialogModule,
MatFormFieldModule,
MatInputModule,
MatProgressSpinnerModule,
],
templateUrl: './rent-payment-reversal-dialog.html',
styleUrl: './rent-payment-reversal-dialog.css',
selector: 'app-rent-payment-reversal-dialog',
imports: [
ReactiveFormsModule,
MatButtonModule,
MatDialogModule,
MatFormFieldModule,
MatInputModule,
MatProgressSpinnerModule,
],
templateUrl: './rent-payment-reversal-dialog.html',
styleUrl: './rent-payment-reversal-dialog.css',
})
export class RentPaymentReversalDialog {
readonly payment = inject<RentPayment>(MAT_DIALOG_DATA);
private readonly dialogRef = inject(MatDialogRef<RentPaymentReversalDialog>);
private readonly payments = inject(RentPaymentService);
readonly saving = signal(false);
readonly error = signal('');
readonly formatEuro = formatEuro;
readonly payment = inject<RentPayment>(MAT_DIALOG_DATA);
private readonly dialogRef = inject(MatDialogRef<RentPaymentReversalDialog>);
private readonly payments = inject(RentPaymentService);
readonly saving = signal(false);
readonly error = signal('');
readonly formatEuro = formatEuro;
readonly form = new FormGroup({
reason: new FormControl('', {
nonNullable: true,
validators: [Validators.required, Validators.maxLength(500)],
}),
});
readonly form = new FormGroup({
reason: new FormControl('', {
nonNullable: true,
validators: [Validators.required, Validators.maxLength(500)],
}),
});
submit(): void {
this.form.markAllAsTouched();
if (this.form.invalid || this.saving()) return;
this.saving.set(true);
this.error.set('');
this.payments
.reverse(
this.payment.id,
this.payment.version,
this.form.controls.reason.value,
browserTimeZone,
)
.pipe(finalize(() => this.saving.set(false)))
.subscribe({
next: (payment) => this.dialogRef.close(payment),
error: (error) => {
if (isRentPaymentDataStale(error)) {
this.dialogRef.close(RENT_PAYMENT_DATA_STALE);
return;
}
this.error.set(httpErrorMessage(error, 'Impossible de contrepasser ce règlement.'));
},
});
}
submit(): void {
this.form.markAllAsTouched();
if (this.form.invalid || this.saving()) return;
this.saving.set(true);
this.error.set('');
this.payments
.reverse(
this.payment.id,
this.payment.version,
this.form.controls.reason.value,
browserTimeZone,
)
.pipe(finalize(() => this.saving.set(false)))
.subscribe({
next: (payment) => this.dialogRef.close(payment),
error: (error) => {
if (isRentPaymentDataStale(error)) {
this.dialogRef.close(RENT_PAYMENT_DATA_STALE);
return;
}
this.error.set(
httpErrorMessage(error, 'Impossible de contrepasser ce règlement.'),
);
},
});
}
}