Skip to content
Snippets Groups Projects
Commit aea46bfe authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore(lint): spaced comments & optional chaining

parent 8d2fa33c
No related branches found
No related tags found
2 merge requests!608V2.4.2,!588chore(lint): spaced comments & optional chaining
Showing
with 35 additions and 35 deletions
......@@ -29,7 +29,10 @@
"prefix": "app",
"style": "kebab-case"
}
]
],
"spaced-comment": ["error", "always", { "block": { "exceptions": ["*"] } }],
"@typescript-eslint/prefer-optional-chain": "warn"
}
},
{
......
......@@ -42,6 +42,7 @@
"metropole",
"Metropole",
"monday",
"NOSONAR",
"onespace",
"orientator",
"Orientator",
......
......@@ -229,7 +229,7 @@ export class ManageUsersComponent {
});
}
} else {
if (context.oldValue && context.oldValue.name) {
if (context.oldValue?.name) {
context.node.data[context.colDef.field] = context.oldValue;
context.api.refreshCells({ rowNodes: [context.node], columns: [context.column.colId] });
}
......@@ -253,7 +253,7 @@ export class ManageUsersComponent {
});
}
} else {
if (context.oldValue && context.oldValue.name) {
if (context.oldValue?.name) {
context.node.data[context.colDef.field] = context.oldValue;
context.api.refreshCells({ rowNodes: [context.node], columns: [context.column.colId] });
}
......
......@@ -23,7 +23,7 @@ describe('AppComponent', () => {
expect(app.title).toEqual('pamn');
});
/*it('should render title', () => {
/* it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
......
......@@ -194,10 +194,7 @@ export class FormViewComponent implements OnInit, AfterViewInit {
private createAccountForm(email?: string): void {
this.accountForm = new UntypedFormGroup(
{
email: new UntypedFormControl(email ? email : '', [
Validators.required,
Validators.pattern(CustomRegExp.EMAIL),
]),
email: new UntypedFormControl(email ?? '', [Validators.required, Validators.pattern(CustomRegExp.EMAIL)]),
name: new UntypedFormControl('', [Validators.required, Validators.pattern(CustomRegExp.TEXT_WITHOUT_NUMBER)]),
surname: new UntypedFormControl('', [
Validators.required,
......@@ -206,7 +203,7 @@ export class FormViewComponent implements OnInit, AfterViewInit {
phone: new UntypedFormControl('', [Validators.required, Validators.pattern(CustomRegExp.PHONE)]),
password: new UntypedFormControl('', [
Validators.required,
Validators.pattern(CustomRegExp.PASSWORD), //NOSONAR
Validators.pattern(CustomRegExp.PASSWORD), // NOSONAR
]),
confirmPassword: new UntypedFormControl(''),
},
......@@ -347,7 +344,7 @@ export class FormViewComponent implements OnInit, AfterViewInit {
}).subscribe(async () => {
// if register a new user as a new member structure, no structure to choose
if (this.isRegisterNewMember) {
if (this.profile.job && this.profile.job.hasPersonalOffer) {
if (this.profile.job?.hasPersonalOffer) {
this.structureService.getStructure(this.profile.structuresLink[0]).subscribe((structure) => {
this.structure = new Structure(structure);
this.router.navigateByUrl('form/personaloffer');
......
......@@ -63,7 +63,7 @@ export class StructureFormComponent implements OnChanges, OnInit {
ngOnChanges(changes: SimpleChanges): void {
if (changes.currentStep) {
//facultative steps
// facultative steps
if (
this.currentStep === structureFormStep.structureCreationFinishedInfo ||
this.currentStep === structureFormStep.structureHours ||
......
......@@ -108,7 +108,7 @@ export class MakeAppointmentComponent implements OnInit {
this.structures.forEach((structure) => {
// check each of its personnalOffers
structure.personalOffers?.forEach((po) => {
//if the needs the user selected are all part of the personalOffer, keep the structure for display
// if the needs the user selected are all part of the personalOffer, keep the structure for display
if (
this.filtersOnOffers.onlineProcedures.every((offer) => po.categories.onlineProcedures.includes(offer)) &&
this.filtersOnOffers.baseSkills.every((offer) => po.categories.baseSkills.includes(offer))
......
......@@ -21,7 +21,7 @@ export class OnlineDemarchComponent implements OnInit {
ngOnInit(): void {
this.selectedModules = this.form.get('onlineDemarcheType').value;
//TODO move this in form init categories
// TODO move this in form init categories
this.searchService.getCategories().subscribe((categories: Category[]) => {
this.accompanimentType = categories.find((el) => el.id === CategoryEnum.onlineProcedures).modules;
});
......@@ -43,7 +43,7 @@ export class OnlineDemarchComponent implements OnInit {
}
public isSelectedModule(moduleId: string): boolean {
if (this.selectedModules && this.selectedModules.map((module) => module.id).includes(moduleId)) return true;
if (this.selectedModules?.map((module) => module.id).includes(moduleId)) return true;
return false;
}
public handleClose(): void {
......
......@@ -638,7 +638,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
private targetStructures(structureChoice: AbstractControl): OrientationIndicatorStructure[] {
const targetStructures: OrientationIndicatorStructure[] = [];
if (structureChoice && structureChoice.value) {
if (structureChoice?.value) {
structureChoice.value.forEach((structure: Structure) => {
targetStructures.push({
nom: structure.structureName,
......
......@@ -8,7 +8,7 @@ export class GeoJson {
constructor(obj?: any) {
Object.assign(this, obj, {
geometry: obj && obj.geometry ? new AddressGeometry(obj.geometry) : null,
geometry: obj?.geometry ? new AddressGeometry(obj.geometry) : null,
});
}
}
......@@ -6,7 +6,7 @@ export class Day {
constructor(obj?: any) {
Object.assign(this, obj, {
time: obj && obj.time ? obj.time.map((time) => new Time(time)) : [],
time: obj?.time ? obj.time.map((time) => new Time(time)) : [],
});
}
}
......@@ -65,7 +65,7 @@ export class Structure {
constructor(obj?: any) {
Object.assign(this, obj, {
hours: obj && obj.hours ? new Week(obj.hours) : new Week(),
hours: obj?.hours ? new Week(obj.hours) : new Week(),
categories: {
accessModality: obj?.categories?.accessModality || [],
advancedSkills: obj?.categories?.advancedSkills || [],
......
......@@ -13,13 +13,13 @@ export class Week {
constructor(obj?: any) {
Object.assign(this, obj, {
monday: obj && obj.monday ? new Day(obj.monday) : new Day(),
tuesday: obj && obj.tuesday ? new Day(obj.tuesday) : new Day(),
wednesday: obj && obj.wednesday ? new Day(obj.wednesday) : new Day(),
thursday: obj && obj.thursday ? new Day(obj.thursday) : new Day(),
friday: obj && obj.friday ? new Day(obj.friday) : new Day(),
saturday: obj && obj.saturday ? new Day(obj.saturday) : new Day(),
sunday: obj && obj.sunday ? new Day(obj.sunday) : new Day(),
monday: obj?.monday ? new Day(obj.monday) : new Day(),
tuesday: obj?.tuesday ? new Day(obj.tuesday) : new Day(),
wednesday: obj?.wednesday ? new Day(obj.wednesday) : new Day(),
thursday: obj?.thursday ? new Day(obj.thursday) : new Day(),
friday: obj?.friday ? new Day(obj.friday) : new Day(),
saturday: obj?.saturday ? new Day(obj.saturday) : new Day(),
sunday: obj?.sunday ? new Day(obj.sunday) : new Day(),
});
}
......
......@@ -39,7 +39,7 @@ export class StructureEditionSummaryComponent implements OnInit {
public buttonTypeEnum = ButtonType;
public equipmentEnum = Equipment;
//Digital learning
// Digital learning
public categories: Category[] = [];
public showBaseSkills = false;
public showAdvancedSkills = false;
......
......@@ -46,7 +46,7 @@ export class AccompanimentPickerComponent implements OnInit, OnChanges {
}
public isSelectedModule(module: Module): boolean {
if (this.selectedModules && this.selectedModules.includes(module)) return true;
if (this.selectedModules?.includes(module)) return true;
return false;
}
}
......@@ -2,7 +2,7 @@ export enum StructureTypeEnum {
fablab = 'Fablab',
// A supprimer ?
//A remplacer par Association ?
// A remplacer par Association ?
associationQuartier = 'Structure associative de quartier',
associationCaritative = 'Association caritative',
......
......@@ -3,7 +3,7 @@ import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'phone' })
export class PhonePipe implements PipeTransform {
transform(value: string): string {
//Remove dot and space from the phone string and add space in each 2 numbers
// Remove dot and space from the phone string and add space in each 2 numbers
const regexArray = value.replace(/\s|\./g, '').match(/.{1,2}/g);
return regexArray.join(' ');
}
......
......@@ -16,7 +16,7 @@ export class MoreFiltersComponent implements OnInit, OnChanges {
@Input() public modalType: TypeModal;
@Input() public categories: Category[];
//checked modules filter list
// checked modules filter list
@Input() public modules: Module[] = [];
@Output() searchEvent = new EventEmitter();
@Output() closeEvent = new EventEmitter();
......
......@@ -107,7 +107,7 @@ export class StructureListSearchComponent implements OnInit {
this.searchEvent.emit(filters);
}
//Update url with new params added or removed
// Update url with new params added or removed
public updateUrlParams(filters: Filter[]): void {
// No url update if the page is displaying structure details, because it must keep the url with the structure id, neither for orientation
if (
......
......@@ -8,10 +8,9 @@ export class Category {
constructor(obj?: any) {
Object.assign(this, obj, {
modules:
obj && obj.modules
? obj.modules.map((module: Module) => new Module(module.id, module.name, module.displayText))
: null,
modules: obj?.modules
? obj.modules.map((module: Module) => new Module(module.id, module.name, module.displayText))
: null,
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment