Skip to content

Commit 1073733

Browse files
authored
Added jsx-key converter (#638)
* Added jsx-key converter * Remove ruleArguments in jsx-key converter
1 parent 485fc03 commit 1073733

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RuleConverter } from "../../converter";
2+
3+
export const convertJsxKey: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "react/jsx-key",
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 { convertJsxKey } from "../jsx-key";
2+
3+
describe(convertJsxKey, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertJsxKey({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "react/jsx-key",
13+
},
14+
],
15+
plugins: ["eslint-plugin-react"],
16+
});
17+
});
18+
});

src/rules/rulesConverters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ import { convertUsePipeTransformInterface } from "./converters/codelyzer/use-pip
174174

175175
// ESLint-React converters
176176
import { convertJsxBooleanValue } from "./converters/eslint-plugin-react/jsx-boolean-value";
177+
import { convertJsxKey } from "./converters/eslint-plugin-react/jsx-key";
177178

178179
/**
179180
* Keys TSLint rule names to their ESLint rule converters.
@@ -212,6 +213,7 @@ export const rulesConverters = new Map([
212213
["interface-over-type-literal", convertInterfaceOverTypeLiteral],
213214
["jsdoc-format", convertJSDocFormat],
214215
["jsx-boolean-value", convertJsxBooleanValue],
216+
["jsx-key", convertJsxKey],
215217
["label-position", convertLabelPosition],
216218
["linebreak-style", convertLinebreakStyle],
217219
["max-classes-per-file", convertMaxClassesPerFile],

0 commit comments

Comments
 (0)