Skip to content

Commit 3da7535

Browse files
committed
Merge pull request #89 from zertosh/more-sort-comp
Add context props to sort-comp
2 parents ab7d219 + ec1c62b commit 3da7535

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

docs/rules/sort-comp.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ When creating React components it is more convenient to always follow the same o
66

77
With default configuration the following organisation must be followed:
88

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

@@ -59,10 +59,13 @@ The default configuration is:
5959
lifecycle: [
6060
'displayName',
6161
'propTypes',
62+
'contextTypes',
63+
'childContextTypes',
6264
'mixins',
6365
'statics',
6466
'getDefaultProps',
6567
'getInitialState',
68+
'getChildContext',
6669
'componentWillMount',
6770
'componentDidMount',
6871
'componentWillReceiveProps',

lib/rules/sort-comp.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@ module.exports = function(context) {
5656
lifecycle: [
5757
'displayName',
5858
'propTypes',
59+
'contextTypes',
60+
'childContextTypes',
5961
'mixins',
6062
'statics',
6163
'getDefaultProps',
6264
'getInitialState',
65+
'getChildContext',
6366
'componentWillMount',
6467
'componentDidMount',
6568
'componentWillReceiveProps',

tests/lib/rules/sort-comp.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ eslintTester.addRuleTest('lib/rules/sort-comp', {
2626
'var Hello = React.createClass({',
2727
' displayName : \'\',',
2828
' propTypes: {},',
29+
' contextTypes: {},',
30+
' childContextTypes: {},',
2931
' mixins: [],',
3032
' statics: {},',
3133
' getDefaultProps: function() {},',
3234
' getInitialState: function() {},',
35+
' getChildContext: function() {},',
3336
' componentWillMount: function() {},',
3437
' componentDidMount: function() {},',
3538
' componentWillReceiveProps: function() {},',

0 commit comments

Comments
 (0)