testing-library / eslint-plugin-testing-library

ESLint plugin to follow best practices and anticipate common mistakes when writing tests with Testing Library
https://npm.im/eslint-plugin-testing-library
MIT License
982 stars 137 forks source link

fix: handle multiple imports with `no-manual-cleanup` #835

Closed maisano closed 10 months ago

maisano commented 11 months ago

Checks

Changes

Crawl all the import references when sniffing out no-manual-cleanup violations.

Context

There is currently a bug with no-manual-cleanup where we only ever check the first import of any testing-library package. While duplicative imports of the same package is very likely uncommon, there are many packages within the testing-library ecosystem that will trip up the package detection and break this rule when we only look at the first.

maisano-patreon commented 11 months ago

👋 Curious if I can get some eyes this, cc @Belco90

Belco90 commented 11 months ago

I'll try to review this next week.

maisano-patreon commented 10 months ago

Hi hi – bumping this again! Should be a very quick review. The PR just accounts for when someone might have multiple testing library imports (which is common in my company's codebase).

github-actions[bot] commented 10 months ago

:tada: This PR is included in version 6.1.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Belco90 commented 10 months ago

@all-contributors please add @maisano for code and test

allcontributors[bot] commented 10 months ago

@Belco90

I've put up a pull request to add @maisano! :tada: