Skip to content

Commit

Permalink
[Fix] no-unused-class-component-methods: add getChildContext life…
Browse files Browse the repository at this point in the history
…cycle method

Fixes #3135
  • Loading branch information
yoyo837 authored and ljharb committed Nov 12, 2021
1 parent 87fe152 commit a2f8a35
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel

### Fixed
* [`no-invalid-html-attribute`]: allow `link` `rel` to have `apple-touch-icon`, `mask-icon` ([#3132][] @ljharb)
* [`no-unused-class-component-methods`]: add `getChildContext` lifecycle method ([#3136][] @yoyo837)

[#3136]: https://github.com/yannickcr/eslint-plugin-react/pull/3136
[#3132]: https://github.com/yannickcr/eslint-plugin-react/issue/3132

## [7.27.0] - 2021.11.09
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-unused-class-component-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const LIFECYCLE_METHODS = new Set([
'componentWillReceiveProps',
'componentWillUnmount',
'componentWillUpdate',
'getChildContext',
'getSnapshotBeforeUpdate',
'render',
'shouldComponentUpdate',
Expand Down
2 changes: 2 additions & 0 deletions tests/lib/rules/no-unused-class-component-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ ruleTester.run('no-unused-class-component-methods', rule, {
componentDidUpdate() {}
componentDidCatch() {}
componentWillUnmount() {}
getChildContext() {}
render() {
return <SomeComponent />;
}
Expand Down Expand Up @@ -467,6 +468,7 @@ ruleTester.run('no-unused-class-component-methods', rule, {
componentDidUpdate() {},
componentDidCatch() {},
componentWillUnmount() {},
getChildContext() {},
render() {
return <SomeComponent />;
},
Expand Down

0 comments on commit a2f8a35

Please sign in to comment.