Skip to content

Commit

Permalink
don't error if it's not a React Component
Browse files Browse the repository at this point in the history
unstated uses `this.setState` and we're getting false positives when using this rule.
  • Loading branch information
Kent C. Dodds committed Jul 2, 2018
1 parent 809a25d commit c10ca73
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/lib/rules/no-access-state-in-setstate.js
Expand Up @@ -207,5 +207,14 @@ ruleTester.run('no-access-state-in-setstate', rule, {
errors: [{
message: 'Use callback in setState when referencing the previous state.'
}]
}, {
code: [
'class StateContainer extends Container {',
' anything() {',
' return this.setState({value: this.state.value + 1})',
' }',
'};'
].join('\n'),
parserOptions: parserOptions
}]
});

0 comments on commit c10ca73

Please sign in to comment.