Skip to content

Commit c7eb68e

Browse files
Add jsx-no-bind rule (#654)
* Added jsx-no-bind rule * Added notices
1 parent 899c492 commit c7eb68e

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { RuleConverter } from "../../converter";
2+
3+
export const convertJsxNoBind: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "react/jsx-no-bind",
8+
notices: ["ESLint rule 'jsx-no-bind' also checks for arrow functions"],
9+
},
10+
],
11+
plugins: ["eslint-plugin-react"],
12+
};
13+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { convertJsxNoBind } from "../jsx-no-bind";
2+
3+
describe(convertJsxNoBind, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertJsxNoBind({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "react/jsx-no-bind",
13+
notices: ["ESLint rule 'jsx-no-bind' also checks for arrow functions"],
14+
},
15+
],
16+
plugins: ["eslint-plugin-react"],
17+
});
18+
});
19+
});

src/rules/rulesConverters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ import { convertJsxBooleanValue } from "./converters/eslint-plugin-react/jsx-boo
177177
import { convertJsxCurlySpacing } from "./converters/eslint-plugin-react/jsx-curly-spacing";
178178
import { convertJsxEqualsSpacing } from "./converters/eslint-plugin-react/jsx-equals-spacing";
179179
import { convertJsxKey } from "./converters/eslint-plugin-react/jsx-key";
180+
import { convertJsxNoBind } from "./converters/eslint-plugin-react/jsx-no-bind";
180181

181182
/**
182183
* Keys TSLint rule names to their ESLint rule converters.
@@ -218,6 +219,7 @@ export const rulesConverters = new Map([
218219
["jsx-curly-spacing", convertJsxCurlySpacing],
219220
["jsx-equals-spacing", convertJsxEqualsSpacing],
220221
["jsx-key", convertJsxKey],
222+
["jsx-no-bind", convertJsxNoBind],
221223
["label-position", convertLabelPosition],
222224
["linebreak-style", convertLinebreakStyle],
223225
["max-classes-per-file", convertMaxClassesPerFile],

0 commit comments

Comments
 (0)