eslint-plugin-testing-library icon indicating copy to clipboard operation
eslint-plugin-testing-library copied to clipboard

Renaming screen import still triggers prefer-screen-queries

Open abejfehr opened this issue 2 years ago • 1 comments

Have you read the Troubleshooting section?

Yes

Plugin version

v5.10.2

ESLint version

v8.16.0

Node.js version

v16.20.1

package manager and version

yarn 1.22.19

Operating system

macOS Monterey

Bug description

import { screen as rtlScreen } from '@testing-library/react-native';

...

rtlScreen.getByText(...); // fails

Steps to reproduce

  1. enable the prefer-screen-queries lint rule
  2. import screen, but rename it
  3. observe that the lint rule still errors

Error output/screenshots

No response

ESLint configuration

N/A

Rule(s) affected

prefer-screen-queries

Anything else?

No response

Do you want to submit a pull request to fix this bug?

No

abejfehr avatar Jul 14 '23 15:07 abejfehr

Hi @abejfehr! I overlooked this issue somehow, sorry about that!

We have recently discussed this problem in other parts of the plugin, so it would be interesting to address this too. Thanks for reporting!

Belco90 avatar Jun 11 '25 08:06 Belco90

:tada: This issue has been resolved in version 7.13.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Oct 09 '25 07:10 github-actions[bot]