From 3fb2a0cfd88311a1472e70885f3d08f3e0afc4d5 Mon Sep 17 00:00:00 2001 From: mkrause Date: Tue, 19 Nov 2024 23:46:22 +0100 Subject: [PATCH] Fix linter errors. --- src/components/actions/Link/Link.stories.tsx | 2 +- src/components/containers/Alert/Alert.stories.tsx | 8 ++++---- .../forms/context/SubmitButton/SubmitButton.tsx | 4 ++-- .../forms/controls/SegmentedControl/SegmentedControl.tsx | 3 ++- src/components/overlays/Modal/Modal.tsx | 1 - src/components/overlays/Toast/Toast.stories.tsx | 6 +++--- src/util/storybook/OverflowTester.tsx | 3 +++ 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/components/actions/Link/Link.stories.tsx b/src/components/actions/Link/Link.stories.tsx index cfe244f..85ce645 100644 --- a/src/components/actions/Link/Link.stories.tsx +++ b/src/components/actions/Link/Link.stories.tsx @@ -45,7 +45,7 @@ export const Descenders: Story = { export const Scroll: Story = { render: (args) => ( <> - + { evt.preventDefault(); }}>Anchor diff --git a/src/components/containers/Alert/Alert.stories.tsx b/src/components/containers/Alert/Alert.stories.tsx index 1c1c17c..01e6b41 100644 --- a/src/components/containers/Alert/Alert.stories.tsx +++ b/src/components/containers/Alert/Alert.stories.tsx @@ -31,10 +31,10 @@ export default { export const Standard: Story = {}; -export const Info: Story = { args: { kind: 'info' } }; -export const Warning: Story = { args: { kind: 'warning' } }; -export const Error: Story = { args: { kind: 'error' } }; -export const Success: Story = { args: { kind: 'success' } }; +export const InfoAlert: Story = { args: { kind: 'info' } }; +export const WarningAlert: Story = { args: { kind: 'warning' } }; +export const ErrorAlert: Story = { args: { kind: 'error' } }; +export const SuccessAlert: Story = { args: { kind: 'success' } }; /** Multiple alerts stacked. */ export const Stacked: Story = { diff --git a/src/components/forms/context/SubmitButton/SubmitButton.tsx b/src/components/forms/context/SubmitButton/SubmitButton.tsx index 35ef7d8..3f9627f 100644 --- a/src/components/forms/context/SubmitButton/SubmitButton.tsx +++ b/src/components/forms/context/SubmitButton/SubmitButton.tsx @@ -45,13 +45,13 @@ export const SubmitButton = (props: SubmitButtonProps) => { const isDisabled = !isInteractive; const isNonactive = propsButton.nonactive || isPending; - const handlePress = () => { + const handlePress = React.useCallback(() => { if (typeof onPress !== 'function') { return; } startPressTransition(async () => { await Promise.race([onPress(), timeout(asyncTimeout)]); }); - }; + }, [onPress, asyncTimeout]); const handleClick = React.useCallback(async (event: React.MouseEvent) => { // `onClick` should not be used in most cases, only if the consumer needs low level control over click events. diff --git a/src/components/forms/controls/SegmentedControl/SegmentedControl.tsx b/src/components/forms/controls/SegmentedControl/SegmentedControl.tsx index 898f5bb..fbb961b 100644 --- a/src/components/forms/controls/SegmentedControl/SegmentedControl.tsx +++ b/src/components/forms/controls/SegmentedControl/SegmentedControl.tsx @@ -83,7 +83,8 @@ export const SegmentedControl = (props: SegmentedControlProps) => { [cl['bk-segmented-control--disabled']]: disabled, }, propsRest.className)} > - {formattedOptions.map((option, index) => + {formattedOptions.map((option, index) => + // biome-ignore lint/suspicious/noArrayIndexKey: no other unique identifier available