Skip to content

Separate padding-around-expect-groups from block-related padding rules #726

@TrevorBurnham

Description

@TrevorBurnham

First of all, a small documentation issue: The padding-around-test-blocks rule isn't listed in the README.


I'd like to suggest ergonomic improvements for the block padding rules. There are 6 separate padding-around-*-blocks rules. There's also a padding-around-expect-groups rule, which is similarly named but categorically different. Speaking for myself, I find the block padding rules commonsensical, but the expect group padding rule a bit heavy-handed. Unfortunately, enabling the block padding rules requires 6 separate rule declarations:

"vitest/padding-around-after-all-blocks": "warn",
"vitest/padding-around-after-each-blocks": "warn",
"vitest/padding-around-before-all-blocks": "warn",
"vitest/padding-around-before-each-blocks": "warn",
"vitest/padding-around-describe-blocks": "warn",
"vitest/padding-around-test-blocks": "warn",

I thought I could perhaps subtract from the padding-around-all meta-rule, but when I tried that, ESLint seemed to ignore the "off" switch:

"vitest/padding-around-all": "warn",
"vitest/padding-around-expect-groups": "off",

So for now, I'm enabling the 6 block padding rules individually.

The simplest solution would be to add a padding-around-all-blocks meta-rule. If backward compatibility weren't a concern, I would suggest consolidating all of the block padding rules into a single rule, with options to allow it to be enabled for a subset of block types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions