add tests for extends Component in noDidUpdateSetState
MODIFY
packages/@romejs/js-compiler/lint/rules/react/noDidUpdateSetState.test.ts
packages/@romejs/js-compiler/lint/rules/react/noDidUpdateSetState.test.ts
@@ -53,6 +53,25 @@ test(
}
}
`,
+ `
+ class Hello extends Component {
+ componentDidUpdate() {
+ this.setState({
+ name: 'John'
+ });
+ }
+ }
+ `,
+ `
+ class Hello extends Component {
+ componentDidUpdate() {
+ foo();
+ this.setState({
+ name: 'John'
+ });
+ }
+ }
+ `,
// VALID
`
var Hello = createReactClass({
@@ -77,6 +96,17 @@ test(
}
`,
`
+ class Hello extends Component {
+ componentDidUpdate() {
+ if (condition) {
+ this.setState({
+ name: 'John'
+ });
+ }
+ }
+ }
+ `,
+ `
var Hello = createReactClass({
componentDidUpdate: function() {
foo();

add tests for extends Component in noDidUpdateSetState