Skip to content

Commit 36a2a3a

Browse files
uzirthapaclaude
andcommitted
fix: Address lint errors in a11y changes
- Remove empty arrow noOp function that violated @typescript-eslint/no-empty-function - Use optional chaining for undoAriaLabel call instead Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ee877bf commit 36a2a3a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/bundle/src/adaptiveCards/Attachment/AdaptiveCardHacks/useRoleModEffect.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import type { AdaptiveCard } from 'adaptivecards';
77

88
const ARIA_LABEL_MAX_LENGTH = 200;
99

10-
// eslint-disable-next-line no-empty-function -- initialized as no-op, reassigned when aria-label is set
11-
const noOp = () => {};
12-
1310
/**
1411
* Accessibility: "role" attribute must be set if "aria-label" is set.
1512
*
@@ -42,7 +39,7 @@ export default function useRoleModEffect(
4239
() => (_, cardElement: HTMLElement) => {
4340
// If the card doesn't have an aria-label (i.e. no "speak" property was set),
4441
// derive one from the card's visible text content so screen readers can announce it.
45-
let undoAriaLabel: () => void = noOp;
42+
let undoAriaLabel: (() => void) | undefined;
4643

4744
if (!cardElement.getAttribute('aria-label')) {
4845
const textContent = (cardElement.textContent || '').replace(/\s+/gu, ' ').trim();
@@ -70,7 +67,7 @@ export default function useRoleModEffect(
7067

7168
return () => {
7269
undoRole();
73-
undoAriaLabel();
70+
undoAriaLabel?.();
7471
};
7572
},
7673
[]

0 commit comments

Comments
 (0)