Skip to content

RFC: new rule to prefer the usage of screen #95

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

Closed
timdeschryver opened this issue Mar 21, 2020 · 7 comments · Fixed by #99
Closed

RFC: new rule to prefer the usage of screen #95

timdeschryver opened this issue Mar 21, 2020 · 7 comments · Fixed by #99
Labels
new rule New rule to be included in the plugin released

Comments

@timdeschryver
Copy link
Member

It's preferred to use screen when using the query functions.

// bad
const component = render()
component.getBy()

// good
screen.getBy()

For a first implementation we can verify that the queries used have screen as callee.
This doesn't take the following into account, but it makes the rule simpler.

const screen = render()
screen.getBy
@timdeschryver timdeschryver added the new rule New rule to be included in the plugin label Mar 21, 2020
@Belco90
Copy link
Member

Belco90 commented Mar 21, 2020

I guess we can skip that last case for now. What about?

const { getByText } = render();
const button = getByText('submit');

I think this one should be included too, which would be queries without a calle?

@timdeschryver
Copy link
Member Author

Imho these would also be a warning.

@Belco90
Copy link
Member

Belco90 commented Mar 22, 2020

Cool, so we can create a new rule called prefer-screen-queries which report all queries not called from screen.<query>.

@Belco90 Belco90 mentioned this issue Mar 23, 2020
6 tasks
@timdeschryver
Copy link
Member Author

👍 I'll try to implement this rule later this week

@Belco90
Copy link
Member

Belco90 commented Mar 23, 2020

That would be awesome :)

Belco90 pushed a commit that referenced this issue Mar 26, 2020
* feat: add prefer-screen-queries

Closes #95

* docs: review changes
@timdeschryver
Copy link
Member Author

Closed by #99

Belco90 added a commit that referenced this issue Mar 29, 2020
feat(await-async-utils): reflect waitFor changes (#89)
feat: new rule no-wait-for-empty-callback (#94)
feat: new rule prefer-wait-for (#88)
feat: new rule prefer-screen-queries (#99)
BREAKING CHANGE: drop support for node v8. Min version allowed is node v10.12 (#96)
BREAKING CHANGE: rule `no-get-by-for-checking-element-not-present` removed in favor of new rule `prefer-presence-queries` (#98)

Closes #85
Closes #86
Closes #90
Closes #92
Closes #95

Co-authored-by: timdeschryver <[email protected]>
@Belco90
Copy link
Member

Belco90 commented Mar 29, 2020

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule New rule to be included in the plugin released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants