diff --git a/README.md b/README.md index bffcccbb..4dac7539 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ This config will be interpreted in the following way: | [a11y-no-generic-link-text](docs/rules/a11y-no-generic-link-text.md) | disallow generic link text | | | ❌ | | [a11y-no-title-attribute](docs/rules/a11y-no-title-attribute.md) | Guards against developers using the title attribute | ⚛️ | | | | [a11y-no-visually-hidden-interactive-element](docs/rules/a11y-no-visually-hidden-interactive-element.md) | Ensures that interactive elements are not visually hidden | ⚛️ | | | +| [a11y-role-supports-aria-props](docs/rules/a11y-role-supports-aria-props.md) | Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`. | ⚛️ | | | | [a11y-svg-has-accessible-name](docs/rules/a11y-svg-has-accessible-name.md) | SVGs must have an accessible name | ⚛️ | | | | [array-foreach](docs/rules/array-foreach.md) | enforce `for..of` loops over `Array.forEach` | ✅ | | | | [async-currenttarget](docs/rules/async-currenttarget.md) | disallow `event.currentTarget` calls inside of async functions | 🔍 | | | @@ -105,7 +106,6 @@ This config will be interpreted in the following way: | [no-useless-passive](docs/rules/no-useless-passive.md) | disallow marking a event handler as passive when it has no effect | 🔍 | 🔧 | | | [prefer-observers](docs/rules/prefer-observers.md) | disallow poorly performing event listeners | 🔍 | | | | [require-passive-events](docs/rules/require-passive-events.md) | enforce marking high frequency event handlers as passive | 🔍 | | | -| [role-supports-aria-props](docs/rules/role-supports-aria-props.md) | Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`. | ⚛️ | | | | [unescaped-html-literal](docs/rules/unescaped-html-literal.md) | disallow unescaped HTML literals | 🔍 | | | diff --git a/docs/rules/role-supports-aria-props.md b/docs/rules/a11y-role-supports-aria-props.md similarity index 98% rename from docs/rules/role-supports-aria-props.md rename to docs/rules/a11y-role-supports-aria-props.md index 1cc8b7bc..0894e26f 100644 --- a/docs/rules/role-supports-aria-props.md +++ b/docs/rules/a11y-role-supports-aria-props.md @@ -1,4 +1,4 @@ -# Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role` (`github/role-supports-aria-props`) +# Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role` (`github/a11y-role-supports-aria-props`) 💼 This rule is enabled in the ⚛️ `react` config. diff --git a/lib/configs/react.js b/lib/configs/react.js index 98c95304..4b2645db 100644 --- a/lib/configs/react.js +++ b/lib/configs/react.js @@ -8,12 +8,12 @@ module.exports = { plugins: ['github', 'jsx-a11y'], extends: ['plugin:jsx-a11y/recommended'], rules: { - 'jsx-a11y/role-supports-aria-props': 'off', // Override with github/role-supports-aria-props until https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/910 is resolved + 'jsx-a11y/role-supports-aria-props': 'off', // Override with github/a11y-role-supports-aria-props until https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/910 is resolved 'github/a11y-aria-label-is-well-formatted': 'error', 'github/a11y-no-visually-hidden-interactive-element': 'error', 'github/a11y-no-title-attribute': 'error', 'github/a11y-svg-has-accessible-name': 'error', - 'github/role-supports-aria-props': 'error', + 'github/a11y-role-supports-aria-props': 'error', 'jsx-a11y/no-aria-hidden-on-focusable': 'error', 'jsx-a11y/no-autofocus': 'off', 'jsx-a11y/anchor-ambiguous-text': [ diff --git a/lib/index.js b/lib/index.js index 38036e0f..68dca43a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -4,6 +4,7 @@ module.exports = { 'a11y-no-generic-link-text': require('./rules/a11y-no-generic-link-text'), 'a11y-no-title-attribute': require('./rules/a11y-no-title-attribute'), 'a11y-aria-label-is-well-formatted': require('./rules/a11y-aria-label-is-well-formatted'), + 'a11y-role-supports-aria-props': require('./rules/a11y-role-supports-aria-props'), 'a11y-svg-has-accessible-name': require('./rules/a11y-svg-has-accessible-name'), 'array-foreach': require('./rules/array-foreach'), 'async-currenttarget': require('./rules/async-currenttarget'), @@ -21,7 +22,6 @@ module.exports = { 'no-then': require('./rules/no-then'), 'no-useless-passive': require('./rules/no-useless-passive'), 'prefer-observers': require('./rules/prefer-observers'), - 'role-supports-aria-props': require('./rules/role-supports-aria-props'), 'require-passive-events': require('./rules/require-passive-events'), 'unescaped-html-literal': require('./rules/unescaped-html-literal'), }, diff --git a/lib/rules/role-supports-aria-props.js b/lib/rules/a11y-role-supports-aria-props.js similarity index 100% rename from lib/rules/role-supports-aria-props.js rename to lib/rules/a11y-role-supports-aria-props.js diff --git a/tests/role-supports-aria-props.js b/tests/a11y-role-supports-aria-props.js similarity index 99% rename from tests/role-supports-aria-props.js rename to tests/a11y-role-supports-aria-props.js index 0192b96d..b1b41fe5 100644 --- a/tests/role-supports-aria-props.js +++ b/tests/a11y-role-supports-aria-props.js @@ -10,7 +10,7 @@ // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -const rule = require('../lib/rules/role-supports-aria-props') +const rule = require('../lib/rules/a11y-role-supports-aria-props') const RuleTester = require('eslint').RuleTester const ruleTester = new RuleTester({ @@ -27,7 +27,7 @@ function getErrorMessage(attribute, role) { return `The attribute ${attribute} is not supported by the role ${role}.` } -ruleTester.run('role-supports-aria-props', rule, { +ruleTester.run('a11y-role-supports-aria-props', rule, { valid: [ {code: ''}, {code: '
'},