Skip to content

Commit

Permalink
Revert "New rule no-access-state-in-setstate (#190)"
Browse files Browse the repository at this point in the history
This reverts commit 987a95e.
  • Loading branch information
adidahiya authored Mar 19, 2019
1 parent 987a95e commit ed56e53
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 206 deletions.
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ The built-in configuration preset you get with `"extends": "tslint-react"` is se
size={size}
/>
```
- Rule options: _none_
- `jsx-ban-elements` (since v3.4.0)
- Allows blacklisting of JSX elements with an optional explanatory message in the reported failure.
- `jsx-ban-props` (since v2.3.0)
Expand Down Expand Up @@ -122,22 +121,6 @@ The built-in configuration preset you get with `"extends": "tslint-react"` is se
</button>
);
```
- Rule options: _none_
- `no-access-state-in-setstate`
- Forbids accessing component state with `this.state` within `this.setState`
calls, since React might batch multiple `this.setState` calls, thus resulting
in accessing old state. Enforces use of callback argument instead.
```ts
// bad
this.setState({
counter: this.state.counter + 1
});
// good
this.setState(
prevState => ({ counter: prevState.counter + 1 })
);
```
- Rule options: _none_

### Development

Expand Down
119 changes: 0 additions & 119 deletions src/rules/noAccessStateInSetstateRule.ts

This file was deleted.

65 changes: 0 additions & 65 deletions test/rules/no-access-state-in-setstate/test.tsx.lint

This file was deleted.

5 changes: 0 additions & 5 deletions test/rules/no-access-state-in-setstate/tslint.json

This file was deleted.

0 comments on commit ed56e53

Please sign in to comment.