Skip to content

Commit

Permalink
Merge pull request #306 from ddzz/add-markdownlint
Browse files Browse the repository at this point in the history
Add `markdownlint` and fix linting issues
  • Loading branch information
lo1tuma authored Dec 8, 2021
2 parents dfdd589 + c6bbe6b commit 9bd07d1
Show file tree
Hide file tree
Showing 12 changed files with 418 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm ci
- name: Run linters
run: yarn pretest && yarn lint:docs
- name: Run tests
run: npm test
timeout-minutes: 20
Expand Down
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"line-length": false,
"first-line-h1": false
}
2 changes: 2 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CHANGELOG.md
node_modules
1 change: 1 addition & 0 deletions docs/rules/handle-done-callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ before(function (done) {
});
});
```

## Options

This rule supports the following options:
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-empty-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Example of a custom rule configuration:
message: 'custom error message'
} ]
}
```
```
1 change: 0 additions & 1 deletion docs/rules/no-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ This rule supports the following options:
}
```


## When Not To Use It

* If you use another library which exposes a similar API as mocha (e.g. `before`, `after`), you should turn this rule off, because it would raise warnings.
1 change: 1 addition & 0 deletions docs/rules/no-nested-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ it('something', function () {
});
});
```

Something like this could easily happen by accident where the outer test case was actually meant to be a suite instead of a test.
This rule reports such nested test cases in order to prevent problems where those nested tests are skipped silently.

Expand Down
10 changes: 5 additions & 5 deletions docs/rules/no-synchronous-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ rules: {
},
```

### Caveats:
### Caveats

This rule cannot guarantee that a returned function call is actually a promise, it only confirms that the return was made.

Expand All @@ -65,10 +65,10 @@ it('test name', myTestFn);

## When Not To Use It

* If you are primarily writing synchronous tests, and rarely need the `done` callback, promise functionality or async functions.
- If you are primarily writing synchronous tests, and rarely need the `done` callback, promise functionality or async functions.

## Further Reading

* [Synchronous Code](http://mochajs.org/#synchronous-code)
* [Asynchronous Code](http://mochajs.org/#asynchronous-code)
* [Working with Promises](http://mochajs.org/#working-with-promises)
- [Synchronous Code](http://mochajs.org/#synchronous-code)
- [Asynchronous Code](http://mochajs.org/#asynchronous-code)
- [Working with Promises](http://mochajs.org/#working-with-promises)
4 changes: 2 additions & 2 deletions docs/rules/valid-suite-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ rules: {

where:

* `warn` is a rule error level (see [Configuring Rules](http://eslint.org/docs/user-guide/configuring#configuring-rules))
* `^[A-Z]` is a custom regular expression pattern to match suite names against; `^[A-Z]` enforces a suite name to start with an upper-case letter
* `warn` is a rule error level (see [Configuring Rules](http://eslint.org/docs/user-guide/configuring#configuring-rules))
* `^[A-Z]` is a custom regular expression pattern to match suite names against; `^[A-Z]` enforces a suite name to start with an upper-case letter

The following patterns are considered warnings (with the example rule configuration posted above):

Expand Down
8 changes: 4 additions & 4 deletions docs/rules/valid-test-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Example of a custom rule configuration:

where:

* `warn` is a rule error level (see [Configuring Rules](http://eslint.org/docs/user-guide/configuring#configuring-rules))
* `mypattern$` is a custom regular expression pattern to match test names against
* `["it", "specify", "test", "mytestname"]` is an array of custom test names
* `custom error message` a custom error message to describe your pattern
* `warn` is a rule error level (see [Configuring Rules](http://eslint.org/docs/user-guide/configuring#configuring-rules))
* `mypattern$` is a custom regular expression pattern to match test names against
* `["it", "specify", "test", "mytestname"]` is an array of custom test names
* `custom error message` a custom error message to describe your pattern

The following patterns are considered warnings (with the default rule configuration):

Expand Down
Loading

0 comments on commit 9bd07d1

Please sign in to comment.