Add new ESLint rule requiring explicit button types (#36738)
This commit is contained in:
37 files changed
+101
-26
No files matched your search
@@ -25,7 +25,12 @@ export const ActionsModal: React.FC<{
|
||||
|
||||
if (isActionItem(option)) {
|
||||
element = (
|
||||
<button onClick={onClick} data-index={i} disabled={disabled}>
|
||||
<button
|
||||
onClick={onClick}
|
||||
data-index={i}
|
||||
disabled={disabled}
|
||||
type='button'
|
||||
>
|
||||
<DropdownMenuItemContent item={option} />
|
||||
</button>
|
||||
);
|
||||
|
||||
@@ -113,7 +113,7 @@ export const BoostModal: React.FC<{
|
||||
|
||||
<div className='spacer' />
|
||||
|
||||
<button onClick={handleCancel} className='link-button'>
|
||||
<button onClick={handleCancel} className='link-button' type='button'>
|
||||
<FormattedMessage
|
||||
id='confirmation_modal.cancel'
|
||||
defaultMessage='Cancel'
|
||||
|
||||
+6
-2
@@ -58,7 +58,7 @@ export const ConfirmationModal: React.FC<
|
||||
|
||||
<div className='safety-action-modal__bottom'>
|
||||
<div className='safety-action-modal__actions'>
|
||||
<button onClick={onClose} className='link-button'>
|
||||
<button onClick={onClose} className='link-button' type='button'>
|
||||
{cancel ?? (
|
||||
<FormattedMessage
|
||||
id='confirmation_modal.cancel'
|
||||
@@ -70,7 +70,11 @@ export const ConfirmationModal: React.FC<
|
||||
{secondary && (
|
||||
<>
|
||||
<div className='spacer' />
|
||||
<button onClick={handleSecondary} className='link-button'>
|
||||
<button
|
||||
onClick={handleSecondary}
|
||||
className='link-button'
|
||||
type='button'
|
||||
>
|
||||
{secondary}
|
||||
</button>
|
||||
</>
|
||||
|
||||
@@ -196,7 +196,7 @@ export const DomainBlockModal: React.FC<{
|
||||
|
||||
<div className='spacer' />
|
||||
|
||||
<button onClick={handleCancel} className='link-button'>
|
||||
<button onClick={handleCancel} className='link-button' type='button'>
|
||||
<FormattedMessage
|
||||
id='confirmation_modal.cancel'
|
||||
defaultMessage='Cancel'
|
||||
|
||||
@@ -247,6 +247,7 @@ export const MediaModal: FC<MediaModalProps> = forwardRef<
|
||||
className='media-modal__nav media-modal__nav--prev'
|
||||
onClick={handlePrevClick}
|
||||
aria-label={intl.formatMessage(messages.previous)}
|
||||
type='button'
|
||||
>
|
||||
<Icon id='chevron-left' icon={ChevronLeftIcon} />
|
||||
</button>
|
||||
@@ -257,6 +258,7 @@ export const MediaModal: FC<MediaModalProps> = forwardRef<
|
||||
className='media-modal__nav media-modal__nav--next'
|
||||
onClick={handleNextClick}
|
||||
aria-label={intl.formatMessage(messages.next)}
|
||||
type='button'
|
||||
>
|
||||
<Icon id='chevron-right' icon={ChevronRightIcon} />
|
||||
</button>
|
||||
@@ -354,6 +356,7 @@ const MediaPagination: FC<MediaPaginationProps> = ({
|
||||
active: i === index,
|
||||
})}
|
||||
onClick={handleChangeIndex(i)}
|
||||
type='button'
|
||||
>
|
||||
{i + 1}
|
||||
</button>
|
||||
|
||||
@@ -127,7 +127,11 @@ const LoginOrSignUp: React.FC = () => {
|
||||
);
|
||||
} else {
|
||||
signupButton = (
|
||||
<button className='button' onClick={openClosedRegistrationsModal}>
|
||||
<button
|
||||
className='button'
|
||||
onClick={openClosedRegistrationsModal}
|
||||
type='button'
|
||||
>
|
||||
<FormattedMessage
|
||||
id='sign_in_banner.create_account'
|
||||
defaultMessage='Create account'
|
||||
@@ -195,6 +199,7 @@ export const NavigationBar: React.FC = () => {
|
||||
className={classNames('ui__navigation-bar__item', { active: open })}
|
||||
onClick={handleClick}
|
||||
aria-label={intl.formatMessage(messages.menu)}
|
||||
type='button'
|
||||
>
|
||||
<Icon id='' icon={MenuIcon} />
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user