-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[core] Set up eslint-plugin-testing-library #42909
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -83,6 +83,7 @@ describe('mochaHooks', () => { | |||||
// not wrapped in act() | ||||||
unsafeSetState(1); | ||||||
// make sure effects are flushed | ||||||
// eslint-disable-next-line testing-library/no-unnecessary-act | ||||||
act(() => {}); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be async as well?
Suggested change
Perhaps it could make sense to create a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I initially started to await all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it would be good to do separate as far as I'm concerned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is one: |
||||||
}); | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ describe('<ClickAwayListener />', () => { | |
* React bug: https://github.com/facebook/react/issues/20074 | ||
*/ | ||
function render(...args) { | ||
// eslint-disable-next-line testing-library/render-result-naming-convention | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh 🤦 . Maybe we should just disable this one rule? |
||
const result = clientRender(...args); | ||
This comment was marked as outdated.
Sorry, something went wrong. |
||
clock.tick(0); | ||
return result; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configuring the ESLint plugin using
overrides
so it only runs on test files. See docs for more info https://github.com/testing-library/eslint-plugin-testing-library?tab=readme-ov-file#eslint-overrides