Skip to content

Commit

Permalink
docs: Add documentation for padding-around-after-all-blocks rule (#622)
Browse files Browse the repository at this point in the history
* refactor: remove @ts-ignore

* docs: add padding-around-after-all-blocks docs

* docs: update README
  • Loading branch information
y-hsgw authored Dec 28, 2024
1 parent 3023345 commit f99d6e2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export default [
| [no-standalone-expect](docs/rules/no-standalone-expect.md) | disallow using `expect` outside of `it` or `test` blocks | | 🌐 | | | |
| [no-test-prefixes](docs/rules/no-test-prefixes.md) | disallow using `test` as a prefix | | 🌐 | 🔧 | | |
| [no-test-return-statement](docs/rules/no-test-return-statement.md) | disallow return statements in tests | | 🌐 | | | |
| [padding-around-after-all-blocks](docs/rules/padding-around-after-all-blocks.md) | enforce padding around `afterAll` blocks | | 🌐 | 🔧 | | |
| [prefer-called-with](docs/rules/prefer-called-with.md) | enforce using `toBeCalledWith()` or `toHaveBeenCalledWith()` | | 🌐 | 🔧 | | |
| [prefer-comparison-matcher](docs/rules/prefer-comparison-matcher.md) | enforce using the built-in comparison matchers | | 🌐 | 🔧 | | |
| [prefer-each](docs/rules/prefer-each.md) | enforce using `each` rather than manual loops | | 🌐 | | | |
Expand Down
33 changes: 33 additions & 0 deletions docs/rules/padding-around-after-all-blocks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Enforce padding around `afterAll` blocks (`vitest/padding-around-after-all-blocks`)

⚠️ This rule _warns_ in the 🌐 `all` config.

🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end auto-generated rule header -->

## Rule Details

This rule enforces a line of padding before _and_ after 1 or more `afterAll`
statements.

Note that it doesn't add/enforce a padding line if it's the last statement in
its scope.

Examples of **incorrect** code for this rule:

```js
const someText = 'hoge';
afterAll(() => {});
describe('foo', () => {});
```

Examples of **correct** code for this rule:

```js
const someText = 'hoge';

afterAll(() => {});

describe('foo', () => {});
```
9 changes: 4 additions & 5 deletions src/rules/no-standalone-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ export default createEslintRule<Options, MESSAGE_IDS>({
},
schema: [
{
type: 'object',
properties: {
additionaltestblockfunctions: {
// @ts-ignore
additionalTestBlockFunctions: {
type: 'array',
// @ts-ignore
items: { type: `string` }
items: { type: 'string' }
}
},
additionalproperties: false
additionalProperties: false
}
]
},
Expand Down

0 comments on commit f99d6e2

Please sign in to comment.