antfu / eslint-config

Anthony's ESLint config preset
https://eslint-config.antfu.me/
MIT License
3.4k stars 400 forks source link

Add additional optional testing modules #502

Open pauliesnug opened 2 weeks ago

pauliesnug commented 2 weeks ago

Clear and concise description of the problem

In addition to eslint-plugin-vitest, there exist other testing frameworks that can integrate with other frameworks supported by the config and Vitest, such as eslint-plugin-testing-library, eslint-plugin-wdio, etc. This may be out of scope, but we could consider adding optional support for these plugins in addition to the existing vitest options.

Suggested solution

These could be within the core antfu/test config, but as optional plugins extending from the base vitest rules.

Alternative

No response

Additional context

No response

Validations

antfu commented 2 weeks ago

I use neither of them - can you briefly explain a bit what those plugins are for and why it would be useful?

pauliesnug commented 2 weeks ago

I use neither of them - can you briefly explain a bit what those plugins are for and why it would be useful?

Sure! eslint-plugin-wdio adds 3 small words related to WebDriverIO, which is a testing framework using browser automation (e.g. using await for expect calls since the browser automation is async, disallowing some unrecommended WDIO apis). This could definitely be out of scope, espically since these rules are small and the expect rule would only have to be applied to certain *.test.* files, which means specifying a blob. This would mostly be for convenience, but obviously people can just add the plugin themselves.

eslint-plugin-testing-library does mostly the same things, however the majority of the rules can only be applied to certain frameworks, so it might be something implemented in each webdev frameworks' Options? The rules in this plugin should be fine to apply to all test files I believe, since they seem to only effect testing-library-specific apis.

We could do something with a special blob, like *.wdio.test.*, but since this isn't standard it wouldn't make sense for pre existing projects that adopt the config...