|
| 1 | +<p align="center"> |
| 2 | + <a href="https://travis-ci.com/github/jsx-eslint/eslint-plugin-jsx-a11y"> |
| 3 | + <img src="https://travis-ci.com/jsx-eslint/eslint-plugin-jsx-a11y.svg?branch=master" |
| 4 | + alt="build status"> |
| 5 | + </a> |
| 6 | + <a href="https://npmjs.org/package/eslint-plugin-jsx-a11y"> |
| 7 | + <img src="https://img.shields.io/npm/v/eslint-plugin-jsx-a11y.svg" |
| 8 | + alt="npm version"> |
| 9 | + </a> |
| 10 | + <a href="https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/LICENSE.md"> |
| 11 | + <img src="https://img.shields.io/npm/l/eslint-plugin-jsx-a11y.svg" |
| 12 | + alt="license"> |
| 13 | + </a> |
| 14 | + <a href='https://coveralls.io/github/evcohen/eslint-plugin-jsx-a11y?branch=master'> |
| 15 | + <img src='https://coveralls.io/repos/github/evcohen/eslint-plugin-jsx-a11y/badge.svg?branch=master' alt='Coverage Status' /> |
| 16 | + </a> |
| 17 | + <a href='https://npmjs.org/package/eslint-plugin-jsx-a11y'> |
| 18 | + <img src='https://img.shields.io/npm/dt/eslint-plugin-jsx-a11y.svg' |
| 19 | + alt='Total npm downloads' /> |
| 20 | + </a> |
| 21 | +</p> |
| 22 | + |
| 23 | +<a href='https://tidelift.com/subscription/pkg/npm-eslint-plugin-jsx-a11y?utm_source=npm-eslint-plugin-jsx-a11y&utm_medium=referral&utm_campaign=readme'>Obtenga soporte profesional para eslint-plugin-jsx-a11y en Tidelift</a> |
| 24 | + |
| 25 | +# eslint-plugin-jsx-a11y |
| 26 | + |
| 27 | +Comprobador AST estático para reglas de accesibilidad en elementos JSX. |
| 28 | + |
| 29 | +## ¿Porque? |
| 30 | + |
| 31 | +Ryan Florence desarrolló esta increíble herramienta de análisis de tiempo de ejecución llamada [react-a11y] (https://github.com/reactjs/react-a11y). Es super útil. Dado que probablemente ya esté utilizando linting en su proyecto, este plugin es gratuito y más cerca del proceso de development real. Si combina este plugin con un editor lint plugin, puede incorporar estándares de accesibilidad a su aplicación en tiempo real. |
| 32 | + |
| 33 | +**Nota**: Este proyecto no * reemplaza * react-a11y, pero puede y debe usarse junto con él. Las herramientas de análisis estático no pueden determinar los valores de los variables que se colocan en props antes del tiempo de ejecución, así que el linting no fallará si ese valor no está definido y / o no pasa la regla de lint. |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +## Instalación |
| 38 | + |
| 39 | +**Si está instalando este complemento a través de `eslint-config-airbnb`, por favor sigue [estas instrucciones](https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb#eslint-config-airbnb-1).** |
| 40 | + |
| 41 | +Primero tendrá que instalar [ESLint](http://eslint.org): |
| 42 | + |
| 43 | +```sh |
| 44 | +# npm |
| 45 | +npm install eslint --save-dev |
| 46 | + |
| 47 | +# yarn |
| 48 | +yarn add eslint --dev |
| 49 | +``` |
| 50 | + |
| 51 | +Siguiente, instale `eslint-plugin-jsx-a11y`: |
| 52 | + |
| 53 | +```sh |
| 54 | +# npm |
| 55 | +npm install eslint-plugin-jsx-a11y --save-dev |
| 56 | + |
| 57 | +# yarn |
| 58 | +yarn add eslint-plugin-jsx-a11y --dev |
| 59 | +``` |
| 60 | + |
| 61 | +**Nota:** Si instaló ESLint globalmente (usando `-g` en npm, o el prefijo `global` en yarn) tambien tendra que instalar `eslint-plugin-jsx-a11y` globalmente. |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +## Uso |
| 66 | + |
| 67 | +Añade `jsx-a11y` a la sección de "plugins" de su `.eslintrc` archivo de configuración. Puede omitir el prefijo `eslint-plugin-` : |
| 68 | + |
| 69 | +```json |
| 70 | +{ |
| 71 | + "plugins": [ |
| 72 | + "jsx-a11y" |
| 73 | + ] |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | + |
| 78 | +Luego configure las reglas que quiera usar bajo la sección "rules". |
| 79 | + |
| 80 | +```json |
| 81 | +{ |
| 82 | + "rules": { |
| 83 | + "jsx-a11y/nombre-de-regla": 2 |
| 84 | + } |
| 85 | +} |
| 86 | +``` |
| 87 | + |
| 88 | +También puede permitir todas las reglas recomendadas o estrictas de una vez. |
| 89 | +Añade `plugin:jsx-a11y/recommended` o `plugin:jsx-a11y/strict` dentro "`extends`": |
| 90 | + |
| 91 | +```json |
| 92 | +{ |
| 93 | + "extends": [ |
| 94 | + "plugin:jsx-a11y/recommended" |
| 95 | + ] |
| 96 | +} |
| 97 | +``` |
| 98 | + |
| 99 | +## Reglas Soportadas |
| 100 | + |
| 101 | +- [accessible-emoji](docs/rules/accessible-emoji.md): Enforce emojis are wrapped in `<span>` and provide screenreader access. |
| 102 | +- [alt-text](docs/rules/alt-text.md): Enforce all elements that require alternative text have meaningful information to relay back to end user. |
| 103 | +- [anchor-has-content](docs/rules/anchor-has-content.md): Enforce all anchors to contain accessible content. |
| 104 | +- [anchor-is-valid](docs/rules/anchor-is-valid.md): Enforce all anchors are valid, navigable elements. |
| 105 | +- [aria-activedescendant-has-tabindex](docs/rules/aria-activedescendant-has-tabindex.md): Enforce elements with aria-activedescendant are tabbable. |
| 106 | +- [aria-props](docs/rules/aria-props.md): Enforce all `aria-*` props are valid. |
| 107 | +- [aria-proptypes](docs/rules/aria-proptypes.md): Enforce ARIA state and property values are valid. |
| 108 | +- [aria-role](docs/rules/aria-role.md): Enforce that elements with ARIA roles must use a valid, non-abstract ARIA role. |
| 109 | +- [aria-unsupported-elements](docs/rules/aria-unsupported-elements.md): Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes. |
| 110 | +- [autocomplete-valid](docs/rules/autocomplete-valid.md): Enforce that autocomplete attributes are used correctly. |
| 111 | + |
| 112 | +### Diferencia entre modos 'recomendedo' y 'estricto' |
| 113 | + |
| 114 | +| Regla | Recomendedo | Estricto | |
| 115 | +| ------------------------------------------------------------ | ------------------- | -------- | |
| 116 | +| [accessible-emoji](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md) | error | error | |
| 117 | +| [alt-text](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md) | error | error | |
| 118 | +| [anchor-has-content](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md) | error | error | |
| 119 | +| [anchor-is-valid](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md) | error | error | |
| 120 | +| [aria-activedescendant-has-tabindex](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md) | error | error | |
| 121 | +| [aria-props](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-props.md) | error | error | |
| 122 | +| [aria-proptypes](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-proptypes.md) | error | error | |
| 123 | +| [aria-role](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-role.md) | error | error | |
| 124 | +| [aria-unsupported-elements](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md) | error | error | |
| 125 | +| [autocomplete-valid](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/autocomplete-valid.md) | error | error | |
| 126 | +| [click-events-have-key-events](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md) | error | error | |
| 127 | +| [heading-has-content](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/heading-has-content.md) | error | error | |
| 128 | +| [html-has-lang](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/html-has-lang.md) | error | error | |
| 129 | +| [iframe-has-title](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/iframe-has-title.md) | error | error | |
| 130 | +| [img-redundant-alt](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/img-redundant-alt.md) | error | error | |
| 131 | +| [interactive-supports-focus](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/interactive-supports-focus.md) | error | error | |
| 132 | +| [label-has-associated-control](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md) | error | error | |
| 133 | +| [media-has-caption](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/media-has-caption.md) | error | error | |
| 134 | +| [mouse-events-have-key-events](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md) | error | error | |
| 135 | +| [no-access-key](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-access-key.md) | error | error | |
| 136 | +| [no-autofocus](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-autofocus.md) | error | error | |
| 137 | +| [no-distracting-elements](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-distracting-elements.md) | error | error | |
| 138 | +| [no-interactive-element-to-noninteractive-role](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-interactive-element-to-noninteractive-role.md) | error, con opciones | error | |
| 139 | +| [no-noninteractive-element-interactions](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-interactions.md) | error, con opciones | error | |
| 140 | +| [no-noninteractive-element-to-interactive-role](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-element-to-interactive-role.md) | error, con opciones | error | |
| 141 | +| [no-noninteractive-tabindex](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-noninteractive-tabindex.md) | error, con opciones | error | |
| 142 | +| [no-onchange](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md) | error | error | |
| 143 | +| [no-redundant-roles](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md) | error | error | |
| 144 | +| [no-static-element-interactions](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md) | error, con opciones | error | |
| 145 | +| [role-has-required-aria-props](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-has-required-aria-props.md) | error | error | |
| 146 | +| [role-supports-aria-props](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/role-supports-aria-props.md) | error | error | |
| 147 | +| [scope](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/scope.md) | error, con opciones | error | |
| 148 | +| [tabindex-no-positive](https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md) | error | error | |
| 149 | + |
| 150 | + |
| 151 | +Las siguiente reglas tienen otras opciones disponibles cuando en modo *recomendado*: |
0 commit comments