diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 4baf906e4..ee2779794 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -181,6 +181,7 @@ import { convertJsxCurlySpacing } from "./ruleConverters/eslint-plugin-react/jsx import { convertJsxEqualsSpacing } from "./ruleConverters/eslint-plugin-react/jsx-equals-spacing"; import { convertJsxKey } from "./ruleConverters/eslint-plugin-react/jsx-key"; import { convertJsxNoBind } from "./ruleConverters/eslint-plugin-react/jsx-no-bind"; +import { convertJsxSelfClose } from "./ruleConverters/eslint-plugin-react/jsx-self-close"; import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/jsx-wrap-multiline"; // eslint-plugin-rxjs converters @@ -242,6 +243,7 @@ export const ruleConverters = new Map([ ["jsx-equals-spacing", convertJsxEqualsSpacing], ["jsx-key", convertJsxKey], ["jsx-no-bind", convertJsxNoBind], + ["jsx-self-close", convertJsxSelfClose], ["jsx-wrap-multiline", convertJsxWrapMultiline], ["label-position", convertLabelPosition], ["linebreak-style", convertLinebreakStyle], diff --git a/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/jsx-self-close.ts b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/jsx-self-close.ts new file mode 100644 index 000000000..03ab28aff --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/jsx-self-close.ts @@ -0,0 +1,12 @@ +import { RuleConverter } from "../../ruleConverter"; + +export const convertJsxSelfClose: RuleConverter = () => { + return { + rules: [ + { + ruleName: "react/self-closing-comp", + }, + ], + plugins: ["eslint-plugin-react"], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/tests/jsx-self-close.test.ts b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/tests/jsx-self-close.test.ts new file mode 100644 index 000000000..511ca2cde --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/tests/jsx-self-close.test.ts @@ -0,0 +1,18 @@ +import { convertJsxSelfClose } from "../jsx-self-close"; + +describe(convertJsxSelfClose, () => { + test("conversion without arguments", () => { + const result = convertJsxSelfClose({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleName: "react/self-closing-comp", + }, + ], + plugins: ["eslint-plugin-react"], + }); + }); +});