Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] no-access-state-in-setstate: passing test for “don't error if it's not a React Component" #1873

Merged
merged 1 commit into from Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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