vitest/padding-around-all Style
What it does
This rule enforces padding around test framework functions. It combines the behavior of these rules:
padding-around-after-all-blockspadding-around-after-each-blockspadding-around-before-all-blockspadding-around-before-each-blockspadding-around-describe-blockspadding-around-expect-groupspadding-around-test-blocks
Why is this bad?
Inconsistent formatting of code can make the code more difficult to read and follow. This rule helps ensure that hooks, test blocks, and assertion groups are visually separated from the rest of the code, making them easier to identify while looking through test files.
Examples
Examples of incorrect code for this rule:
js
const thing = 123;
beforeEach(() => {});
test("foo", () => {
const value = 1;
expect(value).toBe(1);
});Examples of correct code for this rule:
js
const thing = 123;
beforeEach(() => {});
test("foo", () => {
const value = 1;
expect(value).toBe(1);
});How to use
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["vitest"],
"rules": {
"vitest/padding-around-all": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["vitest"],
rules: {
"vitest/padding-around-all": "error",
},
});bash
oxlint --deny vitest/padding-around-all --vitest-pluginVersion
This rule was added in vnext.
