Skip to content

[no-render-in-lifecycle] false positive #1000

Closed
@Maxim-Mazurok

Description

@Maxim-Mazurok

Have you read the Troubleshooting section?

Yes

Plugin version

v6.1.2

ESLint version

v8.57.0

Node.js version

v20.17.0

package manager and version

npm 10.8.2

Operating system

Ubuntu 24

Bug description

no-render-in-lifecycle gives false posivite when calling a function that starts with render:

beforeEach(() => {
  setActivePinia(createTestingPinia());
  renderStoreInsideSetup(useLoggedInUserStore); // This throws false-positive - unexpected
  useComplianceStore().landingPageNavigationTriggered = true;
});

Likely due to regex issue?

Steps to reproduce

Lint code from above

Error output/screenshots

Forbidden usage of `render` within testing framework `beforeEach` setupeslint[testing-library/no-render-in-lifecycle](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-render-in-lifecycle.md)

ESLint configuration

...

...compat
    .extends("plugin:jest-formatting/recommended", "plugin:vitest/all", "plugin:testing-library/vue")
    .map((config) => ({
      ...config,
      files: ["src/**/__tests__/*", "**/*.spec.ts", "**/*.spec.tsx", "**/*.skip.ts"],
    })),

...

Rule(s) affected

testing-library/no-render-in-lifecycle

Anything else?

No response

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

No

Metadata

Metadata

Assignees

Labels

awaiting responseWaiting for a reply from the OPquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions