-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(wip) added eslint #280
Merged
(wip) added eslint #280
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f60df13
added eslint
a268ad6
fixed most of the eslint errors
2926afc
added run lint to travis
e4c1b81
jsx double quotes
b8e81fb
fixed some more
13f7322
finished linting all the files
49a9133
fix error message spacing
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test/babel/fixtures | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"extends": "airbnb", | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"experimentalObjectRestSpread": true | ||
}, | ||
}, | ||
"rules": { | ||
"no-underscore-dangle": ["error", { "allow": ["__REACT_HOT_LOADER__"] }], | ||
"no-console": ["error", { allow: ["error"] }], | ||
"strict": 0, | ||
}, | ||
globals: { | ||
"__REACT_HOT_LOADER__": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ language: node_js | |
node_js: | ||
- "5" | ||
- "6" | ||
script: | ||
- npm run lint | ||
- npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./lib/babel'); | ||
module.exports = require('./lib/babel'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./lib/index'); | ||
module.exports = require('./lib/index'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./lib/patch'); | ||
module.exports = require('./lib/patch'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,11 +25,11 @@ class AppContainer extends Component { | |
} | ||
} | ||
|
||
componentWillReceiveProps(nextProps) { | ||
componentWillReceiveProps() { | ||
// Hot reload is happening. | ||
// Retry rendering! | ||
this.setState({ | ||
error: null | ||
error: null, | ||
}); | ||
// Force-update the whole tree, including | ||
// components that refuse to update. | ||
|
@@ -40,9 +40,9 @@ class AppContainer extends Component { | |
// In 15.0, it only catches errors on initial mount. | ||
// Later it will work for updates as well: | ||
// https://github.com/facebook/react/pull/6020 | ||
unstable_handleError(error) { | ||
unstable_handleError(error) { // eslint-disable-line camelcase | ||
this.setState({ | ||
error: error | ||
error, | ||
}); | ||
} | ||
|
||
|
@@ -54,38 +54,46 @@ class AppContainer extends Component { | |
|
||
if (this.props.component) { | ||
return <this.props.component {...this.props.props} />; | ||
} else { | ||
return React.Children.only(this.props.children); | ||
} | ||
|
||
return React.Children.only(this.props.children); | ||
} | ||
} | ||
|
||
AppContainer.propTypes = { | ||
component: function (props) { | ||
component(props) { | ||
if (props.component) { | ||
return new Error( | ||
`Passing "component" prop to <AppContainer /> is deprecated. ` + | ||
`Replace <AppContainer component={App} /> with <AppContainer><App /></AppContainer>.` | ||
'Passing "component" prop to <AppContainer /> is deprecated. ' + | ||
'Replace <AppContainer component={App} /> with <AppContainer><App /></AppContainer>.' | ||
); | ||
} | ||
|
||
return undefined; | ||
}, | ||
props: function (props) { | ||
props(props) { | ||
if (props.props) { | ||
return new Error( | ||
`Passing "props" prop to <AppContainer /> is deprecated. ` + | ||
`Replace <AppContainer component={App} props={{ myProp: myValue }} /> with <AppContainer><App myProp={myValue} /></AppContainer>.` | ||
'Passing "props" prop to <AppContainer /> is deprecated. ' + | ||
'Replace <AppContainer component={App} props={{ myProp: myValue }} /> ' + | ||
'with <AppContainer><App myProp={myValue} /></AppContainer>.' | ||
); | ||
} | ||
|
||
return undefined; | ||
}, | ||
children: function (props) { | ||
children(props) { | ||
if (React.Children.count(props.children) !== 1) { | ||
return new Error(`Invalid prop "children" supplied to AppContainer. Expected a single React element with your app’s root component, e.g. <App />.`); | ||
return new Error('Invalid prop "children" supplied to AppContainer.' + | ||
'Expected a single React element with your app’s root component, e.g. <App />.'); | ||
} | ||
} | ||
|
||
return undefined; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lol this rule is so nitpicky. But I can live with it 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this one looks pretty silly in some places :) |
||
}, | ||
}; | ||
|
||
AppContainer.defaultProps = { | ||
errorReporter: Redbox | ||
errorReporter: Redbox, | ||
}; | ||
|
||
module.exports = AppContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* eslint-disable global-require */ | ||
|
||
'use strict'; | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* eslint-disable react/prop-types */ | ||
|
||
'use strict'; | ||
|
||
const React = require('react'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* eslint-disable global-require */ | ||
|
||
'use strict'; | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There’s a missing space after the period in the error message. The sentences will collide.
Also a style nit: let’s put a newline right after the opening paren.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch