no-hooks
Added in v0.3.4Configuration
rslint.config.ts
Rule Details
Disallow Jest lifecycle hooks (beforeEach, afterEach, beforeAll, afterAll). This rule helps enforce tests that are isolated and explicit, instead of relying on shared setup/teardown behavior that can make test order and failures harder to reason about.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
- First argument (optional): object with
allowallow: array of hook names that are allowed. Supported values:beforeEach,afterEach,beforeAll,afterAll.