ACS-11155: update conditional checks to use optional chaining (#11658)

- Modified several components to use optional chaining for safer property access, enhancing code robustness.
- Updated ESLint configuration to enforce stricter rules on the use of optional chaining.
- Adjusted tests to reflect changes in property access patterns.
This commit is contained in:
Denys Vuika
2026-02-17 09:13:57 +00:00
committed by GitHub
parent 7004f54821
commit 84affe9f37
10 changed files with 22 additions and 22 deletions
@@ -1905,7 +1905,7 @@ describe('retrieve metadata on submit', () => {
});
it('should handle outcomeId correctly when completing form with confirmation dialog', () => {
let matDialog = TestBed.inject(MatDialog);
const matDialog = TestBed.inject(MatDialog);
spyOn(matDialog, 'open').and.returnValue({ afterClosed: () => of(true) } as any);
spyOn(formComponent['formCloudService'], 'completeTaskForm').and.returnValue(of({} as any));
@@ -29,7 +29,7 @@ export interface OutputData {
export class RichTextParserService {
private static readonly CUSTOM_PARSER = {
header: (block: any): string => {
if (!block.data || !block.data.text || !block.data.level) {
if (!block.data?.text || !block.data.level) {
return '';
}
const paragraphAlign = block.data.alignment || block.data.align || block.tunes?.anyTuneName?.alignment;
@@ -40,7 +40,7 @@ export class RichTextParserService {
}
},
paragraph: (block: any): string => {
if (!block.data || !block.data.text) {
if (!block.data?.text) {
return '';
}
const paragraphAlign = block.data.alignment || block.data.align || block.tunes?.anyTuneName?.alignment;