-
Notifications
You must be signed in to change notification settings - Fork 144
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 Testing Library v4 #186
Comments
Do you think we need to wait for those 4 new rules for releasing v4? I think |
We could also assign issues from the milestone. |
Yeah I just felt I needed a place to see everything together but also be able to discuss what's needed and coordinate this better. |
I guess that depends on if we want to make them recommended, and I think they probably should be. As long as it doesn't take too longer to work on them, waiting to release them would reduce the number of breaking releases and potentially make upgrading easier. Alternatively we could make the migration more gradual and maybe release rules in 4.x but only recommend them in 5.x. |
Mmm I wasn't thinking about releasing new rules included in config presets as major. I see including rules in preset as a major only when they existed before, but not if they are gonna be completely new rules. Again, I don't know how we should address this. |
Both adding an existing rule and adding a new rule to a config change the config to make more use cases fail, which I see as a breaking change either way. So I think we'd either need to wait for these to be in v4 or have them in a future major release if we don't enable them in v4, but I was asking more about how we'd release the rules themselves and change the configs. |
Maybe we should make suggestions about new features warn rather than error to make it easier for users to migrate. Relevant discussions: |
I guess the candidates for that would be:
Any other rule I'm missing? |
@Belco90 Maybe |
We don't really need to worry about if a rule should be enabled for CRA or not, as CRA will enable them manually. In our shareable configs is more about "should we enable a rule as error for a brand new Testing Library feature"? Probably better a warning for them as @nickmccurdy pointed so we can help users migrating their Testing Library framework codebase for future updates without harming them. So regarding |
Something else I would like to discuss: I'm close to finish I have some ideas about how to implement it, I don't think it would be complicated. As we have some utils functions already checking if a node is a render method, we can check directly on that one if there are some custom functions set in the plugin. Then we just need to remove the options from each rule, update the set up in the tests and all of them should pass. Thoughts? |
I think it'd be really useful to have that generic configuration/functionality for the v4. Either way, I think it's not a breaking change, but rather an opt-in (Extend the functionality to allow custom functions to be the imported ones), so in case we finish everything else but this, the worst case we can go out with v4 without it, if we can't delay it. but I would love to have it as part of this release, and I think it will be very helpful for all those who use a custom render function (that I believe it's a lot of devs) |
I think it would be useful too. Would also avoid repetitions by the user in the rules configs.
I think if we remove the config option from each rule to read it just from a global config, the user would have to rewrite their configs. That's what makes it a breaking change, right? |
Exactly, this is why it would be a breaking change |
I See. The rules I've worked with did not have that config, so I wasn't sure it was implemented and released in any. In that case, yeah, we should consider it as part of the v4, or we will have to release the v5 really soon |
Guys, looking at the v4 milestone, I would suggest something more. It's not required for v4 release, but probably we could start to ship it in v4 branch. We could start to map fixable actions for the current rules that we support. We have a few ones that implements, but I think that's a path to improve. What do you guys think about? |
Any specific suggestions? |
Sounds good. I think we can do this even after v4 release. It seems it can be related to that mechanism @nickmccurdy wanted to add to autogenerate the shareable configs columns? |
I think @renatoagds was referring to implementing fix support in more rules. According to the readme, three rules have it so far. We could map the fix flag in each rule to the readme though. |
Ah sorry, I understood something else. Add fix code to current rules can be done at any time actually. I'm sorry I'm not really active lately. I'm swamped at work and dealing with some other personal projects. I hope I have some spare time next week to push v4 of the plugin! |
Yes! The point was about mapping this in some place (including a few rules that is included only in v4) Which is the best place to map ? A new issue ? |
@renatoagds yeah, I think a new issue would be better so we can organize corresponding work there. Thanks! |
I've created a new issue for discussing and addressing the ESLint shared config feature #198 |
Almost there! I hope we can release v4 soon 🤞 |
I just realized @typescript-eslint/experimental-utils exports an ASTUtils module which already includes:
I feel so stupid now... I'll go back to #198 reusing this utils and try to remove the duplicated predicated ones we might have. |
@Belco90 This means |
Hey people! Just in case you haven't checked #198 we are doing some progress finally on last task! Mechanism to make plugin rules and detect Testing Library utils is implemented so from there we can start refactoring rules. There are few more things to add to the Testing Library utils detection, but the difficult part is done already ✨ |
We are really close to release v4, only 5 rules to go! After that I need to write proper documentation and do some cleanups, but I'm planning to release a beta version in case some of you can give it a try while I do those extra steps. |
It seemed like this day would never come, but finally, all rules are migrated to the new rule creator + helpers mechanism. I'm creating a small PR with some cleanup, and I'll create some small additional PRs to re-update some of the first rules migrated here to reuse some helpers added after they were migrated. The next steps are:
After this, we should be ready to release v4 officially. |
Ok, so |
I did a small check overall rules within a demo project and everything is working pretty smooth in general 🎉 . I found some weird node locations for some errors. I'll create a ticket for those issues and fix them in a proper PR. |
I just published |
New beta |
Latest |
🎉 This issue has been resolved in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'd like to keep everything planned for v4 update here, so it's easier for everyone involved to organize pending work. This was started in #165.
Changes planned for v4:
no-container
- new rule: no-container #171, feat: add no-container rule #177render-result-naming-convention
- new rule: render-result-naming-convention #170, feat: add render-result-naming-convention rule #200prefer-user-event
- New rule: prefer-user-event #162, [new-rule] prefer-user-event #192no-promise-in-fire-event
- fireEvent with Promises #166, feat(no-promise-in-fire-event): add new no-promise-in-fire-event rule #180no-wait-for-side-effects
- new rule: no-side-effects-wait-for #134, feat: add rule no-side-effects-wait-for #196no-node-access
- feat: add no-node-access rule #190no-wait-for-multiple-assertions
- new rule: no-multiple-assertions-wait-for #133, feat: add rule no-multiple-assertions-wait-for #189no-wait-for-empty-callback
in config presets - feat: recommend no-wait-for-empty-callback #168prefer-screen-queries
in config presets - feat: recommend prefer-screen-queries #169recommended
config todom
- Renamerecommended
config #182, refactor: rename recommended config to dom #184Extra:
Future Improvements:
no-unnecessary-act
- add no-unnecessary-act rule #259Thanks to @gndelia @timdeschryver @nickmccurdy @thebinaryfelix @renatoagds for your work on this one!
The text was updated successfully, but these errors were encountered: