@@ -10,13 +10,44 @@ const util = require('util');
10
10
const Components = require ( '../util/Components' ) ;
11
11
const astUtil = require ( '../util/ast' ) ;
12
12
13
+ const defaultConfig = {
14
+ order : [
15
+ 'static-methods' ,
16
+ 'lifecycle' ,
17
+ 'everything-else' ,
18
+ 'render'
19
+ ] ,
20
+ groups : {
21
+ lifecycle : [
22
+ 'displayName' ,
23
+ 'propTypes' ,
24
+ 'contextTypes' ,
25
+ 'childContextTypes' ,
26
+ 'mixins' ,
27
+ 'statics' ,
28
+ 'defaultProps' ,
29
+ 'constructor' ,
30
+ 'getDefaultProps' ,
31
+ 'state' ,
32
+ 'getInitialState' ,
33
+ 'getChildContext' ,
34
+ 'componentWillMount' ,
35
+ 'componentDidMount' ,
36
+ 'componentWillReceiveProps' ,
37
+ 'shouldComponentUpdate' ,
38
+ 'componentWillUpdate' ,
39
+ 'componentDidUpdate' ,
40
+ 'componentWillUnmount'
41
+ ]
42
+ }
43
+ } ;
44
+
13
45
/**
14
46
* Get the methods order from the default config and the user config
15
- * @param {Object } defaultConfig The default configuration.
16
47
* @param {Object } userConfig The user configuration.
17
48
* @returns {Array } Methods order
18
49
*/
19
- function getMethodsOrder ( defaultConfig , userConfig ) {
50
+ function getMethodsOrder ( userConfig ) {
20
51
userConfig = userConfig || { } ;
21
52
22
53
const groups = util . _extend ( defaultConfig . groups , userConfig . groups ) ;
@@ -78,37 +109,7 @@ module.exports = {
78
109
79
110
const MISPOSITION_MESSAGE = '{{propA}} should be placed {{position}} {{propB}}' ;
80
111
81
- const methodsOrder = getMethodsOrder ( {
82
- order : [
83
- 'static-methods' ,
84
- 'lifecycle' ,
85
- 'everything-else' ,
86
- 'render'
87
- ] ,
88
- groups : {
89
- lifecycle : [
90
- 'displayName' ,
91
- 'propTypes' ,
92
- 'contextTypes' ,
93
- 'childContextTypes' ,
94
- 'mixins' ,
95
- 'statics' ,
96
- 'defaultProps' ,
97
- 'constructor' ,
98
- 'getDefaultProps' ,
99
- 'state' ,
100
- 'getInitialState' ,
101
- 'getChildContext' ,
102
- 'componentWillMount' ,
103
- 'componentDidMount' ,
104
- 'componentWillReceiveProps' ,
105
- 'shouldComponentUpdate' ,
106
- 'componentWillUpdate' ,
107
- 'componentDidUpdate' ,
108
- 'componentWillUnmount'
109
- ]
110
- }
111
- } , context . options [ 0 ] ) ;
112
+ const methodsOrder = getMethodsOrder ( context . options [ 0 ] ) ;
112
113
113
114
// --------------------------------------------------------------------------
114
115
// Public
@@ -438,5 +439,7 @@ module.exports = {
438
439
reportErrors ( ) ;
439
440
}
440
441
} ;
441
- } )
442
+ } ) ,
443
+
444
+ defaultConfig
442
445
} ;
0 commit comments