Skip to content

Commit

Permalink
Merge pull request #33 from fortanix/mkrause/241119-linter-fixes
Browse files Browse the repository at this point in the history
[WIP] Fix biome linter errors
  • Loading branch information
nighto authored Nov 20, 2024
2 parents 3301760 + 3fb2a0c commit bb25bf3
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/actions/Link/Link.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const Descenders: Story = {
export const Scroll: Story = {
render: (args) => (
<>
<a id="anchor"></a>
<a id="anchor" href="/" onClick={evt => { evt.preventDefault(); }}>Anchor</a>
<OverflowTester openDefault/>
<Link {...args} href="#anchor"/>
<OverflowTester openDefault/>
Expand Down
8 changes: 4 additions & 4 deletions src/components/containers/Alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/forms/context/SubmitButton/SubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLButtonElement, MouseEvent>) => {
// `onClick` should not be used in most cases, only if the consumer needs low level control over click events.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
<li key={index} className={cl['bk-segmented-control__item']}>
<Button
role="tab"
Expand Down
1 change: 0 additions & 1 deletion src/components/overlays/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ const Modal = ({
};

return (
// biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
<dialog
ref={dialogRef}
className={cx(
Expand Down
6 changes: 3 additions & 3 deletions src/components/overlays/Toast/Toast.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Actions = () => {
);
};

export const Success: Story = {
export const SuccessToast: Story = {
args: {
options: {},
},
Expand All @@ -60,7 +60,7 @@ export const Success: Story = {
),
};

export const Info: Story = {
export const InfoToast: Story = {
args: {
options: {},
},
Expand All @@ -71,7 +71,7 @@ export const Info: Story = {
),
};

export const Error: Story = {
export const ErrorToast: Story = {
args: {
options: {},
},
Expand Down
3 changes: 3 additions & 0 deletions src/util/storybook/OverflowTester.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type OverflowTesterProps = {
};
export const OverflowTester = ({ lines = 50, openDefault = false }: OverflowTesterProps) => {
const ref = React.useRef<HTMLDetailsElement>(null);

// biome-ignore lint/correctness/useExhaustiveDependencies: `openDefault` only applies on mount
React.useEffect(() => {
if (openDefault && ref.current) {
ref.current.open = true;
Expand All @@ -23,6 +25,7 @@ export const OverflowTester = ({ lines = 50, openDefault = false }: OverflowTest
<details ref={ref} className="util-overflow-tester">
<summary>Test overflow</summary>
{Array.from({ length: lines }).map((_, index) =>
// biome-ignore lint/suspicious/noArrayIndexKey: no other unique identifier available
<p key={index}>...</p>
)}
</details>
Expand Down

0 comments on commit bb25bf3

Please sign in to comment.