afterAllPaddingLines
Enforces padding around
afterAllblocks.
✅ This rule is included in the vitest stylisticStrict presets.
Blank lines around afterAll() blocks make teardown code easier to spot when scanning a test file.
They also keep long-lived cleanup logic visually separated from neighboring test setup and suite definitions.
Examples
Section titled “Examples”import { afterAll, describe } from "vitest";
const server = { close() {},};afterAll(() => { server.close();});describe("server", () => {});import { afterAll, describe } from "vitest";
describe("worker", () => { const cache = { clear() {}, }; const queue = { stop() {}, }; afterAll(() => { cache.clear(); }); afterAll(() => { queue.stop(); });});import { afterAll, describe } from "vitest";
const server = { close() {},};
afterAll(() => { server.close();});
describe("server", () => {});import { afterAll, describe } from "vitest";
describe("worker", () => { const cache = { clear() {}, }; const queue = { stop() {}, };
afterAll(() => { cache.clear(); });
afterAll(() => { queue.stop(); });});Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If your team intentionally keeps afterAll() hooks tightly grouped with surrounding setup or suite declarations, the extra blank lines from this rule might add more vertical space than value.
That can be reasonable in very small test files where the teardown flow is already obvious.
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.