jest/padding-around-after-all-blocks Style
作用
此规则要求在 1 个或多个 afterAll 语句前后各保留一行空白。
为什么这不好?
代码格式不一致会使代码更难阅读和理解。此规则有助于确保 afterAll 块在视觉上与其余代码分隔开来,使其在浏览测试文件时更容易识别。
示例
以下是此规则的错误代码示例:
js
const thing = 123;
afterAll(() => {});以下是此规则的正确代码示例:
js
const thing = 123;
afterAll(() => {});如何使用
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["jest"],
"rules": {
"jest/padding-around-after-all-blocks": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["jest"],
rules: {
"jest/padding-around-after-all-blocks": "error",
},
});bash
oxlint --deny jest/padding-around-after-all-blocks --jest-plugin版本
此规则于 v1.59.0 中添加。
