Skip to content

Commit f8f296e

Browse files
committed
move to util/lifecycleMethods file
1 parent 8a7b2e3 commit f8f296e

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

lib/rules/no-typos.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,13 @@
55

66
const Components = require('../util/Components');
77
const docsUrl = require('../util/docsUrl');
8+
const lifecycleMethods = require('../util/lifecycleMethods');
89

910
// ------------------------------------------------------------------------------
1011
// Rule Definition
1112
// ------------------------------------------------------------------------------
1213

1314
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-
];
3015

3116
const PROP_TYPES = Object.keys(require('prop-types'));
3217

@@ -139,7 +124,7 @@ module.exports = {
139124
}
140125

141126
function reportErrorIfLifecycleMethodCasingTypo(node) {
142-
LIFECYCLE_METHODS.forEach(method => {
127+
lifecycleMethods.forEach(method => {
143128
if (method.toLowerCase() === node.key.name.toLowerCase() && method !== node.key.name) {
144129
context.report({
145130
node: node,

0 commit comments

Comments
 (0)