Enable more eslint-plugin-react rules
This should contain all the rules we probably want to use, except react/wrap-multilines, which requires a larger codemod, and would clutter this commit.
Benjamin Woodruff committed
Jun 1, 2015 at 14:44 UTC
f41abdf70f635d817cc8c3e16759ccaa3e706887
4 files changed
+29
-6
.eslintrc
+22
-1
@@ -71,8 +71,29 @@ rules:
71
block-scoped-var: 0
72
73
# JSX
74
+ # Our transforms set this automatically
75
+ react/display-name: 0
76
+ react/jsx-boolean-value: [2, always]
77
+ react/jsx-no-undef: 2
78
+ react/jsx-quotes: [2, double]
79
+ # We don't care to do this
80
+ react/jsx-sort-prop-types: 0
81
+ react/jsx-sort-props: 0
82
react/jsx-uses-react: 2
75
- react/jsx-quotes: [2, "double"]
83
+ react/jsx-uses-vars: 2
84
+ # It's easier to test some things this way
85
+ react/no-did-mount-set-state: 0
86
+ react/no-did-update-set-state: 0
87
+ # We define multiple components in test files
88
+ react/no-multi-comp: 0
89
+ react/no-unknown-property: 2
90
+ # This isn't useful in our test code
91
+ react/prop-types: 0
92
+ react/react-in-jsx-scope: 2
93
+ react/self-closing-comp: 2
94
+ # We don't care to do this
95
+ react/sort-comp: 0
96
+ #react/wrap-multilines: 2
97
98
# CUSTOM RULES
99
# the second argument of warning/invariant should be a literal string
docs/_js/examples/.eslintrc
+5
-2
@@ -1,3 +1,6 @@
1
+---
2
rules:
2
- block-scoped-var: false
3
- no-undef: false
\ No newline at end of file
3
+ block-scoped-var: 0
4
+ no-undef: 0
5
+ react/react-in-jsx-scope: 0
6
+ react/jsx-no-undef: 0
src/addons/transitions/__tests__/ReactCSSTransitionGroup-test.js
+1
-2
@@ -117,8 +117,7 @@ describe('ReactCSSTransitionGroup', function() {
117
118
it('should work with no children', function() {
119
React.render(
120
- <ReactCSSTransitionGroup transitionName="yolo">
121
- </ReactCSSTransitionGroup>,
120
+ <ReactCSSTransitionGroup transitionName="yolo" />,
121
container
122
);
123
});
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+1
-1
@@ -663,7 +663,7 @@ describe('ReactDOMComponent', function() {
663
it('should warn about contentEditable and children', function() {
664
spyOn(console, 'error');
665
React.render(
666
- <div contentEditable><div /></div>,
666
+ <div contentEditable={true}><div /></div>,
667
container
668
);
669
expect(console.error.argsForCall.length).toBe(1);