Skip to content

Commit

Permalink
Enable more eslint-plugin-react rules
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bgw committed Jun 4, 2015
1 parent 6b79977 commit f41abdf
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
23 changes: 22 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,29 @@ rules:
block-scoped-var: 0

# JSX
# Our transforms set this automatically
react/display-name: 0
react/jsx-boolean-value: [2, always]
react/jsx-no-undef: 2
react/jsx-quotes: [2, double]
# We don't care to do this
react/jsx-sort-prop-types: 0
react/jsx-sort-props: 0
react/jsx-uses-react: 2
react/jsx-quotes: [2, "double"]
react/jsx-uses-vars: 2
# It's easier to test some things this way
react/no-did-mount-set-state: 0
react/no-did-update-set-state: 0
# We define multiple components in test files
react/no-multi-comp: 0
react/no-unknown-property: 2
# This isn't useful in our test code
react/prop-types: 0
react/react-in-jsx-scope: 2
react/self-closing-comp: 2
# We don't care to do this
react/sort-comp: 0
#react/wrap-multilines: 2

# CUSTOM RULES
# the second argument of warning/invariant should be a literal string
Expand Down
7 changes: 5 additions & 2 deletions docs/_js/examples/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
rules:
block-scoped-var: false
no-undef: false
block-scoped-var: 0
no-undef: 0
react/react-in-jsx-scope: 0
react/jsx-no-undef: 0
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ describe('ReactCSSTransitionGroup', function() {

it('should work with no children', function() {
React.render(
<ReactCSSTransitionGroup transitionName="yolo">
</ReactCSSTransitionGroup>,
<ReactCSSTransitionGroup transitionName="yolo" />,
container
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ describe('ReactDOMComponent', function() {
it('should warn about contentEditable and children', function() {
spyOn(console, 'error');
React.render(
<div contentEditable><div /></div>,
<div contentEditable={true}><div /></div>,
container
);
expect(console.error.argsForCall.length).toBe(1);
Expand Down

0 comments on commit f41abdf

Please sign in to comment.