From f8f296e24d148c8335d4aa407e33344cbee043ed Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Mon, 17 Sep 2018 14:01:07 +0700 Subject: [PATCH] move to util/lifecycleMethods file --- lib/rules/no-typos.js | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) 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,