diff --git a/src/converters/lintConfigs/rules/ruleConverters.ts b/src/converters/lintConfigs/rules/ruleConverters.ts index 5f72f64bd..469431e32 100644 --- a/src/converters/lintConfigs/rules/ruleConverters.ts +++ b/src/converters/lintConfigs/rules/ruleConverters.ts @@ -180,6 +180,7 @@ import { convertJsxBooleanValue } from "./ruleConverters/eslint-plugin-react/jsx import { convertJsxCurlySpacing } from "./ruleConverters/eslint-plugin-react/jsx-curly-spacing"; import { convertJsxEqualsSpacing } from "./ruleConverters/eslint-plugin-react/jsx-equals-spacing"; import { convertJsxKey } from "./ruleConverters/eslint-plugin-react/jsx-key"; +import { convertJsxSpaceBeforeTrailingSlash } from "./ruleConverters/eslint-plugin-react/jsx-space-before-trailing-slash"; import { convertJsxNoBind } from "./ruleConverters/eslint-plugin-react/jsx-no-bind"; import { convertJsxNoLambda } from "./ruleConverters/eslint-plugin-react/jsx-no-lambda"; import { convertJsxSelfClose } from "./ruleConverters/eslint-plugin-react/jsx-self-close"; @@ -246,6 +247,7 @@ export const ruleConverters = new Map([ ["jsx-no-bind", convertJsxNoBind], ["jsx-no-lambda", convertJsxNoLambda], ["jsx-self-close", convertJsxSelfClose], + ["jsx-space-before-trailing-slash", convertJsxSpaceBeforeTrailingSlash], ["jsx-wrap-multiline", convertJsxWrapMultiline], ["label-position", convertLabelPosition], ["linebreak-style", convertLinebreakStyle], diff --git a/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/jsx-space-before-trailing-slash.ts b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/jsx-space-before-trailing-slash.ts new file mode 100644 index 000000000..8a0027488 --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/jsx-space-before-trailing-slash.ts @@ -0,0 +1,18 @@ +import { RuleConverter } from "../../ruleConverter"; + +export const convertJsxSpaceBeforeTrailingSlash: RuleConverter = () => { + return { + rules: [ + { + ruleArguments: [ + { + afterOpening: "allow", + closingSlash: "allow", + }, + ], + ruleName: "react/jsx-tag-spacing", + }, + ], + plugins: ["eslint-plugin-react"], + }; +}; diff --git a/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/tests/jsx-space-before-trailing-slash.test.ts b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/tests/jsx-space-before-trailing-slash.test.ts new file mode 100644 index 000000000..8b0fd547b --- /dev/null +++ b/src/converters/lintConfigs/rules/ruleConverters/eslint-plugin-react/tests/jsx-space-before-trailing-slash.test.ts @@ -0,0 +1,24 @@ +import { convertJsxSpaceBeforeTrailingSlash } from "../jsx-space-before-trailing-slash"; + +describe(convertJsxSpaceBeforeTrailingSlash, () => { + test("conversion without arguments", () => { + const result = convertJsxSpaceBeforeTrailingSlash({ + ruleArguments: [], + }); + + expect(result).toEqual({ + rules: [ + { + ruleArguments: [ + { + afterOpening: "allow", + closingSlash: "allow", + }, + ], + ruleName: "react/jsx-tag-spacing", + }, + ], + plugins: ["eslint-plugin-react"], + }); + }); +});