From 1d3bc9326e634c08296d116ce898811da889c1c8 Mon Sep 17 00:00:00 2001 From: "REDMOND\\shwetasri" Date: Fri, 20 Sep 2024 12:41:35 +0530 Subject: [PATCH] Removed v9 --- ...=> visual-label-better-than-aria-suggestion.md} | 14 ++++---------- lib/index.ts | 4 ++-- ...=> visual-label-better-than-aria-suggestion.js} | 0 ...=> visual-label-better-than-aria-suggestion.js} | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-) rename docs/rules/{visual-label-better-than-aria-suggestion-v9.md => visual-label-better-than-aria-suggestion.md} (81%) rename lib/rules/{visual-label-better-than-aria-suggestion-v9.js => visual-label-better-than-aria-suggestion.js} (100%) rename tests/lib/rules/{visual-label-better-than-aria-suggestion-v9.js => visual-label-better-than-aria-suggestion.js} (95%) diff --git a/docs/rules/visual-label-better-than-aria-suggestion-v9.md b/docs/rules/visual-label-better-than-aria-suggestion.md similarity index 81% rename from docs/rules/visual-label-better-than-aria-suggestion-v9.md rename to docs/rules/visual-label-better-than-aria-suggestion.md index dd3e166..50e8214 100644 --- a/docs/rules/visual-label-better-than-aria-suggestion-v9.md +++ b/docs/rules/visual-label-better-than-aria-suggestion.md @@ -1,29 +1,23 @@ -# Accessibility: Visual labels should be preferred over aria-label (`@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion-v9`) +# Accessibility: Visual labels should be preferred over aria-label (`@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion`) 💼 This rule is enabled in the ✅ `recommended` config. -# This rule suggests that visual label is better than aria-label (`visual-label-better-than-aria-suggestion-v9`) - For component like Dropdown, SpinButton, it's good to have a aria-label for screen reader users but visual labels are considered better because they're also useful for sighted user and comes in screen announcement as well. ## Rule Details -This rule aims to... +This rule aims to encourage the usage of visual labels in place of aria-label Examples of **incorrect** code for this rule: -```js - +```jsx - ``` Examples of **correct** code for this rule: -```js - +```jsx <> - ``` diff --git a/lib/index.ts b/lib/index.ts index b985e6b..f1ab32f 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -41,7 +41,7 @@ module.exports = { "spinner-needs-labelling": require("./rules/spinner-needs-labelling"), "badge-needs-accessible-name": require("./rules/badge-needs-accessible-name"), "progressbar-needs-labelling": require("./rules/progressbar-needs-labelling"), - "visual-label-better-than-aria-suggestion-v9": require("./rules/visual-label-better-than-aria-suggestion-v9") + "visual-label-better-than-aria-suggestion": require("./rules/visual-label-better-than-aria-suggestion") }, configs: { recommended: { @@ -72,7 +72,7 @@ module.exports = { "@microsoft/fluentui-jsx-a11y/dialogsurface-needs-aria": "error", "@microsoft/fluentui-jsx-a11y/spinner-needs-labelling": "error", "@microsoft/fluentui-jsx-a11y/progressbar-needs-labelling": "error", - "@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion-v9": "warn" + "@microsoft/fluentui-jsx-a11y/visual-label-better-than-aria-suggestion": "warn" } } } diff --git a/lib/rules/visual-label-better-than-aria-suggestion-v9.js b/lib/rules/visual-label-better-than-aria-suggestion.js similarity index 100% rename from lib/rules/visual-label-better-than-aria-suggestion-v9.js rename to lib/rules/visual-label-better-than-aria-suggestion.js diff --git a/tests/lib/rules/visual-label-better-than-aria-suggestion-v9.js b/tests/lib/rules/visual-label-better-than-aria-suggestion.js similarity index 95% rename from tests/lib/rules/visual-label-better-than-aria-suggestion-v9.js rename to tests/lib/rules/visual-label-better-than-aria-suggestion.js index 96bca89..8262ffc 100644 --- a/tests/lib/rules/visual-label-better-than-aria-suggestion-v9.js +++ b/tests/lib/rules/visual-label-better-than-aria-suggestion.js @@ -11,7 +11,7 @@ const { applicableComponents } = require("../../../lib/applicableComponents/butt const RuleTester = require("eslint").RuleTester; -const rule = require("../../../lib/rules/visual-label-better-than-aria-suggestion-v9"); +const rule = require("../../../lib/rules/visual-label-better-than-aria-suggestion"); RuleTester.setDefaultConfig({ parserOptions: { @@ -50,7 +50,7 @@ const allTestCases = applicableComponents.flatMap(component => generateTestCases //------------------------------------------------------------------------------ const ruleTester = new RuleTester(); -ruleTester.run("visual-label-better-than-aria-suggestion-v9", rule, { +ruleTester.run("visual-label-better-than-aria-suggestion", rule, { valid: allTestCases.flatMap(test => test.valid), invalid: allTestCases.flatMap(test => test.invalid) });