beforeAllPaddingLines
Enforces padding around
beforeAllblocks.
✅ This rule is included in the vitest stylisticStrict presets.
Blank lines around beforeAll() hooks make one-time suite setup easier to notice.
They also separate expensive or shared initialization from nearby suite declarations and other setup code.
Examples
Section titled “Examples”import { beforeAll, describe } from "vitest";
const database = { connect() {},};beforeAll(() => { database.connect();});describe("database", () => { // ...});import { beforeAll, describe } from "vitest";
describe("queue", () => { const cache = { warm() {}, }; const worker = { start() {}, }; beforeAll(() => { cache.warm(); }); beforeAll(() => { worker.start(); });});import { beforeAll, describe } from "vitest";
const database = { connect() {},};
beforeAll(() => { database.connect();});
describe("database", () => { // ...});import { beforeAll, describe } from "vitest";
describe("queue", () => { const cache = { warm() {}, }; const worker = { start() {}, };
beforeAll(() => { cache.warm(); });
beforeAll(() => { worker.start(); });});Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your suites are very small and beforeAll() hooks are always immediately adjacent to the state they initialize, the extra spacing may not improve readability.
That tradeoff can be reasonable when your team prefers denser test files.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”
Made with ❤️🔥 around the world by
the Flint team and contributors.