Skip to content

Commit dee1802

Browse files
committed
Minor docs tweaks
1 parent 34ead70 commit dee1802

30 files changed

+21
-83
lines changed

docs/new-rule.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/main/fr_FR/rela
77
- [Read the ESLint docs on creating a new rule.](https://eslint.org/docs/developer-guide/working-with-rules)
88
- Look at the commit for how previous rules were added as inspiration. For example, the [`no-async-fn-without-await` rule](https://github.com/avajs/eslint-plugin-ava/commit/a443d7a9c94165f42749938e6b491a7c10749b6c).
99

10-
1110
## Tip
1211

1312
Use the [`astexplorer` site](https://astexplorer.net) with the `espree` parser and `ESLint v4` transform to interactively create the initial rule implementation. It lets you inspect the full AST as you would get from ESLint and you can even see the result of your auto-fixer implementation.
1413

15-
1614
## Steps
1715

1816
- Go to the `test` directory and duplicate the `no-todo-test.js` file and rename it to the name of your rule. Then write some tests before starting to implement the rule.
@@ -22,7 +20,7 @@ Use the [`astexplorer` site](https://astexplorer.net) with the `espree` parser a
2220
- Add the rule in alphabetically sorted order to:
2321
- [The recommended config](https://github.com/avajs/eslint-plugin-ava/blob/0ded4b5c3cd09504e846309760566c9499a24196/index.js#L19)
2422
- [The recommended config in the readme](https://github.com/avajs/eslint-plugin-ava/blame/0ded4b5c3cd09504e846309760566c9499a24196/readme.md#L35)
25-
- [The rule listing in the readme](https://github.com/avajs/eslint-plugin-ava/blame/0ded4b5c3cd09504e846309760566c9499a24196/readme.md#L73)<br>
23+
- [The rule listing in the readme](https://github.com/avajs/eslint-plugin-ava/blame/0ded4b5c3cd09504e846309760566c9499a24196/readme.md#L73)\
2624
*(The description should be the same as the heading of the documentation file).*
2725
- Run `$ npm test` to ensure the tests pass.
2826
- Run `$ npm run integration` to run the rules against real projects to ensure your rule does not fail on real-world code.

docs/rules/assertion-arguments.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,44 @@ This rule also attempts to enforce passing actual values before expected values.
1313
```js
1414
const test = require('ava');
1515

16-
test(t => {
16+
test('1', t => {
1717
t.is(value); // Not enough arguments
1818
t.is(value, expected, message, extra); // Too many arguments
1919
t.is(value, expected, false); // Assertion message is not a string
2020
});
2121

2222
/* eslint ava/assertion-arguments: ["error", {"message": "always"}] */
23-
test(t => {
23+
test('2', t => {
2424
t.true(array.includes(value));
2525
});
2626

2727
/* eslint ava/assertion-arguments: ["error", {"message": "never"}] */
28-
test(t => {
28+
test('3', t => {
2929
t.true(array.includes(value), 'value is not in array');
3030
});
3131
```
3232

33-
3433
## Pass
3534

3635
```js
3736
const test = require('ava');
3837

39-
test(t => {
38+
test('1', t => {
4039
t.is(value, expected);
4140
t.is(value, expected, message);
4241
});
4342

4443
/* eslint ava/assertion-arguments: ["error", {"message": "always"}] */
45-
test(t => {
44+
test('2', t => {
4645
t.true(array.includes(value), 'value is not in array');
4746
});
4847

4948
/* eslint ava/assertion-arguments: ["error", {"message": "never"}] */
50-
test(t => {
49+
test('3', t => {
5150
t.true(array.includes(value));
5251
});
5352
```
5453

55-
5654
## Options
5755

5856
This rule supports the following options:

docs/rules/hooks-order.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Hooks should be placed before any tests and in the proper semantic order:
1414

1515
This rule is fixable as long as no other code is between the hooks that need to be reordered.
1616

17-
1817
## Fail
1918

2019
```js
@@ -45,7 +44,6 @@ test.before(t => {
4544
});
4645
```
4746

48-
4947
## Pass
5048

5149
```js

docs/rules/max-asserts.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Limit the amount of assertions in a test to enforce splitting up large tests int
66

77
Skipped assertions are counted.
88

9-
109
## Fail
1110

1211
```js
@@ -26,7 +25,6 @@ test('getSomeObject should define the players\' names', t => {
2625
});
2726
```
2827

29-
3028
## Pass
3129

3230
```js

docs/rules/no-async-fn-without-await.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,24 @@ Declaring an async test without using the `await` keyword means that either a Pr
88

99
This rule will report an error when it finds an async test which does not use the `await` keyword.
1010

11-
1211
## Fail
1312

1413
```js
1514
const test = require('ava');
1615

17-
test(async t => {
16+
test('foo', async t => {
1817
return foo().then(res => {
1918
t.is(res, 1);
2019
});
2120
});
2221
```
2322

24-
2523
## Pass
2624

2725
```js
2826
const test = require('ava');
2927

30-
test(async t => {
28+
test('foo', async t => {
3129
t.is(await foo(), 1);
3230
});
3331
```

docs/rules/no-cb-test.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/main/fr_FR/rela
44

55
Disallow the use of `test.cb()`. We instead recommend using `test()` with an async function or a function returning a promise.
66

7-
87
## Fail
98

109
```js
@@ -16,7 +15,6 @@ test.cb('some test', t => {
1615
});
1716
```
1817

19-
2018
## Pass
2119

2220
```js

docs/rules/no-duplicate-modifiers.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/main/fr_FR/rela
44

55
Prevent the use of duplicate [test modifiers](https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md).
66

7-
87
## Fail
98

109
```js
@@ -17,7 +16,6 @@ test.beforeEach.beforeEach(t => {});
1716
test.only.only.cb(t => {});
1817
```
1918

20-
2119
## Pass
2220

2321
```js

docs/rules/no-identical-title.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/main/fr_FR/rela
44

55
Disallow tests with identical titles as it makes it hard to differentiate them.
66

7-
87
## Fail
98

109
```js
@@ -19,16 +18,11 @@ test('foo', t => {
1918
});
2019
```
2120

22-
2321
## Pass
2422

2523
```js
2624
const test = require('ava');
2725

28-
test(t => {
29-
t.pass();
30-
});
31-
3226
test('foo', t => {
3327
t.pass();
3428
});

docs/rules/no-ignored-test-files.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/main/fr_FR/rela
44

55
This rule will verify that files which create tests are treated as test files by AVA. It will consider the root of the project to be the closest folder containing a `package.json` file, and will not do anything if it can't find one. Test files in `node_modules` will not be linted as they are ignored by ESLint.
66

7-
87
## Fail
98

109
```js
@@ -25,7 +24,6 @@ test('foo', t => {
2524
});
2625
```
2726

28-
2927
## Pass
3028

3129
```js

docs/rules/no-import-test-files.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/main/fr_FR/rela
44

55
This rule will verify that you don't import any test files. It will consider the root of the project to be the closest folder containing a `package.json` file, and will not do anything if it can't find one. Test files in `node_modules` will not be linted as they are ignored by ESLint.
66

7-
87
## Fail
98

109
```js
@@ -23,7 +22,6 @@ test('foo', t => {
2322
});
2423
```
2524

26-
2725
## Pass
2826

2927
```js

0 commit comments

Comments
 (0)