Skip to content

Commit 8f2a227

Browse files
author
Josh Goldberg
authored
Added converter for jsx-self-close rule (#862)
* Added converter for jsx-self-close rule * And ruleConverters, too
1 parent 2531cf6 commit 8f2a227

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
@@ -181,6 +181,7 @@ import { convertJsxCurlySpacing } from "./ruleConverters/eslint-plugin-react/jsx
181181
import { convertJsxEqualsSpacing } from "./ruleConverters/eslint-plugin-react/jsx-equals-spacing";
182182
import { convertJsxKey } from "./ruleConverters/eslint-plugin-react/jsx-key";
183183
import { convertJsxNoBind } from "./ruleConverters/eslint-plugin-react/jsx-no-bind";
184+
import { convertJsxSelfClose } from "./ruleConverters/eslint-plugin-react/jsx-self-close";
184185
import { convertJsxWrapMultiline } from "./ruleConverters/eslint-plugin-react/jsx-wrap-multiline";
185186

186187
// eslint-plugin-rxjs converters
@@ -242,6 +243,7 @@ export const ruleConverters = new Map([
242243
["jsx-equals-spacing", convertJsxEqualsSpacing],
243244
["jsx-key", convertJsxKey],
244245
["jsx-no-bind", convertJsxNoBind],
246+
["jsx-self-close", convertJsxSelfClose],
245247
["jsx-wrap-multiline", convertJsxWrapMultiline],
246248
["label-position", convertLabelPosition],
247249
["linebreak-style", convertLinebreakStyle],
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 convertJsxSelfClose: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "react/self-closing-comp",
8+
},
9+
],
10+
plugins: ["eslint-plugin-react"],
11+
};
12+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { convertJsxSelfClose } from "../jsx-self-close";
2+
3+
describe(convertJsxSelfClose, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertJsxSelfClose({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "react/self-closing-comp",
13+
},
14+
],
15+
plugins: ["eslint-plugin-react"],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)