Skip to content

feat(linter/vitest): Implement padding-around-after-all-blocks rule#21788

Merged
camchenry merged 9 commits into
oxc-project:mainfrom
kapobajza:feat-linter-rule/vitest-padding_around_after_all_blocks
May 16, 2026
Merged

feat(linter/vitest): Implement padding-around-after-all-blocks rule#21788
camchenry merged 9 commits into
oxc-project:mainfrom
kapobajza:feat-linter-rule/vitest-padding_around_after_all_blocks

Conversation

@kapobajza

@kapobajza kapobajza commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Related to: #4656

Summary

Implements the vitest/padding-around-after-all-blocks linter rule, which enforces a blank line of padding before afterAll blocks in test files. Ports the rule from eslint-plugin-vitest.

AI disclosure

I used Claude Code to help me with onboarding, since I am unfamiliar with the code. It explained to me how certain things like run_on_jest_node, report_missing_padding_before_jest_block, and other things work under the hood. I also used it to help me with generating additional test cases for this rule.
And it also generated this PR description for me as well, based on the file changes.

Description

This rule helps keep test files readable by visually separating afterAll hooks from surrounding code.

Incorrect:

const thing = 123;
afterAll(() => {});

Correct:

const thing = 123;

afterAll(() => {});

The rule:

  • Category: style
  • Plugin: vitest
  • Auto-fixable: yes (inserts the missing blank line)
  • Runs on Jest/Vitest nodes via run_on_jest_node, filters to Hook kind calls named afterAll, and delegates reporting to the shared report_missing_padding_before_jest_block helper.

@kapobajza kapobajza requested a review from camc314 as a code owner April 26, 2026 15:08
Comment thread crates/oxc_linter/src/rules/vitest/padding_around_after_all_blocks.rs Outdated
@codspeed-hq

codspeed-hq Bot commented Apr 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing kapobajza:feat-linter-rule/vitest-padding_around_after_all_blocks (4bbcf1e) with main (118194a)2

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (f034229) during the generation of this report, so 118194a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@camc314 camc314 self-assigned this Apr 27, 2026
@camc314 camc314 changed the title feat(linter): Implement vitest/padding_around_after_all_blocks rule feat(linter/vitest): Implement padding-around-after-all-blocks rule Apr 27, 2026
@kapobajza

Copy link
Copy Markdown
Contributor Author

@camc314 bumping this. So that the PR doesn't get stale

@camc314 camc314 added the A-linter Area - Linter label May 7, 2026
@camchenry camchenry self-assigned this May 12, 2026
@kapobajza kapobajza requested a review from overlookmotel as a code owner May 16, 2026 11:00

@camchenry camchenry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@camchenry camchenry merged commit 625758a into oxc-project:main May 16, 2026
28 checks passed
camc314 pushed a commit that referenced this pull request May 18, 2026
# Oxlint
### 🚀 Features

- 1ae291e linter/no-underscore-dangle: Add `allowInUsingDeclarations`
option (#22483) (吴杨帆)
- 0440b0f linter/eslint: Implement `id-match` rule (#22379) (Vladislav
Sayapin)
- 65bf119 linter: Implement react no-object-type-as-default-prop
(#22481) (uhyo)
- 2a6ddce linter/eslint: Implement `no-implied-eval` rule (#22391)
(Vladislav Sayapin)
- d3a3c1d linter: Auto detect agents from CLI and transition to the
agent output format (#22068) (Jovi De Croock)
- 625758a linter/vitest: Implement padding-around-after-all-blocks rule
(#21788) (kapobajza)
- 37680b0 linter: Implement react no-unstable-nested-components (#22248)
(Jovi De Croock)
- d8d9c74 linter: Implement import/newline-after-import rule (#19142)
(Ryuya Yanagi)

### 🐛 Bug Fixes

- 3f59e03 linter: Only call rayon/miette/tracing inits once (#21899)
(Matiss Janis Aboltins)
- 602dfd6 linter/promise/no-return-wrap: Detect Promise calls in all
branches (#22474) (zennnnnnn11)
- e182aee linter: Allow dialogs and popovers for no_autofocus (#22289)
(mehm8128)
- 7ffb710 linter/jest/vitest: Jest/no-standalone-expect ignores
additionalTestBlockFunctions option for jest/vitest hooks (#22477)
(kapobajza)
- c6f2d3f linter: Add more expression support for iframe-has-title
(#22460) (mehm8128)
- 5747ff1 linter: Avoid enabling jest with vitest plugin (#22499)
(camc314)
- 863984f linter/no-find-dom-node: Run on all files (#22479) (bab)

### ⚡ Performance

- 2afef79 linter: Optimize `no-loop-func` (#22491) (camchenry)
- 4c9ca72 oxlint: Align walker thread count with rayon pool (#22494)
(Boshen)

### 📚 Documentation

- f7967c7 linter/id-match: Clarify `onlyDeclarations` config docs
(#22523) (camc314)
- 1e0c97f linter: Fix closing code block in documentation for
`padding-around-after-all-blocks` rule. (#22513) (connorshea)
- a9049fd linter: Exclude directly provide autoFocus to dialog pattern
(#22510) (mehm8128)
# Oxfmt
### 🐛 Bug Fixes

- 8ee946f formatter/sort_imports: Use label to classify lines (#22512)
(leaysgur)
- 8c1da44 formatter: Normalize destructuring keys in DCR (#22478)
(camc314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants