Skip to content

Commit 00c0413

Browse files
author
Josh Goldberg
authored
Added converter for react-a11y-role (#1136)
* Added converter for react-a11y-role * Fix import order
1 parent 2b9b59c commit 00c0413

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/converters/lintConfigs/rules/ruleConverters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ import { convertReactA11yImageButtonHasAlt } from "./ruleConverters/react-a11y-i
260260
import { convertReactA11yImgHasAlt } from "./ruleConverters/react-a11y-img-has-alt";
261261
import { convertReactA11yLang } from "./ruleConverters/react-a11y-lang";
262262
import { convertReactA11yProps } from "./ruleConverters/react-a11y-props";
263+
import { convertReactA11yRole } from "./ruleConverters/react-a11y-role";
263264
import { convertReactA11yRoleHasRequiredAriaProps } from "./ruleConverters/react-a11y-role-has-required-aria-props";
264265
import { convertReactA11yTabIndexNoPositive } from "./ruleConverters/react-a11y-tabindex-no-positive";
265266
import { convertReactNoDangerousHtml } from "./ruleConverters/react-no-dangerous-html";
@@ -505,6 +506,7 @@ export const ruleConverters = new Map([
505506
["react-a11y-lang", convertReactA11yLang],
506507
["react-a11y-props", convertReactA11yProps],
507508
["react-a11y-role-has-required-aria-props", convertReactA11yRoleHasRequiredAriaProps],
509+
["react-a11y-role", convertReactA11yRole],
508510
["react-a11y-tabindex-no-positive", convertReactA11yTabIndexNoPositive],
509511
["react-no-dangerous-html", convertReactNoDangerousHtml],
510512
["react-tsx-curly-spacing", convertReactTsxCurlySpacing],
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RuleConverter } from "../ruleConverter";
2+
3+
export const convertReactA11yRole: RuleConverter = () => {
4+
return {
5+
plugins: ["jsx-a11y"],
6+
rules: [
7+
{
8+
ruleName: "jsx-a11y/aria-role",
9+
},
10+
],
11+
};
12+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { convertReactA11yRole } from "../react-a11y-role";
2+
3+
describe(convertReactA11yRole, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertReactA11yRole({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
plugins: ["jsx-a11y"],
11+
rules: [
12+
{
13+
ruleName: "jsx-a11y/aria-role",
14+
},
15+
],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)