Skip to content

Commit

Permalink
fix: enable a11y eslint rules (#968)
Browse files Browse the repository at this point in the history
* fix: enable a11y eslint rules

* fix: comments fixies
  • Loading branch information
NikitaCG authored Aug 9, 2024
1 parent 7b6b268 commit 3bb75d9
Show file tree
Hide file tree
Showing 15 changed files with 1,183 additions and 687 deletions.
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
"extends": [
"@gravity-ui/eslint-config",
"@gravity-ui/eslint-config/prettier",
"@gravity-ui/eslint-config/a11y"
],
"root": true,
"env": {
"node": true,
Expand Down
1,820 changes: 1,137 additions & 683 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@diplodoc/transform": "^4.10.8",
"@gravity-ui/eslint-config": "^2.0.0",
"@gravity-ui/eslint-config": "^2.2.0",
"@gravity-ui/icons": "^2.8.1",
"@gravity-ui/prettier-config": "^1.0.1",
"@gravity-ui/stylelint-config": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/Questions/QuestionBlockItem/QuestionBlockItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const QuestionBlockItem = ({
className={b('title')}
onClick={onClick}
aria-expanded={isOpened}
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/966
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
role={'button'}
tabIndex={0}
onKeyDown={onKeyDown}
Expand Down
2 changes: 2 additions & 0 deletions src/components/DefaultVideo/DefaultVideo.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable jsx-a11y/media-has-caption */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/967
import React, {Fragment, useCallback, useImperativeHandle, useRef, useState} from 'react';

import {CustomControlsType, MediaVideoControlsType, MediaVideoProps} from '../../models';
Expand Down
1 change: 1 addition & 0 deletions src/components/ImageBase/ImageBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ImageBaseProps extends Partial<ImageObjectProps> {
export const ImageBase = (props: ImageBaseProps) => {
const {Image} = React.useContext(ImageContext);

// eslint-disable-next-line jsx-a11y/alt-text
return Image ? <Image {...props} /> : <img {...props} />;
};

Expand Down
7 changes: 6 additions & 1 deletion src/components/Map/__stories__/ApiKeyInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ interface ApiKeyInputProps {
id: string;
}

const inputID = 'apikey-input';

export const ApiKeyInput = (props: ApiKeyInputProps) => {
const {id} = props;
const [apiKey, setApiKey] = useState<string>(localStorage?.getItem(id) || '');
Expand All @@ -31,9 +33,12 @@ export const ApiKeyInput = (props: ApiKeyInputProps) => {

return (
<div>
<label style={{display: 'block'}}>Api key for google maps</label>
<label style={{display: 'block'}} htmlFor={inputID}>
Api key for google maps
</label>
<div style={{display: 'flex'}}>
<TextInput
id={inputID}
type="text"
className="apikey-input"
value={apiKey}
Expand Down
4 changes: 4 additions & 0 deletions src/components/OutsideClick/OutsideClick.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/965

//TODO move into cloud components?
import React, {PropsWithChildren, createRef} from 'react';

Expand Down
4 changes: 4 additions & 0 deletions src/components/ReactPlayer/ReactPlayer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/965

import React, {
Fragment,
useCallback,
Expand Down
4 changes: 4 additions & 0 deletions src/components/Title/TitleItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/965

import React, {Fragment, ReactNode, useContext} from 'react';

import {HTML, ToggleArrow} from '../';
Expand Down
4 changes: 4 additions & 0 deletions src/components/VideoBlock/VideoBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/965

import React, {useCallback, useEffect, useRef, useState} from 'react';

import {PlayFill} from '@gravity-ui/icons';
Expand Down
4 changes: 4 additions & 0 deletions src/editor/components/AddBlock/AddBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/965

import React, {PropsWithChildren, useMemo, useRef, useState} from 'react';

import {Plus} from '@gravity-ui/icons';
Expand Down
4 changes: 4 additions & 0 deletions src/editor/components/EditBlock/EditBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/965

import React, {useEffect, useRef} from 'react';

import {ChevronDown, ChevronUp, Copy as CopyIcon, TrashBin} from '@gravity-ui/icons';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
// TODO fix in https://github.com/gravity-ui/page-constructor/issues/965

import React from 'react';

import {cn} from '../../../utils';
Expand Down
2 changes: 1 addition & 1 deletion src/sub-blocks/PriceDetailed/PriceDetails/Details/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const List = (props: ListProps) => {
<Fragment>
{items.map((item, id) => (
<div key={id} className={b('list-item')}>
<img className={b('img')} />
<img className={b('img')} alt="" />
<div className={b('text', {size: titleSize})}>
<YFMWrapper content={item.text} modifiers={{constructor: true}} />
</div>
Expand Down

0 comments on commit 3bb75d9

Please sign in to comment.