no-hooks
UnreleasedConfiguration
rslint.config.ts
Rule Details
Disallow Rstest setup and teardown hooks. This rule reports the four lifecycle
hooks Rstest exposes: beforeAll, beforeEach, afterEach, and afterAll.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
allow
This array option controls which Rstest hooks are allowed. Supported values are:
"beforeAll""beforeEach""afterAll""afterEach"
By default, no hook is allowed.
Examples of incorrect code for the { "allow": ["afterEach"] } option:
Examples of correct code for the { "allow": ["afterEach"] } option:
Differences from ESLint
@rstest/playwrightmember hooks such astest.beforeEach()andtest.extend({}).afterAll()are reported because they are real Rstest hook registrations.@rstest/corelookalikes such astest.beforeEach(), invalid chains such astest.skip.beforeEach(), and execution-time APIs likeonTestFinished()are not reported.