diff --git a/.eslintrc.json b/.eslintrc.json index 9cff1b44366212cb5c2298d296e402fbde47ee79..6a83d334331d208c0f94d654a481408e135da41d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -38,6 +38,10 @@ "@typescript-eslint/prefer-optional-chain": "warn", + // TSLINT rules migration + "@typescript-eslint/explicit-function-return-type": "error", + "eqeqeq": "error", + // JSDOC extends overrides: disable some of extends rules // JSdoc is not always needed "jsdoc/require-jsdoc": 0, @@ -46,7 +50,6 @@ "jsdoc/require-returns-type": 0, "jsdoc/require-param": 0, "jsdoc/require-param-type": 0, - // Allow some params to be described and some to be omitted "jsdoc/check-param-names": 0 } diff --git a/.vscode/settings.json b/.vscode/settings.json index b966268f9bc416cb2ffbb7ab060489cf309d0192..23711d0f81bb379c8330d2926b11779d11c0cf51 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -32,10 +32,12 @@ "cSpell.words": [ "Annuary", "carto", + "categorie", "cnfs", "covid", "demarch", "facebook", + "friday", "grandlyon", "instagram", "linkedin", @@ -43,22 +45,21 @@ "metropole", "Metropole", "monday", - "tuesday", - "wednesday", - "thursday", - "friday", - "saturday", - "sunday", "NOSONAR", "onespace", "orientator", "Orientator", "personaloffer", "Rés'in", + "saturday", + "smedium", + "sunday", + "thursday", "toastr", + "tuesday", "ultrawide", "unclickable", - "smedium", + "wednesday", "xsmall", "xxsmall" ] diff --git a/package-lock.json b/package-lock.json index 2c7a25c5a97c9b89a488c236a7fd7cd3e155ee14..a7e0a1c2bb07feaf6fdbb0451275f04022668d03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -75,7 +75,6 @@ "standard-version": "^9.3.2", "storybook": "^7.5.3", "ts-node": "~8.10.0", - "tslint": "~6.1.0", "typescript": "~4.9.4" } }, @@ -27973,6 +27972,7 @@ "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", "deprecated": "TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.", "dev": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.0.0", "builtin-modules": "^1.1.1", @@ -28003,6 +28003,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, + "peer": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -28015,6 +28016,7 @@ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", "integrity": "sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ==", "dev": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -28024,6 +28026,7 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, + "peer": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -28038,6 +28041,7 @@ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, + "peer": true, "dependencies": { "color-name": "1.1.3" } @@ -28046,13 +28050,15 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/tslint/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, + "peer": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -28073,6 +28079,7 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, + "peer": true, "engines": { "node": ">=4" } @@ -28082,6 +28089,7 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, + "peer": true, "dependencies": { "minimist": "^1.2.6" }, @@ -28094,6 +28102,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "peer": true, "bin": { "semver": "bin/semver" } @@ -28103,6 +28112,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, + "peer": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -28114,13 +28124,15 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/tslint/node_modules/tsutils": { "version": "2.29.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, + "peer": true, "dependencies": { "tslib": "^1.8.1" }, diff --git a/package.json b/package.json index 4b6d30fda91f6d083449ae71ac607172bebb2c8d..390a209bbac7db2dd8df197d2c149bd698dce02d 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,6 @@ "standard-version": "^9.3.2", "storybook": "^7.5.3", "ts-node": "~8.10.0", - "tslint": "~6.1.0", "typescript": "~4.9.4" } } diff --git a/src/app/admin/components/claim-structure/claim-structure.component.ts b/src/app/admin/components/claim-structure/claim-structure.component.ts index ca49f70f528966768c866697848ab702c9303dd4..61181d076b8ce3d440de5ad7e38cd3b43aa154bd 100644 --- a/src/app/admin/components/claim-structure/claim-structure.component.ts +++ b/src/app/admin/components/claim-structure/claim-structure.component.ts @@ -11,13 +11,45 @@ import { AdminService } from '../../services/admin.service'; styleUrls: ['../../admin.scss'], }) export class ClaimStructureComponent implements OnInit { - public demandsAttachment: StructureAdminInfo[]; - constructor( private adminService: AdminService, private notificationService: NotificationService, private datePipe: DatePipe ) {} + public demandsAttachment: StructureAdminInfo[]; + + public columnsDefs: ColDef<StructureAdminInfo>[] = [ + { + headerName: 'Utilisateur', + field: 'userEmail', + }, + { + headerName: 'Structure', + field: 'structureName', + flex: 1, + }, + { + headerName: 'Date de demande', + field: 'createdAt', + valueFormatter: (params): string => this.datePipe.transform(params.value, 'mediumDate'), + }, + { + headerName: 'Valider', + width: 100, + cellRenderer: (): string => '<button type="button">Valider</button>', + onCellClicked: (params): void => { + this.acceptDemand(params.data); + }, + }, + { + headerName: 'Refuser', + width: 100, + cellRenderer: (): string => '<button type="button">Refuser</button>', + onCellClicked: (params): void => { + this.refuseDemand(params.data); + }, + }, + ]; ngOnInit(): void { this.adminService.getPendingStructure().subscribe((demands) => { @@ -48,37 +80,4 @@ export class ClaimStructureComponent implements OnInit { }, }); } - - public columnsDefs: ColDef<StructureAdminInfo>[] = [ - { - headerName: 'Utilisateur', - field: 'userEmail', - }, - { - headerName: 'Structure', - field: 'structureName', - flex: 1, - }, - { - headerName: 'Date de demande', - field: 'createdAt', - valueFormatter: (params) => this.datePipe.transform(params.value, 'mediumDate'), - }, - { - headerName: 'Valider', - width: 100, - cellRenderer: () => '<button type="button">Valider</button>', - onCellClicked: (params) => { - this.acceptDemand(params.data); - }, - }, - { - headerName: 'Refuser', - width: 100, - cellRenderer: () => '<button type="button">Refuser</button>', - onCellClicked: (params) => { - this.refuseDemand(params.data); - }, - }, - ]; } diff --git a/src/app/admin/components/deleted-structures/deleted-structures.component.ts b/src/app/admin/components/deleted-structures/deleted-structures.component.ts index d6f56b36c0e54c44d29ec84aad0f942caa77828e..b7d02a07a1a18b157cc8cb4581db36102109fe5e 100644 --- a/src/app/admin/components/deleted-structures/deleted-structures.component.ts +++ b/src/app/admin/components/deleted-structures/deleted-structures.component.ts @@ -11,50 +11,25 @@ import { AdminService } from '../../services/admin.service'; styleUrls: ['../../admin.scss'], }) export class DeletedStructuresComponent implements OnInit { + constructor(private adminService: AdminService, private datePipe: DatePipe) {} public deletedStructures: Structure[]; public selectedStructure: Structure; public isLoading = true; - constructor(private adminService: AdminService, private datePipe: DatePipe) {} - - ngOnInit(): void { - this.loadDeletedStructures(); - } - - private loadDeletedStructures(): void { - this.adminService - .getDeletedStructures() - .pipe(finalize(() => (this.isLoading = false))) - .subscribe((structures) => { - this.deletedStructures = structures; - }); - } - - private renderLink(structure: Structure) { - return `<a href="/acteurs?id=${structure._id}" target="_blank">${structure.structureName}</a>`; - } - - private restoreStructure(structureId: string): void { - this.adminService.restoreDeletedStructure(structureId).subscribe(() => { - this.isLoading = true; - this.loadDeletedStructures(); - }); - } - public columnDefs: ColDef<Structure>[] = [ { headerName: 'Structure', field: 'structureName', flex: 1, sortable: true, - cellRenderer: (params) => this.renderLink(params.data), + cellRenderer: (params): string => this.renderLink(params.data), }, { headerName: 'Date de création', field: 'createdAt', width: 190, sortable: true, - valueFormatter: (params) => this.datePipe.transform(params.value, 'yyyy-MM-dd'), + valueFormatter: (params): string => this.datePipe.transform(params.value, 'yyyy-MM-dd'), }, { headerName: 'Date de suppression', @@ -62,14 +37,38 @@ export class DeletedStructuresComponent implements OnInit { width: 190, sortable: true, sort: 'desc', - valueFormatter: (params) => this.datePipe.transform(params.value, 'yyyy-MM-dd'), + valueFormatter: (params): string => this.datePipe.transform(params.value, 'yyyy-MM-dd'), }, { headerName: 'Restaurer', - cellRenderer: () => '<button type="button">Restaurer</button>', - onCellClicked: (params) => { + cellRenderer: (): string => '<button type="button">Restaurer</button>', + onCellClicked: (params): void => { this.restoreStructure(params.data._id); }, }, ]; + + ngOnInit(): void { + this.loadDeletedStructures(); + } + + private loadDeletedStructures(): void { + this.adminService + .getDeletedStructures() + .pipe(finalize(() => (this.isLoading = false))) + .subscribe((structures) => { + this.deletedStructures = structures; + }); + } + + private renderLink(structure: Structure): string { + return `<a href="/acteurs?id=${structure._id}" target="_blank">${structure.structureName}</a>`; + } + + private restoreStructure(structureId: string): void { + this.adminService.restoreDeletedStructure(structureId).subscribe(() => { + this.isLoading = true; + this.loadDeletedStructures(); + }); + } } diff --git a/src/app/admin/components/espace-coop-cnfs/espace-coop-cnfs.component.ts b/src/app/admin/components/espace-coop-cnfs/espace-coop-cnfs.component.ts index 39d13ae1116238d5238acb12655ffbd75b3ce5ee..b1d3b1d7fbb14fb78e54a6104ef07ea822b66928 100644 --- a/src/app/admin/components/espace-coop-cnfs/espace-coop-cnfs.component.ts +++ b/src/app/admin/components/espace-coop-cnfs/espace-coop-cnfs.component.ts @@ -24,14 +24,14 @@ export class EspaceCoopCNFSComponent implements OnInit { field: 'employer', sortable: true, // Case insensitive alphabetical order - comparator: (a, b) => a.toLowerCase().localeCompare(b.toLowerCase()), + comparator: (a, b): number => a.toLowerCase().localeCompare(b.toLowerCase()), flex: 1, resizable: true, }, { headerName: 'Structures', field: 'structures', - cellRenderer: (param) => param.data.structures.join('<br/>'), + cellRenderer: (param): string => param.data.structures.join('<br/>'), flex: 1, resizable: true, }, diff --git a/src/app/admin/components/lockdown-info/manage-lockdown-info.component.ts b/src/app/admin/components/lockdown-info/manage-lockdown-info.component.ts index 6a81decee401ae22d7ed8519aed74115ea84bf3c..183bc59921134bad3fcd8af9830f22480273334e 100644 --- a/src/app/admin/components/lockdown-info/manage-lockdown-info.component.ts +++ b/src/app/admin/components/lockdown-info/manage-lockdown-info.component.ts @@ -19,10 +19,10 @@ export class ManageLockdownInfoComponent implements OnInit { }); } - public toggleLockdownInfo() { + public toggleLockdownInfo(): void { this.lockdownInfoDisplay = !this.lockdownInfoDisplay; this.parametersService.SetLockdownInfoDisplay(this.lockdownInfoDisplay).subscribe( - () => {}, + () => null, () => { this.error = true; } diff --git a/src/app/admin/components/manage-jobs/attached-users/attached-users.component.ts b/src/app/admin/components/manage-jobs/attached-users/attached-users.component.ts index 0796f51b51f9f9b50282e0b1f7858250cb1309ee..8cdd91bf381adb59ac9c37881bd2be055ece9f3d 100644 --- a/src/app/admin/components/manage-jobs/attached-users/attached-users.component.ts +++ b/src/app/admin/components/manage-jobs/attached-users/attached-users.component.ts @@ -13,7 +13,7 @@ export class AttachedUsersComponent { constructor(private router: Router) {} - public goToManageUsers() { + public goToManageUsers(): void { this.router.navigateByUrl(AdminRoutes.manageUsers.link); } diff --git a/src/app/admin/components/manage-jobs/jobPersonalOffer/job-personal-offer.ts b/src/app/admin/components/manage-jobs/jobPersonalOffer/job-personal-offer.ts index c992e82e420e169aa569f936492febbf3f4f5eb8..8609cf8fbdcb1b396b61a5ceb4f9eb3af42f6586 100644 --- a/src/app/admin/components/manage-jobs/jobPersonalOffer/job-personal-offer.ts +++ b/src/app/admin/components/manage-jobs/jobPersonalOffer/job-personal-offer.ts @@ -19,7 +19,7 @@ export class JobPersonalOfferComponent implements ICellRendererAngularComp { } } - refresh() { + refresh(): false { return false; } } diff --git a/src/app/admin/components/manage-jobs/manage-jobs.component.ts b/src/app/admin/components/manage-jobs/manage-jobs.component.ts index 8734a32a92797cb05b02248ce218268dde568106..384e0852f670c203daf62e0d802b216017464fe2 100644 --- a/src/app/admin/components/manage-jobs/manage-jobs.component.ts +++ b/src/app/admin/components/manage-jobs/manage-jobs.component.ts @@ -273,7 +273,7 @@ export class ManageJobsComponent implements OnInit { } } - public translateBoolean(params: ValueGetterParams) { + public translateBoolean(params: ValueGetterParams): '✔ï¸' | 'âŒ' { return params.data.hasPersonalOffer ? '✔ï¸' : 'âŒ'; } diff --git a/src/app/admin/components/manage-users/employer-renderer/employer-renderer.component.ts b/src/app/admin/components/manage-users/employer-renderer/employer-renderer.component.ts index e1e7cd52ef980375e0bba6d55bb6fcecaeb25fe3..c29053407fabee30a94d135da19d9c2ead939afd 100644 --- a/src/app/admin/components/manage-users/employer-renderer/employer-renderer.component.ts +++ b/src/app/admin/components/manage-users/employer-renderer/employer-renderer.component.ts @@ -25,7 +25,7 @@ export class EmployerRendererComponent implements ICellRendererAngularComp { } } - refresh() { + refresh(): false { return false; } } diff --git a/src/app/admin/components/manage-users/job-renderer/job-renderer.component.ts b/src/app/admin/components/manage-users/job-renderer/job-renderer.component.ts index b1721cf3ce21685ee2b44085fa81993e47dccc88..867f94267ac7e7be2743e5a268ca1efa551219ab 100644 --- a/src/app/admin/components/manage-users/job-renderer/job-renderer.component.ts +++ b/src/app/admin/components/manage-users/job-renderer/job-renderer.component.ts @@ -25,7 +25,7 @@ export class JobRendererComponent implements ICellRendererAngularComp { } } - refresh() { + refresh(): false { return false; } } diff --git a/src/app/admin/components/manage-users/manage-users.component.ts b/src/app/admin/components/manage-users/manage-users.component.ts index 40324aa89bc589260e7600a34a3743a78d7802d7..0e267ae656e23e44059c0839f0a43f83f6d52a99 100644 --- a/src/app/admin/components/manage-users/manage-users.component.ts +++ b/src/app/admin/components/manage-users/manage-users.component.ts @@ -151,7 +151,7 @@ export class ManageUsersComponent { minWidth: 50, headerName: 'Demande de rattachement envoyée le', field: 'updatedAt', - valueGetter: function (params) { + valueGetter(params): string { return new Date(params.data?.updatedAt).toLocaleDateString(); }, }, @@ -346,7 +346,7 @@ export class ManageUsersComponent { this.adminService.getAttachedUsers().subscribe((users) => { this.attachedUsers = users; this.attachedUsers.forEach((user) => { - user._id = user['id']; + user._id = user.id; }); }); } @@ -355,7 +355,7 @@ export class ManageUsersComponent { this.adminService.getUnAttachedUsers().subscribe((users) => { this.unAttachedUsers = users; this.unAttachedUsers.forEach((user) => { - user._id = user['id']; + user._id = user.id; }); }); } @@ -364,7 +364,7 @@ export class ManageUsersComponent { this.adminService.getUnVerifiedUsers().subscribe((users) => { this.unVerifiedUsers = users; this.unVerifiedUsers.forEach((user) => { - user._id = user['id']; + user._id = user.id; }); }); } diff --git a/src/app/admin/components/structures-list/admin-structures-list.component.ts b/src/app/admin/components/structures-list/admin-structures-list.component.ts index 950ca81dc7ae3b584329cc8d0b35e9c1075b2215..2410d987a24343c1f456e153806fffd710213c0f 100644 --- a/src/app/admin/components/structures-list/admin-structures-list.component.ts +++ b/src/app/admin/components/structures-list/admin-structures-list.component.ts @@ -12,6 +12,7 @@ import { AdminService } from '../../services/admin.service'; styleUrls: ['../../admin.scss'], }) export class AdminStructuresListComponent implements OnInit { + constructor(private adminService: AdminService, private datePipe: DatePipe, private router: Router) {} public structuresClaimed: AdminStructure[]; public structuresInClaim: AdminStructure[]; public structuresToClaim: AdminStructure[]; @@ -19,29 +20,12 @@ export class AdminStructuresListComponent implements OnInit { public isAll = false; public isLoading = true; public rowHeight = 25; - constructor(private adminService: AdminService, private datePipe: DatePipe, private router: Router) {} - - ngOnInit(): void { - this.adminService - .getAllStructureAdmin() - .pipe(finalize(() => (this.isLoading = false))) - .subscribe((response) => { - this.structuresClaimed = response.claimed; - this.structuresInClaim = response.inClaim; - this.structuresToClaim = response.toClaim; - this.structuresIncomplete = response.incomplete; - }); - } - - private renderLink(structureId: string, structureName: string) { - return `<a href="/acteurs?id=${structureId}" target="_blank">${structureName}</a>`; - } public columnDefs: ColDef<AdminStructure>[] = [ { headerName: 'Structure', - cellRenderer: (params) => this.renderLink(params.data.structureId, params.data.structureName), - comparator(_, __, nodeA, nodeB) { + cellRenderer: (params): string => this.renderLink(params.data.structureId, params.data.structureName), + comparator(_, __, nodeA, nodeB): number { return nodeA.data.structureName.toLowerCase() > nodeB.data.structureName.toLocaleLowerCase() ? -1 : 1; }, sortable: true, @@ -50,12 +34,28 @@ export class AdminStructuresListComponent implements OnInit { { headerName: 'Date de mise à jour', field: 'updatedAt', - valueFormatter: ({ value }) => this.datePipe.transform(value, 'mediumDate'), - cellClass: (params) => { + valueFormatter: ({ value }): string => this.datePipe.transform(value, 'mediumDate'), + cellClass: (params): string => { return params.data.isOutdated ? 'red' : ''; }, flex: 1, sortable: true, }, ]; + + ngOnInit(): void { + this.adminService + .getAllStructureAdmin() + .pipe(finalize(() => (this.isLoading = false))) + .subscribe((response) => { + this.structuresClaimed = response.claimed; + this.structuresInClaim = response.inClaim; + this.structuresToClaim = response.toClaim; + this.structuresIncomplete = response.incomplete; + }); + } + + private renderLink(structureId: string, structureName: string): string { + return `<a href="/acteurs?id=${structureId}" target="_blank">${structureName}</a>`; + } } diff --git a/src/app/admin/services/admin.service.ts b/src/app/admin/services/admin.service.ts index 805b79d836b940155381698353015ad4925444e6..5cdaad69bf72facb3d63f9f97a08d799edb7478e 100644 --- a/src/app/admin/services/admin.service.ts +++ b/src/app/admin/services/admin.service.ts @@ -210,11 +210,11 @@ export class AdminService { return this.http.post<void>(`${this.baseUrl}/restoreDeletedStructure/${structureId}`, {}); } - public getAllEspaceCoopCNFS() { + public getAllEspaceCoopCNFS(): Observable<EspaceCoopCNFS[]> { return this.http.get<EspaceCoopCNFS[]>(`${this.baseUrl}/espaceCoopCNFS`); } - public getAllResinCNFS() { + public getAllResinCNFS(): Observable<User[]> { return this.http.get<User[]>(`${this.baseUrl}/resinCNFS`); } } diff --git a/src/app/annuaire/result-list/result-list.component.ts b/src/app/annuaire/result-list/result-list.component.ts index d3bbeb7f9b69514a9dbd82acc3072241b81853da..e62c052ebbcb11ccec9334344bf4b78375783194 100644 --- a/src/app/annuaire/result-list/result-list.component.ts +++ b/src/app/annuaire/result-list/result-list.component.ts @@ -30,7 +30,7 @@ export class ResultListComponent implements OnChanges, AfterViewInit { this.windowScrollService.scrollY.next(event.target.scrollTop); } - ngOnChanges(changes: SimpleChanges) { + ngOnChanges(changes: SimpleChanges): void { if (changes.totalUserResult?.currentValue > this.maxPerPage) { this.showPagination = true; } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4a8d4e4b8767af0e74b8963d8512fab03d4f73a7..31458c5f9a2dd2fd4bbdd7d657924da67349144b 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -26,7 +26,7 @@ const footerOutletRoute: Route = { component: FooterComponent, }; -function buildTitle(pageTitle = '') { +function buildTitle(pageTitle = ''): string { let title = "Réseau des acteurs de l'inclusion numérique de la métropole de Lyon"; if (pageTitle) { title = pageTitle + ' | ' + title; diff --git a/src/app/carto/carto.component.ts b/src/app/carto/carto.component.ts index 76fd359b3c5ed05283e7ab476bd06bf718b12f72..995446ec187e69b5b8bf6d5500d6b89207c595d2 100644 --- a/src/app/carto/carto.component.ts +++ b/src/app/carto/carto.component.ts @@ -117,12 +117,7 @@ export class CartoComponent implements OnInit { * @param lat user latitude * @param sortByDistance if set to `true`, structures data is sort by distance. Default value is `true` */ - private updateStructuresDistance( - structures: Structure[], - lon: number, - lat: number, - sortByDistance = true - ): void { + private updateStructuresDistance(structures: Structure[], lon: number, lat: number, sortByDistance = true): void { Promise.all( structures.map(async (structure) => { if (lon && lat) { diff --git a/src/app/config/http-interceptor.ts b/src/app/config/http-interceptor.ts index b51caa249253ae5ccc9c4b8ac46d95c5b46405bf..5555f61cbd66c9b065ec48714fb23c1312443542 100644 --- a/src/app/config/http-interceptor.ts +++ b/src/app/config/http-interceptor.ts @@ -21,7 +21,7 @@ export class CustomHttpInterceptor implements HttpInterceptor { headerSettings[key] = request.headers.getAll(key); } if (token) { - headerSettings['Authorization'] = 'Bearer ' + token; + headerSettings.Authorization = 'Bearer ' + token; } headerSettings['Content-Type'] = 'application/json'; const newHeader = new HttpHeaders(headerSettings); diff --git a/src/app/form/form-view/account-form/account-credentials/account-credentials.component.ts b/src/app/form/form-view/account-form/account-credentials/account-credentials.component.ts index d94b3b0ab2f52fb6334addb68d8c38d61d562bc4..fa2b963a6bffa275549bc41075331c93b8d381d1 100644 --- a/src/app/form/form-view/account-form/account-credentials/account-credentials.component.ts +++ b/src/app/form/form-view/account-form/account-credentials/account-credentials.component.ts @@ -44,10 +44,10 @@ export class AccountCredentialsComponent { if (password.match(CustomRegExp.LOWERCASE)) return true; return false; } - public setValidationsForm() { + public setValidationsForm(): void { this.validateForm.emit(); } - public verifyUserExist(target: EventTarget) { + public verifyUserExist(target: EventTarget): void { const value = (target as HTMLInputElement).value; this.userExists.emit(value); } diff --git a/src/app/form/form-view/account-form/account-info/account-info.component.ts b/src/app/form/form-view/account-form/account-info/account-info.component.ts index baea5a57f0fa1317728138fae190194af7958b62..abe92e1e0209b39b84ff1a5aec56bdfc017896fa 100644 --- a/src/app/form/form-view/account-form/account-info/account-info.component.ts +++ b/src/app/form/form-view/account-form/account-info/account-info.component.ts @@ -15,7 +15,7 @@ export class AccountInfoComponent { constructor(public utils: Utils) {} - public setValidationsForm() { + public setValidationsForm(): void { this.validateForm.emit(); } } diff --git a/src/app/form/form-view/account-form/account-newsletter/account-newsletter.component.ts b/src/app/form/form-view/account-form/account-newsletter/account-newsletter.component.ts index 283bc3bfc913865cced9287251bacd4b62e144c6..0d79863566e2466cfa8add2fa801ce9b2a89e6fd 100644 --- a/src/app/form/form-view/account-form/account-newsletter/account-newsletter.component.ts +++ b/src/app/form/form-view/account-form/account-newsletter/account-newsletter.component.ts @@ -12,7 +12,7 @@ export class AccountNewsletterComponent { @Output() acceptNewsletter = new EventEmitter<any>(); public userAcceptNewsletter = false; - public acceptReceiveNewsletter(accepts: boolean) { + public acceptReceiveNewsletter(accepts: boolean): void { this.acceptNewsletter.emit(accepts); } } diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts index f00392a45ac19c5bf21d34111164e39ff740c3a2..96cba3a81953d7a0aa049bd97da360c195c15fc2 100644 --- a/src/app/form/form-view/form-view.component.ts +++ b/src/app/form/form-view/form-view.component.ts @@ -251,7 +251,7 @@ export class FormViewComponent implements OnInit, AfterViewInit { // If the user is creating personalOffer for one of his structure from his profile, we skip the structure choice step if ( this.isPersonalOfferProfile && - this.currentFormType == formType.personaloffer && + this.currentFormType === formType.personaloffer && this.currentPage === personalOfferFormStep.personalOfferStructureChoice - 1 ) { this.setHasOtherPersonalOffer(false); @@ -267,8 +267,9 @@ export class FormViewComponent implements OnInit, AfterViewInit { } } public displayFooterForm(): boolean { - if (this.currentPage === profileFormStep.profileBeginningInfo && formType[this.routeParam] === formType.profile) + if (this.currentPage === profileFormStep.profileBeginningInfo && formType[this.routeParam] === formType.profile) { return false; + } return true; } diff --git a/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.ts b/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.ts index c88bf56e9c573d9793f76d9fd7a42ce80026fe3d..dee1bbd08421013ff370daaacc8afa1972e92a87 100644 --- a/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.ts +++ b/src/app/form/form-view/personal-offer-form/personal-offer-training-type/personal-offer-training-type.component.ts @@ -12,7 +12,7 @@ export class PersonalOfferTrainingTypeComponent { @Input() personalOfferForm: UntypedFormGroup; @Input() trainingCategories: CategoriesToggle[]; - public setTrainingsFromCategories(categories: Category[]) { + public setTrainingsFromCategories(categories: Category[]): void { for (const categorie of categories) { const moduleIds: string[] = categorie.modules.map((module) => module.id); if (this.personalOfferForm.get('categories').get(categorie.id)) { diff --git a/src/app/form/form-view/profile-form/profile-employer-selection/profile-employer-selection.component.ts b/src/app/form/form-view/profile-form/profile-employer-selection/profile-employer-selection.component.ts index 1f73a36d9661ae846d73f98e90427010e0037e9d..4eb5c9f18cc09c696d05c69b262503e1499f92db 100644 --- a/src/app/form/form-view/profile-form/profile-employer-selection/profile-employer-selection.component.ts +++ b/src/app/form/form-view/profile-form/profile-employer-selection/profile-employer-selection.component.ts @@ -40,7 +40,7 @@ export class ProfileEmployerSelectionComponent { this.validateForm.emit(); } - private getEmployers(searchString = '') { + private getEmployers(searchString = ''): void { if (!this.isAlreadySearching) { this.isAlreadySearching = true; this.profileService.getEmployers(searchString).subscribe((employers) => { diff --git a/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts b/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts index 21b343b6e34c58c1a0bbfc787f00290da44d7b57..0603a0c582d8766e598b7b5a8aef165fd7d2b5dd 100644 --- a/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts +++ b/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts @@ -56,7 +56,7 @@ export class ProfileStructureChoiceComponent implements OnInit { if (structure.alreadySelected) { return; } - this.itemSelected = this.itemSelected == structure._id ? null : structure._id; + this.itemSelected = this.itemSelected === structure._id ? null : structure._id; if (this.itemSelected) { this.selectedStructureItem = structure; this.structureForm.patchValue({ _id: structure._id, structureName: structure.structureName }); @@ -95,7 +95,7 @@ export class ProfileStructureChoiceComponent implements OnInit { } } - private sortStructures(structures: Structure[]) { + private sortStructures(structures: Structure[]): Structure[] { if (this.searchString === '') structures.sort((a, b) => a.structureName.localeCompare(b.structureName)); structures.sort((a, b) => Number(b.alreadySelected) - Number(a.alreadySelected)); return structures; diff --git a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts index fb59cf6bd0fd2f65982c476f4f06fc0787b2962b..c22736f7af69ddfafadaca5c4204d95fb59462ee 100644 --- a/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts +++ b/src/app/form/form-view/structure-form/structure-access-modality/structure-access-modality.component.ts @@ -20,7 +20,7 @@ export class StructureAccessModalityComponent implements OnInit { this.validateForm.emit(); } - public onCheckChange(event: boolean, formControlName: string, modality: string) { + public onCheckChange(event: boolean, formControlName: string, modality: string): void { this.checkChange.emit({ event, formControlName, @@ -28,7 +28,7 @@ export class StructureAccessModalityComponent implements OnInit { }); } - public isInArray(formControlName: string, term: string) { + public isInArray(formControlName: string, term: string): boolean { return this.formUtils.isInCategoryArray(term, formControlName, this.structureForm); } diff --git a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts index 0bfe25eec9647cf43445e7775e393f29ee5b620b..0dac3d4a163e0e5e498e6b863a0d21d335e37e98 100644 --- a/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts +++ b/src/app/form/form-view/structure-form/structure-contact/structure-contact.component.ts @@ -23,7 +23,7 @@ export class StructureContactComponent implements OnInit { } public isRequirePhoneOrMailNotValid(): boolean { - return this.structureForm.errors?.['requirePhoneOrMail'] ?? false; + return this.structureForm.errors.requirePhoneOrMail ?? false; } public isContactMailValid(): boolean { diff --git a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts index e89ef6b91c3f69a69405b06385b1b3773fd1cbe1..8bc10c09440709b895f1490879567d3cb094c3a3 100644 --- a/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts +++ b/src/app/form/form-view/structure-form/structure-digital-helping-accompaniment/structure-digital-helping-accompaniment.component.ts @@ -20,11 +20,11 @@ export class StructureDigitalHelpingAccompanimentComponent implements OnInit { this.validateForm.emit(); } - public updateChoiceAccompaniment(choice: string) { + public updateChoiceAccompaniment(choice: string): void { this.updateChoice.emit({ formControlName: 'categories.onlineProcedures', choice }); } - public isInArray(choice: string) { + public isInArray(choice: string): boolean { if (this.structureForm.get('categories').get('onlineProcedures')?.value.includes(choice)) return true; return false; } diff --git a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts index 4e68395b5dad8254bb273c37f6f98a348e5397ff..da5810917492b5972da93c4568726576f8537a4c 100644 --- a/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts +++ b/src/app/form/form-view/structure-form/structure-equipments/structure-equipments.component.ts @@ -38,7 +38,7 @@ export class StructureEquipmentsComponent implements OnInit { this.validateForm.emit(); } - public setValidationsForm() { + public setValidationsForm(): void { this.validateForm.emit(); } diff --git a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts index 2b9465ba81e4bd1d308c302f65a38845983ec37d..3be5fa8d9e0b9823ab15f1cf02278620da720559 100644 --- a/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts +++ b/src/app/form/form-view/structure-form/structure-hours/structure-hours.component.ts @@ -18,10 +18,10 @@ export class StructureHoursComponent implements OnInit { this.validateForm.emit(); } - public updateHours(value) { + public updateHours(value): void { this.hours.emit(value); } - public setHoursError() { + public setHoursError(): void { this.hoursError.emit(); } public goBack(): void { diff --git a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts index 32d9087c217ae57b1960e71e1f04a2481f19c037..33ba19f484fa7c38f213c0e584c2c115d529a649 100644 --- a/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts +++ b/src/app/form/form-view/structure-form/structure-labels/structure-labels.component.ts @@ -23,7 +23,7 @@ export class StructureLabelsComponent implements OnInit { public isInArray(term: string, formControlName: string): boolean { return this.formUtils.isInCategoryArray(term, formControlName, this.structureForm); } - public onCheckChange(event: boolean, formControlName: string, modality: string) { + public onCheckChange(event: boolean, formControlName: string, modality: string): void { this.checkChange.emit({ event, formControlName, diff --git a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts index 70738dac28e969cb85cfb394ab67b6bc0b33a02e..8333b1e607587b0dab9c605c537c625774fa638d 100644 --- a/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts +++ b/src/app/form/form-view/structure-form/structure-name-and-address/structure-name-and-address.component.ts @@ -16,11 +16,11 @@ export class StructureNameAndAddressComponent implements OnInit { this.validateForm.emit(); } - public setValidationsForm() { + public setValidationsForm(): void { this.validateForm.emit(); } - public setAddressStructure(address?: Address) { + public setAddressStructure(address?: Address): void { this.addressStructure.emit(address); } public goBack(): void { diff --git a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts index 2c7871bf3407da5a8d6e6c0acdd4225434d21d11..79560c5ede1310eb2b4c2687e04d36041a77ba36 100644 --- a/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts +++ b/src/app/form/form-view/structure-form/structure-public-target/structure-public-target.component.ts @@ -27,7 +27,7 @@ export class StructurePublicTargetComponent implements OnInit, OnChanges { if (changes.isMandatoryFields) this.validateForm.emit(); } - public updateChoicePublic(choice: string, formControlName: string) { + public updateChoicePublic(choice: string, formControlName: string): void { this.updateChoice.emit({ formControlName: `categories.${formControlName}`, choice }); } diff --git a/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts index c7500331b644f23d6f36c3199d5e3387e33489d5..75f31b4c5cb4898b46d9154302e4846719d8a77e 100644 --- a/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts +++ b/src/app/form/form-view/structure-form/structure-solidarity-material/structure-solidarity-material.component.ts @@ -21,7 +21,7 @@ export class StructureSolidarityMaterialComponent implements OnInit { this.validateForm.emit(); } - public updateChoiceSolidarityMaterial(choice: string) { + public updateChoiceSolidarityMaterial(choice: string): void { this.updateChoice.emit({ formControlName: 'categories.solidarityMaterial', choice }); } diff --git a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts index b13e1a7cc6fc8b560d4a18ae5a3f4af64adcb813..afc0ba2ee0b560623aa5bb65b6f1ea4c1416da62 100644 --- a/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts +++ b/src/app/form/form-view/structure-form/structure-training-type/structure-training-type.component.ts @@ -17,7 +17,7 @@ export class StructureTrainingTypeComponent implements OnInit { this.validateForm.emit(); } - public setTrainingsFromCategories(categories: Category[]) { + public setTrainingsFromCategories(categories: Category[]): void { for (const categorie of categories) { const moduleIds: string[] = categorie.modules.map((module) => module.id); if (this.structureForm.get('categories').get(categorie.id)) { diff --git a/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts b/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts index 99340cafe27fa1e1a04394f7e6bfb3a9234d4d63..906beaa3ad03006eb020321464b4b6393a60d088 100644 --- a/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts +++ b/src/app/form/form-view/structure-form/structure-type/structure-type.component.ts @@ -15,7 +15,7 @@ export class StructureTypeComponent implements OnInit { this.validateForm.emit(); } - public setTypeStructure(value: string) { + public setTypeStructure(value: string): void { this.typeStructure.emit(value); } public goBack(): void { diff --git a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts index d04e0388164640382467383831802fa7e10ae33c..bafe4ebb8c8c194f30254ae4a88638211b6ed3eb 100644 --- a/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts +++ b/src/app/form/form-view/structure-form/structure-web-and-social-network/structure-web-and-social-network.component.ts @@ -23,11 +23,11 @@ export class StructureWebAndSocialNetworkComponent implements OnInit { this.validateForm.emit(); } - public toggleSocialNetwork() { + public toggleSocialNetwork(): void { this.toggleSocials.emit(); } - public toggleWebSite() { + public toggleWebSite(): void { this.toggleWebsite.emit(); } diff --git a/src/app/form/orientation-form-view/global-components/multi-radio-form/multi-radio-form.component.ts b/src/app/form/orientation-form-view/global-components/multi-radio-form/multi-radio-form.component.ts index cd50a75f039e214c91d64a903d33561bbf0a8006..bd094556599f2d49c31f7cf52da948d2098f47f7 100644 --- a/src/app/form/orientation-form-view/global-components/multi-radio-form/multi-radio-form.component.ts +++ b/src/app/form/orientation-form-view/global-components/multi-radio-form/multi-radio-form.component.ts @@ -16,7 +16,7 @@ export class MultiRadioFormComponent implements OnInit { public selectedItem: NeedsType | string; - ngOnInit() { + ngOnInit(): void { if (this.selected) this.selectedItem = this.selected; } diff --git a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts index 339854554b86db931fdf194e7c3622f61686f1e3..23514aa36dc1e35ca6ef1d052afaa9f2dc5561a4 100644 --- a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts +++ b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts @@ -28,11 +28,11 @@ export class NavigationComponent { public buttonTypeEnum = ButtonType; public NeedsTypeEnum = NeedsType; constructor(private router: Router, private route: ActivatedRoute) {} - public nextPage(isPrint?: boolean) { + public nextPage(isPrint?: boolean): void { this.goNext.emit(isPrint); } - public prevPage() { + public prevPage(): void { this.goPrev.emit(); } public goCarto(): void { diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts index f37b5d7d51f713c062aad6c1a2ea826167ec35fe..ff1eb19cccf17537e312a763eea5907c11201ef4 100644 --- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts +++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts @@ -18,10 +18,10 @@ export class NeedsSelectionComponent implements OnInit { constructor(public orientationService: OrientationService, private personalOfferService: PersonalOfferService) {} - ngOnInit() { + ngOnInit(): void { if (this.orientationService.rdvUser || this.orientationService.rdvStructure) { this.needsList = this.needsList.filter( - (item: INeedItem) => item.key == NeedsType.onlineDemarch || item.key == NeedsType.learnSkills + (item: INeedItem) => item.key === NeedsType.onlineDemarch || item.key === NeedsType.learnSkills ); } @@ -43,11 +43,11 @@ export class NeedsSelectionComponent implements OnInit { } } - public selectNeed(event: NeedsType) { + public selectNeed(event: NeedsType): void { this.setNeedType.emit(event); } public getSelected(): string | NeedsType { - const selected = this.needsList.filter((need) => need.key == this.currentNeed)[0]; + const selected = this.needsList.filter((need) => need.key === this.currentNeed)[0]; if (selected) { this.validate.emit(); return selected.key; diff --git a/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts b/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts index f63414f7f5a9a25d00ee6875a77018d307888dfc..d2d5bedbe96d4cfb7ce20af67add6cd2d7174f3f 100644 --- a/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts +++ b/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts @@ -46,7 +46,7 @@ export class StructureOrientatorComponent implements OnInit { this.validatePage.emit(this.form.valid); } - public updatedForm(field: string, target: EventTarget) { + public updatedForm(field: string, target: EventTarget): void { const value = (target as HTMLInputElement).value; if (field === 'phone') { this.utils.modifyPhoneInput(this.form, 'phone', target); diff --git a/src/app/form/orientation-form-view/interfaces/appointment.interface.ts b/src/app/form/orientation-form-view/interfaces/appointment.interface.ts index 0a43eb127558c9a73e430210dfd6b626cd8fe089..5f83b214848063c9a9fe358582102f871c7e78c1 100644 --- a/src/app/form/orientation-form-view/interfaces/appointment.interface.ts +++ b/src/app/form/orientation-form-view/interfaces/appointment.interface.ts @@ -1,7 +1,7 @@ export interface IAppointment { structureOrientator: { structureName: string; structureMail: string; structurePhone: string }; structureRDV: string; - onlineDemarcheType: string[]; + onlineDemarcheType: { name: string }[]; socialWorkerId: string; details: string; name: string; diff --git a/src/app/form/orientation-form-view/online-demarch/online-mediation/mediation-beneficiary-info/mediation-beneficiary-info.component.ts b/src/app/form/orientation-form-view/online-demarch/online-mediation/mediation-beneficiary-info/mediation-beneficiary-info.component.ts index 8c67872fc54084d636edd683d40d84abbedc510f..eddda6a5d9e02cc048e37976328a0a0be4e5d1ae 100644 --- a/src/app/form/orientation-form-view/online-demarch/online-mediation/mediation-beneficiary-info/mediation-beneficiary-info.component.ts +++ b/src/app/form/orientation-form-view/online-demarch/online-mediation/mediation-beneficiary-info/mediation-beneficiary-info.component.ts @@ -26,7 +26,7 @@ export class MediationBeneficiaryInfoComponent implements OnInit { return Boolean(this.form.get('email')); } - public updatedForm(field: string, target: EventTarget) { + public updatedForm(field: string, target: EventTarget): void { const value = (target as HTMLInputElement).value; if (field === 'phone') { this.utils.modifyPhoneInput(this.form, 'phone', target); diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts index f53e29364ced5c8928f2a7720c5c49547ca4401d..d0dd6b8351f0a7d2fa18d6dfe862536d5011d9ec 100644 --- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts +++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts @@ -111,10 +111,10 @@ export class OnlineDemarchFormComponent { } } - public getSocialWorker(item: Owner) { + public getSocialWorker(item: Owner): void { this.socialWorker = item; } - public getSelectedStructureRDV(structure: Structure) { + public getSelectedStructureRDV(structure: Structure): void { this.selectedStructureRDV = structure; } diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts index 281720e4f75a93837d01c0f21da62272983fd6aa..5d9b2a72a3130fd24e23f22300f7e070256f44bf 100644 --- a/src/app/form/orientation-form-view/orientation-form-view.component.ts +++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts @@ -124,7 +124,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked ) { this.setCategories(); } - async ngOnInit() { + async ngOnInit(): Promise<void> { this.orientationService.rdvUser = null; if (history.state.rdvUser) { this.orientationService.rdvUser = new User(history.state.rdvUser); @@ -160,15 +160,15 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked } } - ngAfterContentChecked() { + ngAfterContentChecked(): void { this.cdref.detectChanges(); } - public validatePage(event: boolean) { + public validatePage(event: boolean): void { this.isPageValid = event; } - public validateStructureRDV(event: Structure) { + public validateStructureRDV(event: Structure): void { this.onlineDemarcheForm.get('structureRDV').patchValue(event._id); this.nextPage(); } @@ -223,7 +223,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked }; // pmrAccess filter must not be send in the onlineDemarcheType array of the appointment - appointment.onlineDemarcheType = appointment.onlineDemarcheType.filter((item) => item['name'] != 'pmrAccess'); + appointment.onlineDemarcheType = appointment.onlineDemarcheType.filter((item) => item.name !== 'pmrAccess'); await lastValueFrom(this.orientationService.createAppointment(appointment)); this.canDeactivate = true; @@ -242,7 +242,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked this.canDeactivate = true; this.notificationService.showSuccess('Votre démarche en ligne a bien été enregistrée'); }) - .catch((error) => { + .catch(() => { this.notificationService.showErrorPleaseRetry('Echec de la création de votre démarche en ligne'); }) .finally(() => this.printForm()); @@ -258,7 +258,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked }, 100); } - public setOnlineEquipmentsForm() { + public setOnlineEquipmentsForm(): void { this.currentType = OnlineDemarche.structureList; this.currentStep = StructuresListSteps.pmrAccess; // first filter screen + regular StructureList form @@ -269,7 +269,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked ); } - public setOnlineProceduresForm() { + public setOnlineProceduresForm(): void { switch (this.onlineDemarcheForm.get('accompanimentType').value) { case OnlineDemarche.structureList: this.currentType = OnlineDemarche.structureList; @@ -282,7 +282,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked case OnlineDemarche.appointment: this.currentType = OnlineDemarche.appointment; // Skip first screen appointment info for learnSkills - if (this.indicatorNeedType == NeedsType.learnSkills) { + if (this.indicatorNeedType === NeedsType.learnSkills) { this.currentStep = AppointmentSteps.infoScreen + 1; } else { this.currentStep = AppointmentSteps.infoScreen; @@ -327,7 +327,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked }); } - private skipStructureOrientator(isNextPage: boolean) { + private skipStructureOrientator(isNextPage: boolean): void { if (this.profile?.structuresLink?.length === 1) { // skip structureOrientator if user with only one structure if (isNextPage) { @@ -463,7 +463,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked // For orientation rdv, structure categories must be ignored: we filter only on personalOffers with appointment of the structure (await lastValueFrom(this.structureService.getStructures(this.filters, 'search', true))).filter( (structure) => structure.hasUserWithAppointmentDN - ).length == 0 + ).length === 0 ) { this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm); this.currentStep = AppointmentSteps.rdvEnd - 1; diff --git a/src/app/form/orientation-form-view/orientation-structure-list/orientation-comments/orientation-comments.component.ts b/src/app/form/orientation-form-view/orientation-structure-list/orientation-comments/orientation-comments.component.ts index b2efa8288c0a7eb323c70167f91eb7d863521e89..3fbac07deaa8b87ed60931ecc998fe810ed8b95c 100644 --- a/src/app/form/orientation-form-view/orientation-structure-list/orientation-comments/orientation-comments.component.ts +++ b/src/app/form/orientation-form-view/orientation-structure-list/orientation-comments/orientation-comments.component.ts @@ -18,7 +18,7 @@ export class OrientationCommentsComponent implements OnInit { return this.form.get(nameControl); } - public setComment(target?: EventTarget) { + public setComment(target?: EventTarget): void { this.checkValidation.emit((target as HTMLTextAreaElement).value); } } diff --git a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-address/orientation-structure-address.component.ts b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-address/orientation-structure-address.component.ts index b93635debc8600cdd84c5c1be3865f95a4aa7cf1..52c536fdc956fe7a997ddee5bc4097354c81665a 100644 --- a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-address/orientation-structure-address.component.ts +++ b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-address/orientation-structure-address.component.ts @@ -16,7 +16,7 @@ export class OrientationStructureAddressComponent implements OnInit { this.setAddressStructure(); } - public setAddressStructure(address?: Address) { + public setAddressStructure(address?: Address): void { this.form.get('address').patchValue(address); this.addressStructure.emit(address); } diff --git a/src/app/guards/role.guard.ts b/src/app/guards/role.guard.ts index 86ebe58ea651ba0fdf797bde84f670a03f65ab2d..ae8e00615088d67e47494b5bb9a66383c4a3e129 100644 --- a/src/app/guards/role.guard.ts +++ b/src/app/guards/role.guard.ts @@ -12,7 +12,7 @@ export class RoleGuard implements CanActivate { constructor(private router: Router, private profileService: ProfileService, private authService: AuthService) {} canActivate(route: ActivatedRouteSnapshot): UrlTree | boolean { - const allowedRoles = route.data['allowedRoles']; + const allowedRoles = route.data.allowedRoles; if (this.authService.isLoggedIn()) { if (this.profileService.isAdmin()) return true; diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index e79bfc913b0bbb6c60b78e8068fce81d272f80e8..96154c632a6b76fa9b12eb2492bf4e8e01322e6c 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -101,7 +101,7 @@ export class LoginComponent implements OnInit { } } catch (e) { this.loading = false; - if (e.status == 418) { + if (e.status === 418) { this.isUnverifiedEmail = true; } else { this.authFailed = true; diff --git a/src/app/map/components/map.component.ts b/src/app/map/components/map.component.ts index 86be3dbdd0b676f35a47320c0a3453da78b4034e..c4f30ca5ffa4b4e825b235e118bc4f4632a06596 100644 --- a/src/app/map/components/map.component.ts +++ b/src/app/map/components/map.component.ts @@ -138,7 +138,7 @@ export class MapComponent implements OnChanges { this.map.fitBounds(bounds); } }, - (err) => { + () => { this.map.flyTo(this.mapOptions.center, this.mapOptions.zoom, this.zoomOptions); } ); diff --git a/src/app/map/services/marker.ts b/src/app/map/services/marker.ts index 35efbc6ed376d8781d8163247edf5a732eb43a6d..c640c4a20df8b0d3fa715db930b697e700d81d46 100644 --- a/src/app/map/services/marker.ts +++ b/src/app/map/services/marker.ts @@ -36,8 +36,7 @@ export const userLocationIcon = divIcon({ }); export const markerIconMdm = divIcon({ className: null, - html: - '<svg width="19" height="24" fill="#D4C4A9" class="mdm"><use xlink:href="assets/ico/sprite.svg#mdm"></use></svg>', + html: '<svg width="19" height="24" fill="#D4C4A9" class="mdm"><use xlink:href="assets/ico/sprite.svg#mdm"></use></svg>', iconSize: [19, 24], iconAnchor: [9, 0], }); @@ -49,16 +48,14 @@ export const markerIconMdmActive = divIcon({ }); export const markerIconFranceService = divIcon({ className: null, - html: - '<svg width="48" height="48" fill="#ED3939" class="france-service"><use xlink:href="assets/ico/sprite.svg#conseillerFranceService"></use></svg>', + html: '<svg width="48" height="48" fill="#ED3939" class="france-service"><use xlink:href="assets/ico/sprite.svg#conseillerFranceService"></use></svg>', iconSize: [48, 48], iconAnchor: [24, 48], popupAnchor: [0, -48], }); export const markerIconFranceServiceActive = divIcon({ className: null, - html: - '<svg width="48" height="48"><use xlink:href="assets/ico/sprite.svg#conseillerFranceServiceSelected"></use></svg>', + html: '<svg width="48" height="48"><use xlink:href="assets/ico/sprite.svg#conseillerFranceServiceSelected"></use></svg>', iconSize: [48, 48], iconAnchor: [24, 48], popupAnchor: [0, -48], diff --git a/src/app/models/address.model.ts b/src/app/models/address.model.ts index 8ef6bc349a222c69531a34eac3331b4174c974a2..75ab6690c71587202c8967ada1d0f2bae5c33574 100644 --- a/src/app/models/address.model.ts +++ b/src/app/models/address.model.ts @@ -1,7 +1,7 @@ -export class Address { - numero: string = null; - street: string = null; - commune: string = null; - postcode?: number = null; - coordinates? = []; -} +export class Address { + numero: string = null; + street: string = null; + commune: string = null; + postcode?: number = null; + coordinates? = []; +} diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts index d027aad00329bc9bdd04e5a5a55bb6104545cce6..cb2ee15264f7319321f486e774a0a23386188ad8 100644 --- a/src/app/models/structure.model.ts +++ b/src/app/models/structure.model.ts @@ -115,7 +115,6 @@ export class Structure { /** * Verify that a structure as not only equipments with 0 as value. This is mostly use for display. - * @returns {boolean} validation */ public hasNotOnlyEmptyEquipments(): boolean { if (this.nbComputers + this.nbPrinters + this.nbScanners > 0) return true; @@ -192,13 +191,13 @@ export class Structure { public getTypeStructureIcon(): StructureCategoryIconEnum { switch (this.structureType?.category) { case StructureCategoryEnum.public: - return StructureCategoryIconEnum['public']; + return StructureCategoryIconEnum.public; case StructureCategoryEnum.private: - return StructureCategoryIconEnum['private']; + return StructureCategoryIconEnum.private; case StructureCategoryEnum.privateLucrative: - return StructureCategoryIconEnum['privateLucrative']; + return StructureCategoryIconEnum.privateLucrative; default: - return StructureCategoryIconEnum['public']; + return StructureCategoryIconEnum.public; } } diff --git a/src/app/models/user.model.ts b/src/app/models/user.model.ts index 5efb37d6a442c96852af974ded92086ece4f54e9..e35d02e679406f18581f16cff96f8437872f77a7 100644 --- a/src/app/models/user.model.ts +++ b/src/app/models/user.model.ts @@ -5,6 +5,7 @@ import { PersonalOffer } from './personalOffer.model'; export class User { _id: string; + id: string; createdAt: Date; email: string; name: string; diff --git a/src/app/models/week.model.ts b/src/app/models/week.model.ts index 25f1d8975873bf2d8a7ec0b04725825255085a58..94e35a67c33f9382801bcb514c40c9e44b3e4e8f 100644 --- a/src/app/models/week.model.ts +++ b/src/app/models/week.model.ts @@ -62,7 +62,7 @@ export class Week { } } - public hasData() { + public hasData(): boolean { if ( this.monday.time.length === 0 && this.tuesday.time.length === 0 && diff --git a/src/app/page/page.component.ts b/src/app/page/page.component.ts index 9908755651efaaa5f888737fe067e158c6147036..dba9dd89b813791049cde72e766690a38e8d3b37 100644 --- a/src/app/page/page.component.ts +++ b/src/app/page/page.component.ts @@ -43,7 +43,7 @@ export class PageComponent implements OnInit { }); }); // Display version number in 'About' page only - this.version = this.slugPage == PageEnum.quiSommesNous ? packageJson.version : ''; + this.version = this.slugPage === PageEnum.quiSommesNous ? packageJson.version : ''; }); } } diff --git a/src/app/post/components/post-header/post-header.component.ts b/src/app/post/components/post-header/post-header.component.ts index 5d9be717d45fbc0d584defcfa3761ffb5572b293..4e713fabc4562853be5734ddc8e894483bc1faea 100644 --- a/src/app/post/components/post-header/post-header.component.ts +++ b/src/app/post/components/post-header/post-header.component.ts @@ -130,7 +130,7 @@ export class PostHeaderComponent implements OnInit { if (this.mainActiveTag.slug === TagEnum.aLaUne) { return ''; } - return this.mainActiveTag.slug == this.tagEnum.etudes ? this.mainActiveTag.name : this.mainActiveTag.slug; + return this.mainActiveTag.slug === this.tagEnum.etudes ? this.mainActiveTag.name : this.mainActiveTag.slug; } public togglePublishNews(): void { diff --git a/src/app/post/components/post-list/post-list.component.ts b/src/app/post/components/post-list/post-list.component.ts index 46162ac877c59cba888b5718eb1a0cdf77b634f1..2a25b8d48f6a1fe328d1b27c05d0f6a1307089fd 100644 --- a/src/app/post/components/post-list/post-list.component.ts +++ b/src/app/post/components/post-list/post-list.component.ts @@ -65,7 +65,6 @@ export class PostListComponent implements OnInit { /** * Fill articles list with headline handling - * @param news {PostWithMeta} */ public fillArticles(news: PostWithMeta): void { this.setNews(news); diff --git a/src/app/post/components/utils/NewsUtils.ts b/src/app/post/components/utils/NewsUtils.ts index 4bb4eea6b9bada44033a1746d1eb200fd1dfd032..9376c0660d3bfc775d8e5d84dd83f6f89ba40b7e 100644 --- a/src/app/post/components/utils/NewsUtils.ts +++ b/src/app/post/components/utils/NewsUtils.ts @@ -3,7 +3,7 @@ import { Tag } from '../../models/tag.model'; export function parseSlugToTag(data: Tag[] | string): Tag[] { let otherTags = []; if (Array.isArray(data)) { - otherTags = data.map((slug) => new Tag({ slug: slug })); + otherTags = data.map((slug) => new Tag({ slug })); } else if (data) { otherTags = [new Tag({ slug: data })]; } diff --git a/src/app/post/services/post.service.ts b/src/app/post/services/post.service.ts index ef2771e3758efeb371f10a47b6921263f766ab6c..e95c455c9cb430c673758abf271ca4c29bbc585d 100644 --- a/src/app/post/services/post.service.ts +++ b/src/app/post/services/post.service.ts @@ -32,7 +32,7 @@ export class PostService { // Transform tab filters to string filters tags.forEach((tag, index) => { tagsString += tag; - if (index != tags.length - 1) { + if (index !== tags.length - 1) { tagsString += '+tags:'; } }); diff --git a/src/app/profile/edit/edit.component.ts b/src/app/profile/edit/edit.component.ts index 8a893d12366470d6072d96dbf284b4047893caa7..a384d01524ea49a050b9c3aee974f7c8cf6cf5d8 100644 --- a/src/app/profile/edit/edit.component.ts +++ b/src/app/profile/edit/edit.component.ts @@ -172,7 +172,7 @@ export class EditComponent implements OnInit { if (this.emailModal) { return this.emailValid(this.newEmail) && this.newEmail === this.newEmailConfirm; } else if (this.passwordModal) { - return this.passwordValid(this.newPassword) && this.newPassword == this.newPasswordConfirm; + return this.passwordValid(this.newPassword) && this.newPassword === this.newPasswordConfirm; } } else if (this.currentTab === tabsEnum.employer) { if (this.isNewUser) { @@ -268,7 +268,7 @@ export class EditComponent implements OnInit { } // Updates initialProfile so the button "Valider" is disabled after the user sends new values - private updateInitialProfile() { + private updateInitialProfile(): void { this.initialUserProfile = { ...this.userProfile }; } @@ -282,12 +282,12 @@ export class EditComponent implements OnInit { } public confirmNewPassword(): void { - if (this.passwordValid(this.newPassword) && this.newPassword == this.newPasswordConfirm) { + if (this.passwordValid(this.newPassword) && this.newPassword === this.newPasswordConfirm) { this.profileService .changePassword(this.newPassword, this.oldPassword) .pipe( catchError(async (response: HttpErrorResponse) => { - if (response.error.statusCode == 401) { + if (response.error.statusCode === 401) { this.notificationService.showError('Une erreur est survenue'); throw new Error('Une erreur est survenue'); } @@ -358,7 +358,7 @@ export class EditComponent implements OnInit { this.isNewEmployer = false; } - private getEmployers(searchString = '') { + private getEmployers(searchString = ''): void { if (!this.isAlreadySearching) { this.isAlreadySearching = true; this.profileService.getEmployers(searchString).subscribe((employers) => { @@ -369,7 +369,7 @@ export class EditComponent implements OnInit { } public canExit(): Promise<boolean> { - if (this.hasPersonalOffer && this.selectedRdvChoice == undefined) { + if (this.hasPersonalOffer && this.selectedRdvChoice === undefined) { return new Promise(() => this.showModal()); } } diff --git a/src/app/profile/personal-offer-edition/personal-offer-edition.component.ts b/src/app/profile/personal-offer-edition/personal-offer-edition.component.ts index c9c78300d89d65e50ac2382a0636ab9e94d77e32..6d71016f10287a927ba839bdca9b63f7ae58c88b 100644 --- a/src/app/profile/personal-offer-edition/personal-offer-edition.component.ts +++ b/src/app/profile/personal-offer-edition/personal-offer-edition.component.ts @@ -108,7 +108,7 @@ export class PersonalOfferEditionComponent implements OnInit { } } - public setTrainingsFromCategories(categories: Category[]) { + public setTrainingsFromCategories(categories: Category[]): void { for (const categorie of categories) { const moduleIds: string[] = categorie.modules.map((module) => module.id); if (this.personalOfferForm.get('categories').get(categorie.id)) { @@ -125,7 +125,7 @@ export class PersonalOfferEditionComponent implements OnInit { this.deleteOfferModal = false; } - public confirmDeleteOffer() { + public confirmDeleteOffer(): void { this.personalOfferService.deletePersonalOffer(this.personalOffer._id).subscribe( () => { this.notificationService.showSuccess('Votre offre de service a bien été supprimée.'); diff --git a/src/app/profile/profile-newsletter/profile-newsletter.component.ts b/src/app/profile/profile-newsletter/profile-newsletter.component.ts index 688a91a09f05b741c6721e2f4f5811d944ba3f93..40a13da51088d728b9662262bfa600ceb7550093 100644 --- a/src/app/profile/profile-newsletter/profile-newsletter.component.ts +++ b/src/app/profile/profile-newsletter/profile-newsletter.component.ts @@ -24,7 +24,7 @@ export class ProfileNewsletterComponent implements OnInit { }); } - public handleSubscribe() { + public handleSubscribe(): void { this.isLoading = true; this.newsletterService.subscribe(this.userEmail).subscribe({ next: (result) => { @@ -48,7 +48,7 @@ export class ProfileNewsletterComponent implements OnInit { }); } - public handleUnsubscribe() { + public handleUnsubscribe(): void { this.isLoading = true; this.newsletterService.unsubscribe(this.userEmail).subscribe({ next: (result) => { diff --git a/src/app/profile/profile-structure/profile-structure.component.ts b/src/app/profile/profile-structure/profile-structure.component.ts index 3eaef27af26e231f466c0509d2985c0550d3ccfb..5a882ae4ab5ca3cf1f9aa69991112ab26cfa4e97 100644 --- a/src/app/profile/profile-structure/profile-structure.component.ts +++ b/src/app/profile/profile-structure/profile-structure.component.ts @@ -69,8 +69,9 @@ export class ProfileStructureComponent implements OnInit { !this.userProfile?.personalOffers || !this.userProfile?.job?.hasPersonalOffer || this.userProfile?.personalOffers?.length === 0 - ) + ) { return null; + } // Check if structure has personal offers if (this.structure.personalOffers.length === 0) return null; diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index ccf783c717e481dd1c4471214b6a300a0f5ff2d7..058f9ce9c7f62b3db47e2357b7724692c67124e1 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -66,7 +66,7 @@ export class ProfileComponent implements OnInit { }); } - private getStructuresFromProfile() { + private getStructuresFromProfile(): void { const structures$: Observable<any>[] = []; this.structures = []; @@ -83,7 +83,7 @@ export class ProfileComponent implements OnInit { this.structures.sort((a, b) => a.structure.structureName.localeCompare(b.structure.structureName)); }); } - private getPendingStructuresFromProfile() { + private getPendingStructuresFromProfile(): void { const structures$: Observable<any>[] = []; this.structures = []; this.userProfile.pendingStructuresLink.forEach((pending: pendingStructureLink) => { diff --git a/src/app/profile/services/profile.service.ts b/src/app/profile/services/profile.service.ts index da35a4a9caf46de0df37a68ab90a2987311a64db..71ec026403a7570ddd37e96a3b5cdc4ecabc46ff 100644 --- a/src/app/profile/services/profile.service.ts +++ b/src/app/profile/services/profile.service.ts @@ -58,7 +58,7 @@ export class ProfileService { const token = user.accessToken; // decode the token to get its payload const tokenPayload: User = decode(token); - if (tokenPayload.role == UserRole.admin) { + if (tokenPayload.role === UserRole.admin) { return true; } return false; diff --git a/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts b/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts index 2131cd9ab822927ba0ee1b94dbf2f42909284f8e..decb4f2ae56115e2165b13d193ee4e4448f66977 100644 --- a/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts +++ b/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts @@ -57,7 +57,7 @@ export class StructureAddMemberModalComponent implements OnInit { } this.closed.emit(true); }, - (err) => { + () => { this.ownerAlreadyLinked = true; } ); diff --git a/src/app/profile/structure-edition-summary/no-information/no-information.component.ts b/src/app/profile/structure-edition-summary/no-information/no-information.component.ts index 7946e84e00b1d5d3d5ad0905be2108e95e3324d7..81c2715b7799cb853bb94068db2c9445407149f4 100644 --- a/src/app/profile/structure-edition-summary/no-information/no-information.component.ts +++ b/src/app/profile/structure-edition-summary/no-information/no-information.component.ts @@ -3,6 +3,6 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-no-information', templateUrl: './no-information.component.html', - styleUrls: ['./no-information.component.scss'] + styleUrls: ['./no-information.component.scss'], }) export class NoInformationComponent {} diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts index 1e7fc52459353019c58aa4bbac518ef931df431e..833b1ed3b87f2457aec4438712ce7bd6b0f904c9 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.ts @@ -165,7 +165,7 @@ export class StructureEditionSummaryComponent implements OnInit { this.showAdvancedSkills = !this.showAdvancedSkills; } - public hasWifi(selfServiceMaterial: string[]) { + public hasWifi(selfServiceMaterial: string[]): boolean { return this.utils.hasWifi(selfServiceMaterial); } diff --git a/src/app/profile/structures-management/structures-management.component.ts b/src/app/profile/structures-management/structures-management.component.ts index ae3a5ee0131390367ca89b645b860d17d2f7924c..61fe17b2edbcb11d66c269cdc16cd864e9b1da5a 100644 --- a/src/app/profile/structures-management/structures-management.component.ts +++ b/src/app/profile/structures-management/structures-management.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; -import { forkJoin, Observable } from 'rxjs'; +import { Observable, forkJoin } from 'rxjs'; import { tap } from 'rxjs/operators'; import { Structure } from '../../models/structure.model'; import { StructureWithOwners } from '../../models/structureWithOwners.model'; @@ -109,7 +109,7 @@ export class StructuresManagementComponent implements OnInit { public cancelDelete(structure: Structure, shouldCancel: boolean): void { this.cancelDeleteModalOpened = false; if (shouldCancel) { - this.structureService.cancelDelete(structure._id).subscribe((res) => { + this.structureService.cancelDelete(structure._id).subscribe(() => { this.getStructures(); }); } diff --git a/src/app/reset-password/reset-password.component.ts b/src/app/reset-password/reset-password.component.ts index 09b36b2fc034088f038763c4d9ba6b199da52ec5..eacae6eb8ac66d929a31aaa556c6741a86fcc8e5 100644 --- a/src/app/reset-password/reset-password.component.ts +++ b/src/app/reset-password/reset-password.component.ts @@ -30,7 +30,7 @@ export class ResetPasswordComponent implements OnInit { ngOnInit(): void { this.activatedRoute.queryParams.subscribe((params) => { - this.token = params['token']; + this.token = params.token; }); this.resetForm = this.formBuilder.group({ email: ['', Validators.required], diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index bdcd462fbced8208a6da8a9dc028116c6d6c5657..e52a3fdc9580723d6e4aaf1d1762151116d9a3dc 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -1,101 +1,101 @@ -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { DateTime } from 'luxon'; -import { BehaviorSubject, Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { UserAuth } from '../models/user-auth.model'; -import { User } from '../models/user.model'; -import { UserNamePipe } from '../shared/pipes'; -import { Utils } from '../utils/utils'; -@Injectable({ - providedIn: 'root', -}) -export class AuthService { - public userSubject: BehaviorSubject<UserAuth>; - public user: Observable<UserAuth>; - - constructor(private http: HttpClient, public utils: Utils) { - this.userSubject = new BehaviorSubject<UserAuth>(JSON.parse(localStorage.getItem('user'))); - this.user = this.userSubject.asObservable(); - } - - public get userValue(): UserAuth { - return this.userSubject.value; - } - - public get token(): string { - if (this.userSubject.value) { - return this.userSubject.value.accessToken; - } - return null; - } - - public logout(): void { - localStorage.removeItem('user'); - this.userSubject.next(null); - window.location.replace('/home'); - } - - public isLoggedIn(): boolean { - if (this.userValue) { - return DateTime.local().setZone('Europe/Paris') < this.getExpiration(); - } - return false; - } - - public getUserNameDisplay(): string { - return new UserNamePipe().transform(this.userValue.name); - } - - public getUserSurnameDisplay(): string { - return this.userValue.surname.toUpperCase(); - } - - public getUserFullNameDisplay(): string { - return `${this.getUserNameDisplay()} ${this.getUserSurnameDisplay()}`; - } - - public getUserEmailDisplay(): string { - return `${this.userValue.username}`; - } - - private getExpiration(): DateTime { - return DateTime.fromISO(this.userValue.expiresAt, { zone: 'Europe/Paris' }); - } - - public register(user: User): Observable<any> { - return this.http.post('api/users', user); - } - - public login(email: string, password: string): Observable<any> { - return this.http.post<UserAuth>('api/auth/login', { email: email.toLowerCase(), password }).pipe( - map((user) => { - // store user details and jwt token in local storage to keep user logged in between page refreshes - localStorage.setItem('user', JSON.stringify(user)); - this.userSubject.next(user); - return user; - }) - ); - } - - public resendEmail(email: string, password: string): Observable<User> { - return this.http.post<User>(`api/auth/resendEmail`, { email: email.toLowerCase(), password }); - } - - public verifyUser(userId: string, token: string): Observable<User> { - return this.http.post<User>(`api/users/verify/${userId}`, null, { - params: { token }, - }); - } - - public resetPassword(email: string): Observable<any> { - return this.http.post(`api/users/reset-password`, { email: email.toLowerCase() }); - } - - public resetPasswordApply(token: string, password: string): Observable<any> { - return this.http.post(`api/users/reset-password/apply`, { - token, - password, - }); - } -} +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { DateTime } from 'luxon'; +import { BehaviorSubject, Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; +import { UserAuth } from '../models/user-auth.model'; +import { User } from '../models/user.model'; +import { UserNamePipe } from '../shared/pipes'; +import { Utils } from '../utils/utils'; +@Injectable({ + providedIn: 'root', +}) +export class AuthService { + public userSubject: BehaviorSubject<UserAuth>; + public user: Observable<UserAuth>; + + constructor(private http: HttpClient, public utils: Utils) { + this.userSubject = new BehaviorSubject<UserAuth>(JSON.parse(localStorage.getItem('user'))); + this.user = this.userSubject.asObservable(); + } + + public get userValue(): UserAuth { + return this.userSubject.value; + } + + public get token(): string { + if (this.userSubject.value) { + return this.userSubject.value.accessToken; + } + return null; + } + + public logout(): void { + localStorage.removeItem('user'); + this.userSubject.next(null); + window.location.replace('/home'); + } + + public isLoggedIn(): boolean { + if (this.userValue) { + return DateTime.local().setZone('Europe/Paris') < this.getExpiration(); + } + return false; + } + + public getUserNameDisplay(): string { + return new UserNamePipe().transform(this.userValue.name); + } + + public getUserSurnameDisplay(): string { + return this.userValue.surname.toUpperCase(); + } + + public getUserFullNameDisplay(): string { + return `${this.getUserNameDisplay()} ${this.getUserSurnameDisplay()}`; + } + + public getUserEmailDisplay(): string { + return `${this.userValue.username}`; + } + + private getExpiration(): DateTime { + return DateTime.fromISO(this.userValue.expiresAt, { zone: 'Europe/Paris' }); + } + + public register(user: User): Observable<any> { + return this.http.post('api/users', user); + } + + public login(email: string, password: string): Observable<any> { + return this.http.post<UserAuth>('api/auth/login', { email: email.toLowerCase(), password }).pipe( + map((user) => { + // store user details and jwt token in local storage to keep user logged in between page refreshes + localStorage.setItem('user', JSON.stringify(user)); + this.userSubject.next(user); + return user; + }) + ); + } + + public resendEmail(email: string, password: string): Observable<User> { + return this.http.post<User>(`api/auth/resendEmail`, { email: email.toLowerCase(), password }); + } + + public verifyUser(userId: string, token: string): Observable<User> { + return this.http.post<User>(`api/users/verify/${userId}`, null, { + params: { token }, + }); + } + + public resetPassword(email: string): Observable<any> { + return this.http.post(`api/users/reset-password`, { email: email.toLowerCase() }); + } + + public resetPasswordApply(token: string, password: string): Observable<any> { + return this.http.post(`api/users/reset-password/apply`, { + token, + password, + }); + } +} diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts index 5fee112f93e4429cc546ffdbeb72c8230aea7033..b6b500bf10ed08311ed574ff672e149b31c2936c 100644 --- a/src/app/services/structure.service.ts +++ b/src/app/services/structure.service.ts @@ -77,15 +77,15 @@ export class StructureService { requestUrl += `?query=${queryString.value}`; } // Set specific PMR filter (which must be displayed in 'accessModality' category) - const filterPMR = filters.find((filter) => filter.text == 'Accessible PMR'); + const filterPMR = filters.find((filter) => filter.text === 'Accessible PMR'); if (filterPMR) filterPMR.name = 'pmrAccess'; const andFormatedFilters = this.formatFilters(filters.filter((e) => !e.orOperator)); const orFormatedFilters = this.formatFilters(filters.filter((e) => e.orOperator)); requestFilters = { filters: [andFormatedFilters, orFormatedFilters], - onlyOffersWithAppointment: onlyOffersWithAppointment, - limit: limit, + onlyOffersWithAppointment, + limit, }; } return this.http diff --git a/src/app/services/update.service.ts b/src/app/services/update.service.ts index a8c4ae77546d6cdee7646001473a3c4754e2771f..a50ada7520f71fc75ff6685a7f1b8494a91d20e0 100644 --- a/src/app/services/update.service.ts +++ b/src/app/services/update.service.ts @@ -10,7 +10,7 @@ export class UpdateService { // Ref: https://alligator.io/angular/service-worker-updates/ constructor(private swUpdate: SwUpdate, private notificationService: NotificationService) {} - subscribeUpdate() { + subscribeUpdate(): void { if (this.swUpdate.isEnabled) { this.swUpdate.available.subscribe(() => { this.showUpdateToast(); @@ -18,7 +18,7 @@ export class UpdateService { } } - private async showUpdateToast() { + private async showUpdateToast(): Promise<void> { this.notificationService.showAppNewVersion(); } } diff --git a/src/app/shared/components/accompaniment-picker/accompaniment-picker.component.ts b/src/app/shared/components/accompaniment-picker/accompaniment-picker.component.ts index 0f2e2fbac4b7fdcff60c73692ace2ebb9d6755f7..bec6152ee3a726a2eb16a977dd77cc17fceae211 100644 --- a/src/app/shared/components/accompaniment-picker/accompaniment-picker.component.ts +++ b/src/app/shared/components/accompaniment-picker/accompaniment-picker.component.ts @@ -24,7 +24,7 @@ export class AccompanimentPickerComponent implements OnInit, OnChanges { this.initSelectedModule(); } - private initSelectedModule() { + private initSelectedModule(): void { this.selectedModules = this.onlineProcedures.modules.filter((module) => this.personalOfferForm.get('categories').get('onlineProcedures').value.includes(module.id) ); diff --git a/src/app/shared/components/address-autocomplete/address-autocomplete.component.ts b/src/app/shared/components/address-autocomplete/address-autocomplete.component.ts index c2ba5fcbe769beba49a67aefe1243f510a82b381..297b14a74f3ff2ce35f57fb44ef17673017f166e 100644 --- a/src/app/shared/components/address-autocomplete/address-autocomplete.component.ts +++ b/src/app/shared/components/address-autocomplete/address-autocomplete.component.ts @@ -38,7 +38,7 @@ export class AddressAutocompleteComponent implements OnInit, OnChanges { } } - public onSearchChange(event: Event) { + public onSearchChange(event: Event): void { const searchString = (event.target as HTMLInputElement).value; if (!this.isAlreadySearching) { this.isAlreadySearching = true; @@ -48,7 +48,7 @@ export class AddressAutocompleteComponent implements OnInit, OnChanges { return el; }); // Filtering duplicate displayed string. This duplication is caused by the API used for gathering addresse info. - this.data = [...new Map(data.features.map((item) => [item['displayedName'], item])).values()]; + this.data = [...new Map(data.features.map((item) => [item.displayedName, item])).values()]; this.isAlreadySearching = false; }); } diff --git a/src/app/shared/components/data-share-consent/data-share-consent.component.ts b/src/app/shared/components/data-share-consent/data-share-consent.component.ts index 45eb8be9db1ab7a2f40e8b55e3e051db4af51aa2..80e66d683e42eeba00bec589e665d4ab2da49313 100644 --- a/src/app/shared/components/data-share-consent/data-share-consent.component.ts +++ b/src/app/shared/components/data-share-consent/data-share-consent.component.ts @@ -21,7 +21,7 @@ export class DataShareConsentComponent implements OnInit { @Input() public opened = true; @Input() public dataConsentPendingStructures: Structure[]; - ngOnInit() { + ngOnInit(): void { this.consentForm = new UntypedFormGroup({}); for (const structure of this.dataConsentPendingStructures) { this.consentForm.addControl( @@ -36,7 +36,7 @@ export class DataShareConsentComponent implements OnInit { } public getPendingStructure(id: string): Structure { - const result = this.dataConsentPendingStructures.filter((structure) => structure._id == id); + const result = this.dataConsentPendingStructures.filter((structure) => structure._id === id); return result?.[0] || null; } diff --git a/src/app/shared/components/modal-join-confirmation/modal-join-confirmation.component.ts b/src/app/shared/components/modal-join-confirmation/modal-join-confirmation.component.ts index 1bf7679fcbbbe9f0bf692f1787dc12b7c4004883..5d5d5756a5c598085be964c28f8ff2485fb1581d 100644 --- a/src/app/shared/components/modal-join-confirmation/modal-join-confirmation.component.ts +++ b/src/app/shared/components/modal-join-confirmation/modal-join-confirmation.component.ts @@ -12,7 +12,7 @@ export class ModalJoinConfirmationComponent { @Input() public primaryContent: string; @Input() public secondaryContent?: string; @Input() public customConfirmationText?: string; - @Input() public displayCancelButton?: boolean = true; + @Input() public displayCancelButton = true; @Output() closed = new EventEmitter<boolean>(); public buttonTypeEnum = ButtonType; diff --git a/src/app/shared/components/password-form/password-form.component.ts b/src/app/shared/components/password-form/password-form.component.ts index 42bfc4736824b9b4ab91781fb48e300405a0d757..d5ef82b6bbeaa22cc1d0fa562be67350b3a5fb5a 100644 --- a/src/app/shared/components/password-form/password-form.component.ts +++ b/src/app/shared/components/password-form/password-form.component.ts @@ -37,7 +37,7 @@ export class PasswordFormComponent implements OnInit { ngOnInit(): void { this.activatedRoute.queryParams.subscribe((params) => { - this.token = params['token']; + this.token = params.token; }); if (this.auth.isLoggedIn()) { this.oldPasswordNeeded = true; diff --git a/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts b/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts index 7a2551c0207d3fc3deb3e209280b0e292962baa0..91f5249bbbdf352a7ff7e195229481ad449c2341 100644 --- a/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts +++ b/src/app/shared/components/structure-type-picker/structure-type-picker.component.ts @@ -29,7 +29,7 @@ export class StructureTypePickerComponent implements OnInit { constructor(private structureTypeService: StructureTypeService) {} - ngOnInit() { + ngOnInit(): void { this.structureTypeService.getStructureTypes().subscribe((types) => { // Filter "other" structure type types = types.filter((type) => type.selectable); diff --git a/src/app/shared/components/text-input-modal/text-input-modal.component.ts b/src/app/shared/components/text-input-modal/text-input-modal.component.ts index 2fc0a3c62c9dc14b3bc9d7945ca126c5ab8a2176..9762e32b281b6072702b8ce77960a91888750c6b 100644 --- a/src/app/shared/components/text-input-modal/text-input-modal.component.ts +++ b/src/app/shared/components/text-input-modal/text-input-modal.component.ts @@ -15,7 +15,7 @@ export class TextInputModalComponent { public buttonTypeEnum = ButtonType; public myContent: string; - public closeModal(shouldSend: boolean, content: string) { + public closeModal(shouldSend: boolean, content: string): void { this.newContent.emit({ shouldSend, content }); } } diff --git a/src/app/shared/components/training-type-picker/training-type-picker.component.ts b/src/app/shared/components/training-type-picker/training-type-picker.component.ts index db834d618270eba604365177c773c200ff04f8bc..21f1580a4d86aaa53fe48549f7db74f5166f2ac8 100644 --- a/src/app/shared/components/training-type-picker/training-type-picker.component.ts +++ b/src/app/shared/components/training-type-picker/training-type-picker.component.ts @@ -38,7 +38,7 @@ export class TrainingTypePickerComponent implements OnInit, OnChanges { this.initSelectedChoice(); } - private initSelectedChoice() { + private initSelectedChoice(): void { this.selectedChoices = cloneDeep(this.categories); this.selectedChoices.forEach((category) => { let selectedModulesId: string[] = []; @@ -69,7 +69,7 @@ export class TrainingTypePickerComponent implements OnInit, OnChanges { } } - public isModulePicked(categorie: Category, module: Module) { + public isModulePicked(categorie: Category, module: Module): boolean { const index = this.selectedChoices.findIndex((_categorie) => _categorie.id === categorie.id); if (index === -1) return false; return this.selectedChoices[index].modules.findIndex((_module) => _module.id === module.id) > -1; diff --git a/src/app/shared/components/v3/button/button.component.ts b/src/app/shared/components/v3/button/button.component.ts index beaeda33f46bf36e940cfb1a3d1a4d3e35884084..a5c26cec4c3d64029f6b0e65546ca2386094b2c9 100644 --- a/src/app/shared/components/v3/button/button.component.ts +++ b/src/app/shared/components/v3/button/button.component.ts @@ -20,10 +20,10 @@ export class ButtonV3Component { @Input() size?: 'small' | 'medium' | 'large' = 'small'; /** Should the button be wide ? (250px) */ - @Input() wide?: boolean = false; + @Input() wide = false; /** Should the button be disabled ? */ - @Input() disabled?: boolean = false; + @Input() disabled = false; /** Sets the position of the icon if one provided */ @Input() iconPosition: 'left' | 'right' = 'left'; diff --git a/src/app/shared/components/v3/button/icon-button/icon-button.component.ts b/src/app/shared/components/v3/button/icon-button/icon-button.component.ts index aaca138076c2b0207ae6b941b36b278a4982e87f..e09e640fe232327559e5771cbf7720055a7864ce 100644 --- a/src/app/shared/components/v3/button/icon-button/icon-button.component.ts +++ b/src/app/shared/components/v3/button/icon-button/icon-button.component.ts @@ -14,7 +14,7 @@ export class IconButtonV3Component { @Input() variant?: ButtonTypeV3 = ButtonTypeV3.Primary; /** Should the button be disabled ? */ - @Input() disabled?: boolean = false; + @Input() disabled = false; /** Folder of the icon ex: assets/ico */ @Input() iconFolder = 'ico'; diff --git a/src/app/shared/components/v3/input/input.component.ts b/src/app/shared/components/v3/input/input.component.ts index 6db9c4cad8b71378c8babf21d6922891e9038bfa..484723782bb3da1aabc46348897e93f3819c6c32 100644 --- a/src/app/shared/components/v3/input/input.component.ts +++ b/src/app/shared/components/v3/input/input.component.ts @@ -11,7 +11,7 @@ export class InputV3Component { @Input() type: 'text' | 'password' = 'text'; - @Input() disabled?: boolean = false; + @Input() disabled = false; /** Label for the radio */ @Input() label?: string; @@ -30,7 +30,7 @@ export class InputV3Component { @Output() valueChange = new EventEmitter<Event>(); - public onValueChange(event: Event) { + public onValueChange(event: Event): void { this.valueChange.emit(event); } } diff --git a/src/app/shared/components/v3/tag/tag-item/tag-item.component.ts b/src/app/shared/components/v3/tag/tag-item/tag-item.component.ts index e9eb68e4f55f867b23557b8387b1b98b518d5e0e..0ed42fbbb70fc77eb224fc0edc1ee78862973583 100644 --- a/src/app/shared/components/v3/tag/tag-item/tag-item.component.ts +++ b/src/app/shared/components/v3/tag/tag-item/tag-item.component.ts @@ -13,19 +13,19 @@ export class TagItemV3Component { @Input() size?: 'small' | 'medium' = 'medium'; /** Is the tag selected ? */ - @Input() selected?: boolean = false; + @Input() selected = false; /** Should the button be clickable ? */ - @Input() clickable?: boolean = true; + @Input() clickable = true; /** Should the button be disabled */ - @Input() disabled?: boolean = false; + @Input() disabled = false; /** Sets the position of the icon if one provided */ @Input() iconPosition?: 'left' | 'right' = 'left'; /** Folder of the icon ex: assets/ico */ - @Input() iconFolder?: string = 'ico'; + @Input() iconFolder = 'ico'; /** Icon name */ @Input() iconName?: string; @@ -37,7 +37,7 @@ export class TagItemV3Component { return [this.size, this.selected ? 'selected' : '', this.clickable ? 'clickable' : 'unclickable']; } - public get iconSize() { + public get iconSize(): 'icon-12' | 'icon-16' { return this.size === 'small' ? 'icon-12' : 'icon-16'; } } diff --git a/src/app/shared/components/v3/textarea/textarea.component.ts b/src/app/shared/components/v3/textarea/textarea.component.ts index c717ff08c9e9f5050606a600b050c3fbde5d6168..efb0cb024962421fdc09da18e937f26da1f642f4 100644 --- a/src/app/shared/components/v3/textarea/textarea.component.ts +++ b/src/app/shared/components/v3/textarea/textarea.component.ts @@ -9,7 +9,7 @@ export class TextareaV3Component { /** HTML id associated with for */ @Input() id: string; - @Input() disabled?: boolean = false; + @Input() disabled = false; /** Label for the radio */ @Input() label?: string; @@ -18,7 +18,7 @@ export class TextareaV3Component { @Input() description?: string; /** Max length of the input */ - @Input() maxLength?: number = 500; + @Input() maxLength = 500; /** What additional data should be displayed ? */ @Input() status?: 'error' | 'success' | 'info' | 'warning'; @@ -31,7 +31,7 @@ export class TextareaV3Component { @Output() valueChange = new EventEmitter<string>(); - public onValueChange(event: Event) { + public onValueChange(event: Event): void { this.valueChange.emit((event.target as HTMLTextAreaElement).value); } } diff --git a/src/app/shared/directives/modalOutside.directive.ts b/src/app/shared/directives/modalOutside.directive.ts index 98dcf580c2a2f531fa7d5431345f7a526401ae89..418d47cd44903cb4a813798214c5ae1911366465 100644 --- a/src/app/shared/directives/modalOutside.directive.ts +++ b/src/app/shared/directives/modalOutside.directive.ts @@ -8,7 +8,7 @@ export class ModalOutsideDirective { @Output() appClickOutside = new EventEmitter<any>(); - @HostListener('document:mousedown', ['$event.target']) onMouseEnter(targetElement) { + @HostListener('document:mousedown', ['$event.target']) onMouseEnter(targetElement): void { const clickedInside = this.elementRef.nativeElement.contains(targetElement); if (!clickedInside) { this.appClickOutside.emit(null); diff --git a/src/app/shared/validator/form.ts b/src/app/shared/validator/form.ts index 9f372b438e68c0b8a51ff4e0e7145ab029f356dc..d7c4e8870b28d2570d6aef91c75c108efe060fb6 100644 --- a/src/app/shared/validator/form.ts +++ b/src/app/shared/validator/form.ts @@ -16,7 +16,7 @@ export function MustMatch(controlName: string, matchingControlName: string): any } export function CheckHours(opening: string) { - return (control: AbstractControl) => { + return (control: AbstractControl): null | { forbiddenName: { value: any } } => { const regex = new RegExp('([0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]'); if (regex.test(control.value) && new Date('1/1/1999 ' + opening) < new Date('1/1/1999 ' + control.value)) { return null; diff --git a/src/app/structure-list/components/structure-details/structure-details.component.ts b/src/app/structure-list/components/structure-details/structure-details.component.ts index 2a5cc421724fa40d8d933ffc5b7cd9685771feea..00139567402bc6dde74d22dfa222793bcc563947 100644 --- a/src/app/structure-list/components/structure-details/structure-details.component.ts +++ b/src/app/structure-list/components/structure-details/structure-details.component.ts @@ -284,7 +284,7 @@ export class StructureDetailsComponent implements OnInit { public sendErrorEmail(modalValue: { shouldSend: boolean; content: string }): void { this.displayModalError(); if (modalValue.shouldSend) { - this.structureService.sendMailOnStructureError(this.structure._id, modalValue.content).subscribe(() => {}); + this.structureService.sendMailOnStructureError(this.structure._id, modalValue.content).subscribe(() => null); } } diff --git a/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts b/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts index 6d90538940cb0c2bd28afad16dcefcc4adaff993..7f329a2ab76350c50a4400ec5568457f7146c595 100644 --- a/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts +++ b/src/app/structure-list/components/structure-list-search/structure-list-search.component.ts @@ -61,7 +61,7 @@ export class StructureListSearchComponent implements OnInit { this.searchService.getCategories().subscribe((categories: Category[]) => { // manually add PMR module for More Filters modal if (!this.prmAdded) { - const index = categories.findIndex((element) => element.id == 'accessModality'); + const index = categories.findIndex((element) => element.id === 'accessModality'); if (index > -1) { categories[index].modules.push(new Module('True', 'Accessible PMR', 'Accessible PMR')); this.prmAdded = true; @@ -84,7 +84,7 @@ export class StructureListSearchComponent implements OnInit { filters.push(new Filter('query', term)); } // Add checked box filter - modules.forEach((cm) => filters.push(new Filter(cm.name, cm.id, cm.displayText, cm.name == 'ctm'))); + modules.forEach((cm) => filters.push(new Filter(cm.name, cm.id, cm.displayText, cm.name === 'ctm'))); return filters; } @@ -111,7 +111,7 @@ export class StructureListSearchComponent implements OnInit { 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 ( - (this.activatedRoute.snapshot.queryParams['id'] && filters.length === 0) || + (this.activatedRoute.snapshot.queryParams.id && filters.length === 0) || this.router.url.startsWith('/orientation') ) { return; diff --git a/src/app/structure-list/models/module.model.ts b/src/app/structure-list/models/module.model.ts index 5ed3af44a180b864734131f636f6a1d586ddb4c8..c7ce17ccdd757443c0041250860e3465e5741c41 100644 --- a/src/app/structure-list/models/module.model.ts +++ b/src/app/structure-list/models/module.model.ts @@ -2,7 +2,7 @@ export class Module { id: string; name: string; displayText?: string; - disabled?: boolean = false; + disabled = false; constructor(id: string, name: string, displayText?: string) { this.id = id; diff --git a/src/app/structure-list/services/search.service.ts b/src/app/structure-list/services/search.service.ts index 7900067f26f25cafdfcd092e9f466d6e08e645f5..221a5c8016c69ae851f7b39ca0a752be81d27967 100644 --- a/src/app/structure-list/services/search.service.ts +++ b/src/app/structure-list/services/search.service.ts @@ -36,9 +36,9 @@ export class SearchService { ): Promise<SearchResults> { return lastValueFrom( this.http.post<SearchResults>(`/api/userRegistry/?search=${searchTerm}`, { - jobsGroup: jobsGroup, + jobsGroup, employer: employers, - page: page, + page, }) ); } diff --git a/src/app/structure-list/structure-list.component.ts b/src/app/structure-list/structure-list.component.ts index 768ba5a67dcb16e4702ec7f05c70b8f685237147..2f08ac14cbbb3010e58f6d18c166be001b6f7719 100644 --- a/src/app/structure-list/structure-list.component.ts +++ b/src/app/structure-list/structure-list.component.ts @@ -75,10 +75,10 @@ export class StructureListComponent implements OnChanges, OnInit { } public addToList(structure: Structure): void { - const index = this.selectedStructureList.findIndex((elem) => elem._id == structure._id); + const index = this.selectedStructureList.findIndex((elem) => elem._id === structure._id); if (index > -1) { this.selectedStructureList = this.selectedStructureList.filter((elem) => { - return elem._id != structure._id; + return elem._id !== structure._id; }); } else { this.selectedStructureList.push(structure); @@ -88,7 +88,7 @@ export class StructureListComponent implements OnChanges, OnInit { } public isInPrintList(id: string): boolean { - return this.selectedStructureList.findIndex((elem) => elem._id == id) > -1 ? true : false; + return this.selectedStructureList.findIndex((elem) => elem._id === id) > -1 ? true : false; } public addStructure(): void { @@ -116,7 +116,7 @@ export class StructureListComponent implements OnChanges, OnInit { this.displayMapMarkerId.emit(undefined); } - public print() { + public print(): void { this.printService.printDocuments('structures-search', this.structureList); } } diff --git a/src/app/structure/structure-join/structure-join.component.ts b/src/app/structure/structure-join/structure-join.component.ts index 02e293e896a48e3f94f371432848de263f08c430..50170699c184ac6639b51279522d6d7b20b230b6 100644 --- a/src/app/structure/structure-join/structure-join.component.ts +++ b/src/app/structure/structure-join/structure-join.component.ts @@ -13,7 +13,7 @@ import { UserService } from '../../services/user.service'; styleUrls: ['./structure-join.component.scss'], }) export class StructureJoinComponent implements OnInit { - public structureName?: string = ''; + public structureName = ''; public isClaimed: boolean = null; public structureFormStepEnum = structureFormStep; public formTypeEnum = formType; @@ -48,8 +48,8 @@ export class StructureJoinComponent implements OnInit { } public handleStructureJoin(): void { this.route.queryParams.subscribe((params) => { - this.isStructureJoinValidated = params['status']; - this.validationToken = params['token']; + this.isStructureJoinValidated = params.status; + this.validationToken = params.token; }); if (this.isStructureJoinValidated !== null && this.validationToken) { this.usersService.validateJoinStructure(this.validationToken, this.isStructureJoinValidated).subscribe({ diff --git a/src/app/utils/CustomRegExp.ts b/src/app/utils/CustomRegExp.ts index 3aec8f1cadaf692e1531977efec39cc6fcdb5f5f..9175ab8201d530faa6752e75922d399df2364ce7 100644 --- a/src/app/utils/CustomRegExp.ts +++ b/src/app/utils/CustomRegExp.ts @@ -23,7 +23,8 @@ export class CustomRegExp { * Validate a phone number (4 or 10 digits, allowing spaces, dashes and dots as spacers) */ public static readonly PHONE: RegExp = /^(?:(?:\+|00)|0)\s*[1-9](?:[\s.-]*\d{2}){4}$|^(?:[\s.-]*\d{2}){2}$/; // NOSONAR - public static readonly WEBSITE: RegExp = /^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,}|[a-zA-Z0-9]+\.[^\s]{2,})/; // NOSONAR + public static readonly WEBSITE: RegExp = + /^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,}|[a-zA-Z0-9]+\.[^\s]{2,})/; // NOSONAR public static readonly LINKEDIN: string = '(linkedin.com/.{1,})'; public static readonly FACEBOOK: string = '(facebook.com/.{1,})'; public static readonly TWITTER: string = '(twitter.com/.{1,})'; diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts index 502b65571ffadf37f5e36004e694ea7eb8b7cbf0..2192da6b9d786cf359a7c93c86dcb7357a1c6bc4 100644 --- a/src/app/utils/orientationUtils.ts +++ b/src/app/utils/orientationUtils.ts @@ -264,7 +264,11 @@ export class OrientationUtils { } } - public async rdvDisableItemsNotOffered(modules: Module[], orientationService: OrientationService, category: string) { + public async rdvDisableItemsNotOffered( + modules: Module[], + orientationService: OrientationService, + category: string + ): Promise<void> { let personalOffers: PersonalOffer[] = []; let offersEnabled: string[] = []; diff --git a/src/app/utils/utils.ts b/src/app/utils/utils.ts index d2e55b521ff87f98e993b214f4b48ec734cd89af..090f4f4a9d8cd0b1a90c201cbf6dcc4c8db22e5b 100644 --- a/src/app/utils/utils.ts +++ b/src/app/utils/utils.ts @@ -75,11 +75,11 @@ export class Utils { return structure.website !== null && structure.website !== ''; } - public getDigitalHelpLabel(digitalHelp: Demarches) { + public getDigitalHelpLabel(digitalHelp: Demarches): string { return Demarches[digitalHelp]; } - public hasWifi(selfServiceMaterial: string[]) { + public hasWifi(selfServiceMaterial: string[]): boolean { return selfServiceMaterial.includes('wifiEnAccesLibre'); } @@ -109,7 +109,7 @@ export class Utils { } } - public getOtherServicesLabel(otherService: OtherServices) { + public getOtherServicesLabel(otherService: OtherServices): string { return OtherServices[otherService]; } diff --git a/src/stories/page.component.ts b/src/stories/page.component.ts index f3ae4868549ed2b6431fc04f8570b81893579395..03a30527a3c40bf97b99eff83eb8b26cb74aa6d8 100644 --- a/src/stories/page.component.ts +++ b/src/stories/page.component.ts @@ -20,18 +20,16 @@ import type { User } from './User'; process starting with atomic components and ending with pages. </p> <p> - Render pages with mock data. This makes it easy to build and review page states without - needing to navigate to them in your app. Here are some handy patterns for managing page data - in Storybook: + Render pages with mock data. This makes it easy to build and review page states without needing to navigate to + them in your app. Here are some handy patterns for managing page data in Storybook: </p> <ul> <li> - Use a higher-level connected component. Storybook helps you compose such data from the - "args" of child component stories + Use a higher-level connected component. Storybook helps you compose such data from the "args" of child + component stories </li> <li> - Assemble data in the page component from your services. You can mock these services out - using Storybook. + Assemble data in the page component from your services. You can mock these services out using Storybook. </li> </ul> <p> @@ -63,15 +61,15 @@ import type { User } from './User'; export default class PageComponent { user: User | null = null; - doLogout() { + doLogout(): void { this.user = null; } - doLogin() { + doLogin(): void { this.user = { name: 'Jane Doe' }; } - doCreateAccount() { + doCreateAccount(): void { this.user = { name: 'Jane Doe' }; } } diff --git a/tslint.json b/tslint.json deleted file mode 100644 index b89375a854cd97610ced1f310323a3ae91e4ea0c..0000000000000000000000000000000000000000 --- a/tslint.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "extends": "tslint:recommended", - "rulesDirectory": ["codelyzer"], - "rules": { - "align": { - "options": ["parameters", "statements"] - }, - "array-type": false, - "arrow-return-shorthand": true, - "curly": [true, "ignore-same-line"], - "deprecation": { - "severity": "warning" - }, - "eofline": true, - "import-blacklist": [true, "rxjs/Rx"], - "import-spacing": true, - "indent": { - "options": ["spaces"] - }, - "max-classes-per-file": false, - "max-line-length": [true, 140], - "member-ordering": [ - true, - { - "order": ["static-field", "instance-field", "static-method", "instance-method"] - } - ], - "no-console": [true, "debug", "info", "time", "timeEnd", "trace"], - "no-empty": false, - "no-inferrable-types": [true, "ignore-params"], - "no-non-null-assertion": true, - "no-redundant-jsdoc": true, - "no-switch-case-fall-through": true, - "no-var-requires": false, - "object-literal-key-quotes": [true, "as-needed"], - "quotemark": [true, "single"], - "semicolon": { - "options": ["always"] - }, - "space-before-function-paren": { - "options": { - "anonymous": "never", - "asyncArrow": "always", - "constructor": "never", - "method": "never", - "named": "never" - } - }, - "typedef": [true, "call-signature"], - "typedef-whitespace": { - "options": [ - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "onespace", - "index-signature": "onespace", - "parameter": "onespace", - "property-declaration": "onespace", - "variable-declaration": "onespace" - } - ] - }, - "variable-name": { - "options": ["ban-keywords", "check-format", "allow-pascal-case"] - }, - "whitespace": { - "options": ["check-branch", "check-decl", "check-operator", "check-separator", "check-type", "check-typecast"] - }, - "component-class-suffix": true, - "contextual-lifecycle": true, - "directive-class-suffix": true, - "no-conflicting-lifecycle": true, - "no-host-metadata-property": true, - "no-input-rename": true, - "no-inputs-metadata-property": true, - "no-output-native": true, - "no-output-on-prefix": true, - "no-output-rename": true, - "no-outputs-metadata-property": true, - "template-banana-in-box": true, - "template-no-negated-async": true, - "use-lifecycle-interface": true, - "use-pipe-transform-interface": true, - "directive-selector": [true, "attribute", "app", "camelCase"], - "component-selector": [true, "element", "app", "kebab-case"], - "unnecessary-constructor": true - } -}