diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index f755a8759..f10e174cb 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -224,6 +224,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 { convertReactNoDangerousHtml } from "./ruleConverters/react-no-dangerous-html"; import { convertReactTsxCurlySpacing } from "./ruleConverters/react-tsx-curly-spacing"; import { convertRelativeUrlPrefix } from "./ruleConverters/codelyzer/relative-url-prefix"; import { convertRestrictPlusOperands } from "./ruleConverters/restrict-plus-operands"; @@ -481,6 +482,7 @@ export const ruleConverters = new Map([ ["quotemark", convertQuotemark], ["radix", convertRadix], ["react-a11y-anchors", convertReactA11yAnchors], + ["react-no-dangerous-html", convertReactNoDangerousHtml], ["react-tsx-curly-spacing", convertReactTsxCurlySpacing], ["relative-url-prefix", convertRelativeUrlPrefix], ["restrict-plus-operands", convertRestrictPlusOperands], diff --git a/src/converters/lintConfigs/rules/ruleConverters/react-no-dangerous-html.ts b/src/converters/lintConfigs/rules/ruleConverters/react-no-dangerous-html.ts new file mode 100644 index 000000000..e5603e996 --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/react-no-dangerous-html.ts @@ -0,0 +1,12 @@ +import { RuleConverter } from "../ruleConverter"; + +export const convertReactNoDangerousHtml: RuleConverter = () => { + return { + plugins: ['eslint-plugin-react'], + rules: [ + { + ruleName: "react/no-danger", + }, + ], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/tests/react-no-dangerous-html.test.ts b/src/converters/lintConfigs/rules/ruleConverters/tests/react-no-dangerous-html.test.ts new file mode 100644 index 000000000..d005590fa --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/tests/react-no-dangerous-html.test.ts @@ -0,0 +1,18 @@ +import { convertReactNoDangerousHtml } from "../react-no-dangerous-html"; + +describe(convertReactNoDangerousHtml, () => { + test("conversion without arguments", () => { + const result = convertReactNoDangerousHtml({ + ruleArguments: [], + }); + + expect(result).toEqual({ + plugins: ['eslint-plugin-react'], + rules: [ + { + ruleName: "react/no-danger", + }, + ], + }); + }); +});