-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add documentation for padding-around-related rules (#623)
* docs: add padding-around-after-each-blocks docs * docs: add padding-around-before-all-blocks docs * docs: add padding-around-before-each-blocks docs * docs: add padding-around-describe-blocks docs * docs: add padding-around-test-blocks docs * docs: add padding-around-expect-groups docs * docs: add padding-around-all docs * docs: update README
- Loading branch information
Showing
9 changed files
with
246 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Enforce padding around `afterEach` blocks (`vitest/padding-around-after-each-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 `afterEach` | ||
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'; | ||
afterEach(() => {}); | ||
describe('foo', () => {}); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
const someText = 'hoge'; | ||
|
||
afterEach(() => {}); | ||
|
||
describe('foo', () => {}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Enforce padding around vitest functions (`vitest/padding-around-all`) | ||
|
||
⚠️ 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 is a meta rule that simply enables all of the following rules: | ||
|
||
- [padding-around-after-all-blocks](padding-around-after-all-blocks.md) | ||
- [padding-around-after-each-blocks](padding-around-after-each-blocks.md) | ||
- [padding-around-before-all-blocks](padding-around-before-all-blocks.md) | ||
- [padding-around-before-each-blocks](padding-around-before-each-blocks.md) | ||
- [padding-around-expect-groups](padding-around-expect-groups.md) | ||
- [padding-around-describe-blocks](padding-around-describe-blocks.md) | ||
- [padding-around-test-blocks](padding-around-test-blocks.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Enforce padding around `beforeAll` blocks (`vitest/padding-around-before-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 `beforeAll` | ||
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'; | ||
beforeAll(() => {}); | ||
describe('foo', () => {}); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
const someText = 'hoge'; | ||
|
||
beforeAll(() => {}); | ||
|
||
describe('foo', () => {}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Enforce padding around `beforeEach` blocks (`vitest/padding-around-before-each-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 `beforeEach` | ||
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'; | ||
beforeEach(() => {}); | ||
describe('foo', () => {}); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
const someText = 'hoge'; | ||
|
||
beforeEach(() => {}); | ||
|
||
describe('foo', () => {}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Enforce padding around `describe` blocks (`vitest/padding-around-describe-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 `describe` | ||
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'; | ||
describe("hoge" () => {}); | ||
describe('foo', () => {}); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
const someText = 'hoge'; | ||
|
||
describe("hoge" () => {}); | ||
|
||
describe('foo', () => {}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Enforce padding around `expect` groups (`vitest/padding-around-expect-groups`) | ||
|
||
⚠️ 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 `expect` | ||
statements. | ||
|
||
Note that it doesn't add/enforce a padding line if it's the last statement in | ||
its scope and it doesn't add/enforce padding between two or more adjacent expect statements. | ||
|
||
Examples of **incorrect** code for this rule: | ||
|
||
```js | ||
test('test', () => { | ||
let abc = 123; | ||
expect(abc).toEqual(123); | ||
expect(123).toEqual(abc); | ||
abc = 456; | ||
expect(abc).toEqual(456); | ||
}); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
test('test', () => { | ||
let abc = 123; | ||
|
||
expect(abc).toEqual(123); | ||
expect(123).toEqual(abc); | ||
|
||
abc = 456; | ||
|
||
expect(abc).toEqual(456); | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Enforce padding around `test` blocks (`vitest/padding-around-test-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 `test/it` | ||
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'; | ||
test("hoge" () => {}); | ||
test('foo', () => {}); | ||
``` | ||
|
||
```js | ||
const someText = 'hoge'; | ||
it("hoge" () => {}); | ||
it('foo', () => {}); | ||
``` | ||
|
||
Examples of **correct** code for this rule: | ||
|
||
```js | ||
const someText = 'hoge'; | ||
|
||
test("hoge" () => {}); | ||
|
||
test('foo', () => {}); | ||
``` | ||
|
||
```js | ||
const someText = 'hoge'; | ||
|
||
it("hoge" () => {}); | ||
|
||
it('foo', () => {}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters