diff --git a/docs/rules/sort-comp.md b/docs/rules/sort-comp.md index 780672944e..70409c37a5 100644 --- a/docs/rules/sort-comp.md +++ b/docs/rules/sort-comp.md @@ -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 @@ -59,10 +59,13 @@ The default configuration is: lifecycle: [ 'displayName', 'propTypes', + 'contextTypes', + 'childContextTypes', 'mixins', 'statics', 'getDefaultProps', 'getInitialState', + 'getChildContext', 'componentWillMount', 'componentDidMount', 'componentWillReceiveProps', diff --git a/lib/rules/sort-comp.js b/lib/rules/sort-comp.js index 6e2f1c9d65..21fa44dc0a 100644 --- a/lib/rules/sort-comp.js +++ b/lib/rules/sort-comp.js @@ -56,10 +56,13 @@ module.exports = function(context) { lifecycle: [ 'displayName', 'propTypes', + 'contextTypes', + 'childContextTypes', 'mixins', 'statics', 'getDefaultProps', 'getInitialState', + 'getChildContext', 'componentWillMount', 'componentDidMount', 'componentWillReceiveProps', diff --git a/tests/lib/rules/sort-comp.js b/tests/lib/rules/sort-comp.js index 138010d706..bbd57b39eb 100644 --- a/tests/lib/rules/sort-comp.js +++ b/tests/lib/rules/sort-comp.js @@ -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() {},',