Skip to content

Commit 6a5d08d

Browse files
committed
Merge pull request jsx-eslint#194 from mathieudutour/master
Add `state` in lifecycle methods
2 parents d39a6cc + 40880e2 commit 6a5d08d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

docs/rules/sort-comp.md

+2-1
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`, `contextTypes`, `childContextTypes`, `mixins`, `statics`,`defaultProps`, `constructor`, `getDefaultProps`, `getInitialState`, `getChildContext`, `componentWillMount`, `componentDidMount`, `componentWillReceiveProps`, `shouldComponentUpdate`, `componentWillUpdate`, `componentDidUpdate`, `componentWillUnmount` (in this order).
9+
1. lifecycle methods: `displayName`, `propTypes`, `contextTypes`, `childContextTypes`, `mixins`, `statics`,`defaultProps`, `constructor`, `getDefaultProps`, `getInitialState`, `state`, `getChildContext`, `componentWillMount`, `componentDidMount`, `componentWillReceiveProps`, `shouldComponentUpdate`, `componentWillUpdate`, `componentDidUpdate`, `componentWillUnmount` (in this order).
1010
2. custom methods
1111
3. `render` method
1212

@@ -67,6 +67,7 @@ The default configuration is:
6767
'constructor',
6868
'getDefaultProps',
6969
'getInitialState',
70+
'state',
7071
'getChildContext',
7172
'componentWillMount',
7273
'componentDidMount',

lib/rules/sort-comp.js

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ module.exports = function(context) {
6363
'defaultProps',
6464
'constructor',
6565
'getDefaultProps',
66+
'state',
6667
'getInitialState',
6768
'getChildContext',
6869
'componentWillMount',

0 commit comments

Comments
 (0)