Skip to content

Commit bd5e814

Browse files
author
Josh Goldberg
authored
Added converter for react-no-dangerous-html (#1073)
1 parent 7bac366 commit bd5e814

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
@@ -253,6 +253,7 @@ import { convertQuotemark } from "./ruleConverters/quotemark";
253253
import { convertRadix } from "./ruleConverters/radix";
254254
import { convertReactA11yAccessibleHeadings } from "./ruleConverters/react-a11y-accessible-headings";
255255
import { convertReactA11yAnchors } from "./ruleConverters/react-a11y-anchors";
256+
import { convertReactNoDangerousHtml } from "./ruleConverters/react-no-dangerous-html";
256257
import { convertReactTsxCurlySpacing } from "./ruleConverters/react-tsx-curly-spacing";
257258
import { convertRestrictPlusOperands } from "./ruleConverters/restrict-plus-operands";
258259
import { convertSemicolon } from "./ruleConverters/semicolon";
@@ -487,6 +488,7 @@ export const ruleConverters = new Map([
487488
["quotemark", convertQuotemark],
488489
["radix", convertRadix],
489490
["react-a11y-anchors", convertReactA11yAnchors],
491+
["react-no-dangerous-html", convertReactNoDangerousHtml],
490492
["react-tsx-curly-spacing", convertReactTsxCurlySpacing],
491493
["relative-url-prefix", convertRelativeUrlPrefix],
492494
["restrict-plus-operands", convertRestrictPlusOperands],
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 convertReactNoDangerousHtml: RuleConverter = () => {
4+
return {
5+
plugins: ['eslint-plugin-react'],
6+
rules: [
7+
{
8+
ruleName: "react/no-danger",
9+
},
10+
],
11+
};
12+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { convertReactNoDangerousHtml } from "../react-no-dangerous-html";
2+
3+
describe(convertReactNoDangerousHtml, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertReactNoDangerousHtml({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
plugins: ['eslint-plugin-react'],
11+
rules: [
12+
{
13+
ruleName: "react/no-danger",
14+
},
15+
],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)