diff --git a/lib/rules/no-typos.js b/lib/rules/no-typos.js index 4540e5a015..72694fd624 100644 --- a/lib/rules/no-typos.js +++ b/lib/rules/no-typos.js @@ -5,28 +5,13 @@ const Components = require('../util/Components'); const docsUrl = require('../util/docsUrl'); +const lifecycleMethods = require('../util/lifecycleMethods'); // ------------------------------------------------------------------------------ // Rule Definition // ------------------------------------------------------------------------------ const STATIC_CLASS_PROPERTIES = ['propTypes', 'contextTypes', 'childContextTypes', 'defaultProps']; -const LIFECYCLE_METHODS = [ - 'getDerivedStateFromProps', - 'componentWillMount', - 'UNSAFE_componentWillMount', - 'componentDidMount', - 'componentWillReceiveProps', - 'UNSAFE_componentWillReceiveProps', - 'shouldComponentUpdate', - 'componentWillUpdate', - 'UNSAFE_componentWillUpdate', - 'getSnapshotBeforeUpdate', - 'componentDidUpdate', - 'componentDidCatch', - 'componentWillUnmount', - 'render' -]; const PROP_TYPES = Object.keys(require('prop-types')); @@ -139,7 +124,7 @@ module.exports = { } function reportErrorIfLifecycleMethodCasingTypo(node) { - LIFECYCLE_METHODS.forEach(method => { + lifecycleMethods.forEach(method => { if (method.toLowerCase() === node.key.name.toLowerCase() && method !== node.key.name) { context.report({ node: node,