Skip to content

Commit 90a0396

Browse files
authored
Follow no-unsafe-function-type lint rule (#14696)
This rule comes from `typescript-eslint`: https://typescript-eslint.io/rules/no-unsafe-function-type/ We don't have it enabled yet, but in v8 it's part of the "recommended" preset: https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#updated-configuration-rules In order to keep the upgrade to that version as small as possible, this change pre-emptively fixes code considered incorrect by that rule. The only instance occurs in `EpicButton`, and would previously have been caught by the `ban-types` rule, if that were not disabled for this line. `ban-types` has been removed and replaced by `no-unsafe-function-type` for this particular issue, hence why the error has reappeared: https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/#replacement-of-ban-types We could update the `eslint-disable-next-line` comment, but there is a more specific type that can be used in this case, as mentioned in the documentation for the rule: ```ts () => void; ```
1 parent 282cbf4 commit 90a0396

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

dotcom-rendering/src/components/marketing/epics/ctas/EpicButton.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ type Props = {
4343
// A function will render a <Button>
4444
// A string will render a <LinkButton>
4545
// Both using the same interface
46-
// eslint-disable-next-line @typescript-eslint/ban-types
47-
onClickAction: Function | Url;
46+
onClickAction: (() => void) | Url;
4847
submitComponentEvent?: (event: ComponentEvent) => void;
4948
children: React.ReactElement | string;
5049
priority?: 'primary' | 'secondary';

0 commit comments

Comments
 (0)