From 6b7c08175912ad6348894ebd5ca2b225cd124d3b Mon Sep 17 00:00:00 2001 From: Yannick Croissant Date: Tue, 8 Mar 2016 21:48:46 +0000 Subject: [PATCH] Fix missing getChildContext lifecycle methods in prefer-stateless-function (fixes #492) --- docs/rules/prefer-stateless-function.md | 2 +- lib/rules/prefer-stateless-function.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/rules/prefer-stateless-function.md b/docs/rules/prefer-stateless-function.md index 757fc7b5bc..3415799b81 100644 --- a/docs/rules/prefer-stateless-function.md +++ b/docs/rules/prefer-stateless-function.md @@ -6,7 +6,7 @@ Stateless functional components are more simple than class based components and This rule will check your class based React components for -* lifecycle methods: `state`, `getInitialState`, `componentWillMount`, `componentDidMount`, `componentWillReceiveProps`, `shouldComponentUpdate`, `componentWillUpdate`, `componentDidUpdate` and `componentWillUnmount` +* lifecycle methods: `state`, `getInitialState`, `getChildContext`, `componentWillMount`, `componentDidMount`, `componentWillReceiveProps`, `shouldComponentUpdate`, `componentWillUpdate`, `componentDidUpdate` and `componentWillUnmount` * usage of `this.setState` * presence of `ref` attribute in JSX diff --git a/lib/rules/prefer-stateless-function.js b/lib/rules/prefer-stateless-function.js index 8669f327af..2cdeec147c 100644 --- a/lib/rules/prefer-stateless-function.js +++ b/lib/rules/prefer-stateless-function.js @@ -17,6 +17,7 @@ module.exports = Components.detect(function(context, components, utils) { var lifecycleMethods = [ 'state', 'getInitialState', + 'getChildContext', 'componentWillMount', 'componentDidMount', 'componentWillReceiveProps',