Use act from @test-utils in SC (#32432)

* test: use `act` from `@test-utils` in SC

* chore: add rules to enforce use of act from `@test-utils`
This commit is contained in:
Florian Duros
2026-02-10 12:10:56 +01:00
committed by GitHub
parent 1b76f2b72c
commit 753e94f165
2 changed files with 14 additions and 2 deletions

View File

@@ -30,6 +30,18 @@ module.exports = {
"react/jsx-key": ["error"],
"matrix-org/require-copyright-header": "error",
"react-compiler/react-compiler": "error",
"no-restricted-imports": [
"error",
{
paths: [
{
name: "react",
importNames: ["act"],
message: "Please use @test-utils instead.",
},
],
},
],
},
overrides: [
{

View File

@@ -5,8 +5,8 @@
* Please see LICENSE files in the repository root for full details.
*/
import React, { act } from "react";
import { render, screen } from "@test-utils";
import React from "react";
import { act, render, screen } from "@test-utils";
import userEvent from "@testing-library/user-event";
import { composeStories } from "@storybook/react-vite";
import { describe, it, expect, vi, beforeEach } from "vitest";