Skip to content

allPaddingLines

Enforces padding around Vitest blocks.

✅ This rule is included in the vitest stylisticStrict presets.

Blank lines between Vitest hooks, suites, test cases, and assertion groups make test files easier to scan. This rule applies the same spacing convention across those block types so a file reads with a more consistent rhythm.

import { beforeEach, expect, it } from "vitest";
const value = "cherry";
beforeEach(() => {
// ...
});
it("does something", () => {
const count = 1;
expect(count).toBe(1);
console.log(value);
});
import { afterAll, describe, expect, test } from "vitest";
const server = {
close() {},
running: true,
};
describe("server", () => {
afterAll(() => {
server.close();
});
test("responds", () => {
expect(server.running).toBe(true);
});
});

This rule is not configurable.

If you want spacing rules for only one part of Vitest syntax, the narrower padding rules may fit your project better. This rule can feel too opinionated for compact test files because it applies one spacing style across multiple kinds of statements.

Made with ❤️‍🔥 around the world by the Flint team and contributors.