|
5 | 5 |
|
6 | 6 | const Components = require('../util/Components'); |
7 | 7 | const docsUrl = require('../util/docsUrl'); |
| 8 | +const lifecycleMethods = require('../util/lifecycleMethods'); |
8 | 9 |
|
9 | 10 | // ------------------------------------------------------------------------------ |
10 | 11 | // Rule Definition |
11 | 12 | // ------------------------------------------------------------------------------ |
12 | 13 |
|
13 | 14 | const STATIC_CLASS_PROPERTIES = ['propTypes', 'contextTypes', 'childContextTypes', 'defaultProps']; |
14 | | -const LIFECYCLE_METHODS = [ |
15 | | - 'getDerivedStateFromProps', |
16 | | - 'componentWillMount', |
17 | | - 'UNSAFE_componentWillMount', |
18 | | - 'componentDidMount', |
19 | | - 'componentWillReceiveProps', |
20 | | - 'UNSAFE_componentWillReceiveProps', |
21 | | - 'shouldComponentUpdate', |
22 | | - 'componentWillUpdate', |
23 | | - 'UNSAFE_componentWillUpdate', |
24 | | - 'getSnapshotBeforeUpdate', |
25 | | - 'componentDidUpdate', |
26 | | - 'componentDidCatch', |
27 | | - 'componentWillUnmount', |
28 | | - 'render' |
29 | | -]; |
30 | 15 |
|
31 | 16 | const PROP_TYPES = Object.keys(require('prop-types')); |
32 | 17 |
|
@@ -139,7 +124,7 @@ module.exports = { |
139 | 124 | } |
140 | 125 |
|
141 | 126 | function reportErrorIfLifecycleMethodCasingTypo(node) { |
142 | | - LIFECYCLE_METHODS.forEach(method => { |
| 127 | + lifecycleMethods.forEach(method => { |
143 | 128 | if (method.toLowerCase() === node.key.name.toLowerCase() && method !== node.key.name) { |
144 | 129 | context.report({ |
145 | 130 | node: node, |
|
0 commit comments