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

ESLint Plugin: react-no-unsafe-timeout: Consider variable assignment as valid #16292

Merged
merged 2 commits into from
Jun 26, 2019

Conversation

aduth
Copy link
Member

@aduth aduth commented Jun 25, 2019

Fixes #15622

This pull request seeks to resolve an issue with the custom react-no-unsafe-timeout rule, notably affecting usage in combination with useEffect.

Implementation Notes:

The original implementation included tolerances for setTimeout where the result was assumed to be used for future cancelling (in the unmount). However, it only accounted for assignment to an instance property (this.handle = setTimeout( ... )), and not use as a variable.

Testing Instructions:

Ensure there are no lint errors:

npm run lint-js

Verify unit tests pass:

npm run test-unit packages/eslint-plugin

@aduth aduth added [Type] Bug An existing feature does not function as intended [Package] ESLint plugin /packages/eslint-plugin labels Jun 25, 2019
@aduth aduth requested a review from youknowriad June 25, 2019 20:57
Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] ESLint plugin /packages/eslint-plugin [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

the ESLint @wordpress/react-no-unsafe-timeout shouldn't guard against using setTimeout in react hooks
2 participants