Skip to content

Commit

Permalink
move to util/lifecycleMethods file
Browse files Browse the repository at this point in the history
  • Loading branch information
ngtan committed Sep 17, 2018
1 parent 8a7b2e3 commit f8f296e
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions lib/rules/no-typos.js
Expand Up @@ -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'));

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f8f296e

Please sign in to comment.