From 1f1810270e119cbb5fd8394dae72c8f9be7b4d57 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 3 Jul 2021 14:36:52 -0400 Subject: [PATCH] Added converter for react-a11y-role-has-required-aria-props --- .../lintConfigs/rules/ruleConverters.ts | 2 ++ .../react-a11y-role-has-required-aria-props.ts | 12 ++++++++++++ ...t-a11y-role-has-required-aria-props.test.ts | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/converters/lintConfigs/rules/ruleConverters/react-a11y-role-has-required-aria-props.ts create mode 100644 src/converters/lintConfigs/rules/ruleConverters/tests/react-a11y-role-has-required-aria-props.test.ts diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index d91f13f94..ea79e30ac 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -253,6 +253,7 @@ import { convertQuotemark } from "./ruleConverters/quotemark"; import { convertRadix } from "./ruleConverters/radix"; import { convertReactA11yAccessibleHeadings } from "./ruleConverters/react-a11y-accessible-headings"; import { convertReactA11yAnchors } from "./ruleConverters/react-a11y-anchors"; +import { convertReactA11yRoleHasRequiredAriaProps } from "./ruleConverters/react-a11y-role-has-required-aria-props"; import { convertReactNoDangerousHtml } from "./ruleConverters/react-no-dangerous-html"; import { convertReactTsxCurlySpacing } from "./ruleConverters/react-tsx-curly-spacing"; import { convertRestrictPlusOperands } from "./ruleConverters/restrict-plus-operands"; @@ -488,6 +489,7 @@ export const ruleConverters = new Map([ ["quotemark", convertQuotemark], ["radix", convertRadix], ["react-a11y-anchors", convertReactA11yAnchors], + ["react-a11y-role-has-required-aria-props", convertReactA11yRoleHasRequiredAriaProps], ["react-no-dangerous-html", convertReactNoDangerousHtml], ["react-tsx-curly-spacing", convertReactTsxCurlySpacing], ["relative-url-prefix", convertRelativeUrlPrefix], diff --git a/src/converters/lintConfigs/rules/ruleConverters/react-a11y-role-has-required-aria-props.ts b/src/converters/lintConfigs/rules/ruleConverters/react-a11y-role-has-required-aria-props.ts new file mode 100644 index 000000000..e5951b83b --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/react-a11y-role-has-required-aria-props.ts @@ -0,0 +1,12 @@ +import { RuleConverter } from "../ruleConverter"; + +export const convertReactA11yRoleHasRequiredAriaProps: RuleConverter = () => { + return { + plugins: ["jsx-a11y"], + rules: [ + { + ruleName: "jsx-a11y/role-has-required-aria-props", + }, + ], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/react-a11y-role-has-required-aria-props.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/react-a11y-role-has-required-aria-props.test.ts new file mode 100644 index 000000000..8af470226 --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/react-a11y-role-has-required-aria-props.test.ts @@ -0,0 +1,18 @@ +import { convertReactA11yRoleHasRequiredAriaProps } from "../react-a11y-role-has-required-aria-props"; + +describe(convertReactA11yRoleHasRequiredAriaProps, () => { + test("conversion without arguments", () => { + const result = convertReactA11yRoleHasRequiredAriaProps({ + ruleArguments: [], + }); + + expect(result).toEqual({ + plugins: ["jsx-a11y"], + rules: [ + { + ruleName: "jsx-a11y/role-has-required-aria-props", + }, + ], + }); + }); +});