Skip to content

Commit

Permalink
Merge pull request #89 from zertosh/more-sort-comp
Browse files Browse the repository at this point in the history
Add context props to sort-comp
  • Loading branch information
yannickcr committed May 29, 2015
2 parents ab7d219 + ec1c62b commit 3da7535
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/rules/sort-comp.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When creating React components it is more convenient to always follow the same o

With default configuration the following organisation must be followed:

1. lifecycle methods: `displayName` ,`propTypes` ,`mixins` ,`statics` ,`getDefaultProps` ,`getInitialState` ,`componentWillMount` ,`componentDidMount` ,`componentWillReceiveProps` ,`shouldComponentUpdate` ,`componentWillUpdate` ,`componentDidUpdate` ,`componentWillUnmount` (in this order).
1. lifecycle methods: `displayName` ,`propTypes` ,`contextTypes` ,`childContextTypes` ,`mixins` ,`statics` ,`getDefaultProps` ,`getInitialState` ,`getChildContext` ,`componentWillMount` ,`componentDidMount` ,`componentWillReceiveProps` ,`shouldComponentUpdate` ,`componentWillUpdate` ,`componentDidUpdate` ,`componentWillUnmount` (in this order).
2. custom methods
3. `render` method

Expand Down Expand Up @@ -59,10 +59,13 @@ The default configuration is:
lifecycle: [
'displayName',
'propTypes',
'contextTypes',
'childContextTypes',
'mixins',
'statics',
'getDefaultProps',
'getInitialState',
'getChildContext',
'componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
Expand Down
3 changes: 3 additions & 0 deletions lib/rules/sort-comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ module.exports = function(context) {
lifecycle: [
'displayName',
'propTypes',
'contextTypes',
'childContextTypes',
'mixins',
'statics',
'getDefaultProps',
'getInitialState',
'getChildContext',
'componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/rules/sort-comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ eslintTester.addRuleTest('lib/rules/sort-comp', {
'var Hello = React.createClass({',
' displayName : \'\',',
' propTypes: {},',
' contextTypes: {},',
' childContextTypes: {},',
' mixins: [],',
' statics: {},',
' getDefaultProps: function() {},',
' getInitialState: function() {},',
' getChildContext: function() {},',
' componentWillMount: function() {},',
' componentDidMount: function() {},',
' componentWillReceiveProps: function() {},',
Expand Down

0 comments on commit 3da7535

Please sign in to comment.