Skip to content

Commit

Permalink
Explicitly include jsxA11yRecommended rules + fix errors.
Browse files Browse the repository at this point in the history
The plugin was added in the eslint.config.js but the ruleset wasn't added, which in this new eslint setup needs to be done explicitly.
  • Loading branch information
Adamik10 committed Jan 7, 2025
1 parent f34ca84 commit 84d8083
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const typescriptRecommended = {
"@typescript-eslint/explicit-module-boundary-types": "off"
}
};
const jsxA11yRecommended = require("eslint-plugin-jsx-a11y").configs
.recommended;

// ESLint configuration using flat config
module.exports = [
Expand Down Expand Up @@ -59,6 +61,7 @@ module.exports = [
...prettierRecommended.rules,
...cypress.rules,
...typescriptRecommended.rules,
...jsxA11yRecommended.rules,
// Custom rules
"@typescript-eslint/consistent-type-imports": "off",
"prefer-arrow-callback": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const MaterialInfo: FC<MaterialInfoProps> = ({
}}
type="button"
// This is to handle focus when more items are loaded via pagination

// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={focused}
lang={lang || ""}
className="list-reservation__header color-secondary-gray"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const CardListItem: React.FC<CardListItemProps> = ({
// You cannot have nested links so onClick handlers and stopping event propagation
// is necessary.
//

// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
<article
ref={itemRef}
data-cy={dataCy}
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const CheckBox: FC<CheckBoxProps> = ({
<div className={`checkbox ${className || ""}`}>
<input
// This is to handle focus when more items are loaded via pagination

// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus={focused}
id={id}
className="checkbox__input"
Expand Down
1 change: 1 addition & 0 deletions src/components/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const Dialog = forwardRef<HTMLDialogElement, DialogType>(
({ children, closeDialog, isSidebar }, ref) => {
useEscapeKey({ closeDialog });
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
<dialog
className={clsx("dialog", { "dialog--sidebar": isSidebar })}
ref={ref}
Expand Down
1 change: 1 addition & 0 deletions src/core/utils/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function Modal({
<div>
{/* The backdrop doesn't have a role or keyboard listener because it barely duplicates
the close button's functionality which possesses both. */}
{/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
<div
className="modal-backdrop"
style={{
Expand Down

0 comments on commit 84d8083

Please sign in to comment.