testing-library / testing-library/eslint-plugin-testing-library

Report act from react-test-renderer

Open
#494 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement pinned
Dominant language
TypeScript
Stars
1.1k
Forks
168
Avg merge
15h 44m
Merged PRs (30d)
14

Description

What rule do you want to change?

no-unnecessary-act

Does this change cause the rule to produce more or fewer warnings?

More warnings

How will the change be implemented?

As discussed in https://github.com/testing-library/eslint-plugin-testing-library/discussions/488 the act method from react-test-renderer must be reported too.

Example code
import { act } from "react-test-renderer";
import { fireEvent } from "@testing-library/react-native";

act(() => {
     ...fireEvent..
})
How does the current rule affect the code?

act is not reported since it's imported from react-test-renderer

How will the new rule affect the code?

act imported from react-test-renderer should be reported too.

Anything else?

No response

Do you want to submit a pull request to change the rule?

Yes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the no-unnecessary-act rule and inspect how imported act sources are identified. Compare the existing behavior with the react-test-renderer example; done when that import is reported as an unnecessary act and existing behavior remains covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
testing, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.