Skip to content

Commit

Permalink
[Tests] no-access-state-in-setstate: passing test for “don't error …
Browse files Browse the repository at this point in the history
…if it's not a React Component”
  • Loading branch information
Kent C. Dodds authored and ljharb committed Jul 2, 2018
1 parent f4d4314 commit df939e3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,8 +11,12 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
### Fixed
* [`display-name`]: Get rid of false position on component detection ([#2759] @iiison)

### Changed
* [`no-access-state-in-setstate`]: passing test for “don't error if it's not a React Component” ([#1873] @kentcdodds)

[#2640]: https://github.com/yannickcr/eslint-plugin-react/pull/2640
[#2759]: https://github.com/yannickcr/eslint-plugin-react/pull/2759
[#1873]: https://github.com/yannickcr/eslint-plugin-react/pull/1873

## [7.25.3] - 2021.09.19

Expand Down
9 changes: 9 additions & 0 deletions tests/lib/rules/no-access-state-in-setstate.js
Expand Up @@ -137,6 +137,15 @@ ruleTester.run('no-access-state-in-setstate', rule, {
`,
parser: parsers.BABEL_ESLINT,
parserOptions
}, {
code: [
'class StateContainer extends Container {',
' anything() {',
' return this.setState({value: this.state.value + 1})',
' }',
'};'
].join('\n'),
parserOptions
}],

invalid: [{
Expand Down

0 comments on commit df939e3

Please sign in to comment.