Replies: 2 comments 3 replies
-
How would you see this working when you are working with 2 testing libraries (for instance
Do you have some examples of ESLint plugins doing this? Only by default is what you're saying I think?
It's a best-practice to always use it, so this rule should sort of work as an incentive to add it to Enabling it when the package is present is is definitely a good thing, but I think the incentive case is a good one to keep in mind too. |
Beta Was this translation helpful? Give feedback.
-
Added Rules renaming section. I have more suggestions for this one, I'll try to fill it soon. |
Beta Was this translation helpful? Give feedback.
-
This is just an umbrella discussion to keep all ideas and necessary changes to be addressed in the next major release:
eslint-plugin-testing-library
v5Changes in Shareable Configs
no-unnecessary-act
toreact
configRules renaming
no-debug
-->no-debugging-utils
Add framework to the detection mechanism
Mario Beltrán: I think it would be interesting to be able to set which Testing Library framework you are using at the Shared Setting level rather than per rule (e.g.
no-dom-import
). Knowing which Testing Library framework is used across the whole plugin would make it easier for the users to set up the plugin, but also improve the way we can detect, report and fix errors.With this shared setting, we could merge rules like
await-async-utils
andawait-fire-event
into a single one. Knowing which Testing Library framework is used would enable the plugin to report utils that have some particularities for specific frameworks, likefireEvent
being async for Vue and Svelte, but not in others. It would give us the ability to detect behaviors across Testing Library packages with more granular control about different details for each framework.This would make it easier to include new frameworks in the plugin too since ideally it would imply just including the new option and define its particularities for existing rules.
However, we need to define the proper structure to keep the info based on Testing Library frameworks. For example, which utils are async for each framework.
Auto enable some rules based on packages installed in the codebase
Mario Beltrán: Some existing ESLint plugins detect certain packages installed in the codebase (and even their versions). I think it would be really interesting to do have this mechanism in our plugin so we can auto-enable some rules based on packages found in the user's codebase:
no-manual-cleanup
if mocha, Jest, or Jasmine foundprefer-user-event
ifuser-event
foundI don't think we don't need to check the version installed for the first approach.
Feel free to comment your own ideas to discuss what to implement in the next major! ✨
Beta Was this translation helpful? Give feedback.
All reactions