Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate docs with eslint-doc-generator #242

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:

- run: npm ci
- run: npm test
- run: npm run update && git diff --exit-code
- run: npm install --save-dev eslint@7 && npm run unit-test

- name: Coveralls
Expand Down
100 changes: 49 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,55 @@ For more details on how to extend your configuration from a plugin configuration

## Rules

Each rule has emojis denoting:

* What configuration it belongs to
* 🔧 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
* 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)

<!--RULES_TABLE_START-->

| Name | Description | ✅ | 🔧 | 💡 |
|:--------|:--------|:---|:---|:---|
| [assert-args](./docs/rules/assert-args.md) | enforce that the correct number of assert arguments are used | ✅ | | |
| [literal-compare-order](./docs/rules/literal-compare-order.md) | enforce comparison assertions have arguments in the right order | ✅ | 🔧 | |
| [no-arrow-tests](./docs/rules/no-arrow-tests.md) | disallow arrow functions as QUnit test/module callbacks | | 🔧 | |
| [no-assert-equal](./docs/rules/no-assert-equal.md) | disallow the use of assert.equal | ✅ | | 💡 |
| [no-assert-equal-boolean](./docs/rules/no-assert-equal-boolean.md) | require use of boolean assertions | ✅ | 🔧 | |
| [no-assert-logical-expression](./docs/rules/no-assert-logical-expression.md) | disallow binary logical expressions in assert arguments | ✅ | | |
| [no-assert-ok](./docs/rules/no-assert-ok.md) | disallow the use of assert.ok/assert.notOk | | | |
| [no-async-in-loops](./docs/rules/no-async-in-loops.md) | disallow async calls in loops | ✅ | | |
| [no-async-module-callbacks](./docs/rules/no-async-module-callbacks.md) | disallow async module callbacks | ✅ | | |
| [no-async-test](./docs/rules/no-async-test.md) | disallow the use of asyncTest or QUnit.asyncTest | ✅ | | |
| [no-commented-tests](./docs/rules/no-commented-tests.md) | disallow commented tests | ✅ | | |
| [no-compare-relation-boolean](./docs/rules/no-compare-relation-boolean.md) | disallow comparing relational expressions to booleans in assertions | ✅ | 🔧 | |
| [no-conditional-assertions](./docs/rules/no-conditional-assertions.md) | disallow assertions within if statements or conditional expressions | ✅ | | |
| [no-early-return](./docs/rules/no-early-return.md) | disallow early return in tests | ✅ | | |
| [no-global-assertions](./docs/rules/no-global-assertions.md) | disallow global QUnit assertions | ✅ | | |
| [no-global-expect](./docs/rules/no-global-expect.md) | disallow global expect | ✅ | | |
| [no-global-module-test](./docs/rules/no-global-module-test.md) | disallow global module/test/asyncTest | ✅ | | |
| [no-global-stop-start](./docs/rules/no-global-stop-start.md) | disallow global stop/start | ✅ | | |
| [no-hooks-from-ancestor-modules](./docs/rules/no-hooks-from-ancestor-modules.md) | disallow the use of hooks from ancestor modules | ✅ | | |
| [no-identical-names](./docs/rules/no-identical-names.md) | disallow identical test and module names | ✅ | | |
| [no-init](./docs/rules/no-init.md) | disallow use of QUnit.init | ✅ | | |
| [no-jsdump](./docs/rules/no-jsdump.md) | disallow use of QUnit.jsDump | ✅ | | |
| [no-loose-assertions](./docs/rules/no-loose-assertions.md) | disallow the use of assert.equal/assert.ok/assert.notEqual/assert.notOk | | | |
| [no-negated-ok](./docs/rules/no-negated-ok.md) | disallow negation in assert.ok/assert.notOk | ✅ | 🔧 | |
| [no-nested-tests](./docs/rules/no-nested-tests.md) | disallow nested QUnit.test() calls | ✅ | | |
| [no-ok-equality](./docs/rules/no-ok-equality.md) | disallow equality comparisons in assert.ok/assert.notOk | ✅ | 🔧 | |
| [no-only](./docs/rules/no-only.md) | disallow QUnit.only | ✅ | | |
| [no-qunit-push](./docs/rules/no-qunit-push.md) | disallow QUnit.push | ✅ | | |
| [no-qunit-start-in-tests](./docs/rules/no-qunit-start-in-tests.md) | disallow QUnit.start() within tests or test hooks | ✅ | | |
| [no-qunit-stop](./docs/rules/no-qunit-stop.md) | disallow QUnit.stop | ✅ | | |
| [no-reassign-log-callbacks](./docs/rules/no-reassign-log-callbacks.md) | disallow overwriting of QUnit logging callbacks | ✅ | | |
| [no-reset](./docs/rules/no-reset.md) | disallow QUnit.reset | ✅ | | |
| [no-setup-teardown](./docs/rules/no-setup-teardown.md) | disallow setup/teardown module hooks | ✅ | 🔧 | |
| [no-skip](./docs/rules/no-skip.md) | disallow QUnit.skip | | | |
| [no-test-expect-argument](./docs/rules/no-test-expect-argument.md) | disallow the expect argument in QUnit.test | ✅ | | |
| [no-throws-string](./docs/rules/no-throws-string.md) | disallow assert.throws() with block, string, and message args | ✅ | | |
| [require-expect](./docs/rules/require-expect.md) | enforce that `expect` is called | ✅ | | |
| [require-object-in-propequal](./docs/rules/require-object-in-propequal.md) | enforce use of objects as expected value in `assert.propEqual` | ✅ | | |
| [resolve-async](./docs/rules/resolve-async.md) | require that async calls are resolved | ✅ | | |

<!--RULES_TABLE_END-->
<!-- begin rules list -->

✅ Enabled in the `recommended` [configuration](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).\
🔧 Fixable with [`eslint --fix`](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).\
💡 Provides editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

| Rule | Description | ✅ | 🔧 | 💡 |
| ------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | --- | --- | --- |
| [assert-args](docs/rules/assert-args.md) | enforce that the correct number of assert arguments are used | ✅ | | |
| [literal-compare-order](docs/rules/literal-compare-order.md) | enforce comparison assertions have arguments in the right order | ✅ | 🔧 | |
| [no-arrow-tests](docs/rules/no-arrow-tests.md) | disallow arrow functions as QUnit test/module callbacks | | 🔧 | |
| [no-assert-equal](docs/rules/no-assert-equal.md) | disallow the use of assert.equal | ✅ | | 💡 |
| [no-assert-equal-boolean](docs/rules/no-assert-equal-boolean.md) | require use of boolean assertions | ✅ | 🔧 | |
| [no-assert-logical-expression](docs/rules/no-assert-logical-expression.md) | disallow binary logical expressions in assert arguments | ✅ | | |
| [no-assert-ok](docs/rules/no-assert-ok.md) | disallow the use of assert.ok/assert.notOk | | | |
| [no-async-in-loops](docs/rules/no-async-in-loops.md) | disallow async calls in loops | ✅ | | |
| [no-async-module-callbacks](docs/rules/no-async-module-callbacks.md) | disallow async module callbacks | ✅ | | |
| [no-async-test](docs/rules/no-async-test.md) | disallow the use of asyncTest or QUnit.asyncTest | ✅ | | |
| [no-commented-tests](docs/rules/no-commented-tests.md) | disallow commented tests | ✅ | | |
| [no-compare-relation-boolean](docs/rules/no-compare-relation-boolean.md) | disallow comparing relational expressions to booleans in assertions | ✅ | 🔧 | |
| [no-conditional-assertions](docs/rules/no-conditional-assertions.md) | disallow assertions within if statements or conditional expressions | ✅ | | |
| [no-early-return](docs/rules/no-early-return.md) | disallow early return in tests | ✅ | | |
| [no-global-assertions](docs/rules/no-global-assertions.md) | disallow global QUnit assertions | ✅ | | |
| [no-global-expect](docs/rules/no-global-expect.md) | disallow global expect | ✅ | | |
| [no-global-module-test](docs/rules/no-global-module-test.md) | disallow global module/test/asyncTest | ✅ | | |
| [no-global-stop-start](docs/rules/no-global-stop-start.md) | disallow global stop/start | ✅ | | |
| [no-hooks-from-ancestor-modules](docs/rules/no-hooks-from-ancestor-modules.md) | disallow the use of hooks from ancestor modules | ✅ | | |
| [no-identical-names](docs/rules/no-identical-names.md) | disallow identical test and module names | ✅ | | |
| [no-init](docs/rules/no-init.md) | disallow use of QUnit.init | ✅ | | |
| [no-jsdump](docs/rules/no-jsdump.md) | disallow use of QUnit.jsDump | ✅ | | |
| [no-loose-assertions](docs/rules/no-loose-assertions.md) | disallow the use of assert.equal/assert.ok/assert.notEqual/assert.notOk | | | |
| [no-negated-ok](docs/rules/no-negated-ok.md) | disallow negation in assert.ok/assert.notOk | ✅ | 🔧 | |
| [no-nested-tests](docs/rules/no-nested-tests.md) | disallow nested QUnit.test() calls | ✅ | | |
| [no-ok-equality](docs/rules/no-ok-equality.md) | disallow equality comparisons in assert.ok/assert.notOk | ✅ | 🔧 | |
| [no-only](docs/rules/no-only.md) | disallow QUnit.only | ✅ | | |
| [no-qunit-push](docs/rules/no-qunit-push.md) | disallow QUnit.push | ✅ | | |
| [no-qunit-start-in-tests](docs/rules/no-qunit-start-in-tests.md) | disallow QUnit.start() within tests or test hooks | ✅ | | |
| [no-qunit-stop](docs/rules/no-qunit-stop.md) | disallow QUnit.stop | ✅ | | |
| [no-reassign-log-callbacks](docs/rules/no-reassign-log-callbacks.md) | disallow overwriting of QUnit logging callbacks | ✅ | | |
| [no-reset](docs/rules/no-reset.md) | disallow QUnit.reset | ✅ | | |
| [no-setup-teardown](docs/rules/no-setup-teardown.md) | disallow setup/teardown module hooks | ✅ | 🔧 | |
| [no-skip](docs/rules/no-skip.md) | disallow QUnit.skip | | | |
| [no-test-expect-argument](docs/rules/no-test-expect-argument.md) | disallow the expect argument in QUnit.test | ✅ | | |
| [no-throws-string](docs/rules/no-throws-string.md) | disallow assert.throws() with block, string, and message args | ✅ | | |
| [require-expect](docs/rules/require-expect.md) | enforce that `expect` is called | ✅ | | |
| [require-object-in-propequal](docs/rules/require-object-in-propequal.md) | enforce use of objects as expected value in `assert.propEqual` | ✅ | | |
| [resolve-async](docs/rules/resolve-async.md) | require that async calls are resolved | ✅ | | |

<!-- end rules list -->

## Contributors

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/assert-args.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Enforce that the correct number of assert arguments are used (assert-args)
# Enforce that the correct number of assert arguments are used (`qunit/assert-args`)

✅ The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
✅ This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

<!-- end rule header -->

QUnit's assertions expect a certain number of arguments based on what sort of
condition is being evaluated.
Expand Down
8 changes: 5 additions & 3 deletions docs/rules/literal-compare-order.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Enforce comparison assertions have arguments in the right order (literal-compare-order)
# Enforce comparison assertions have arguments in the right order (`qunit/literal-compare-order`)

The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
🔧 This rule is automatically fixable using the `--fix` [option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.

<!-- end rule header -->

QUnit's many comparison assertions (`equal`, `strictEqual`, etc.) distinguish
between an expected value and an actual value, and report incorrect assertions
Expand Down
6 changes: 4 additions & 2 deletions docs/rules/no-arrow-tests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow arrow functions as QUnit test/module callbacks (no-arrow-tests)
# Disallow arrow functions as QUnit test/module callbacks (`qunit/no-arrow-tests`)

🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
🔧 This rule is automatically fixable using the `--fix` [option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.

<!-- end rule header -->

QUnit test and module callbacks can share state by modifying properties of
`this` within those callbacks.
Expand Down
8 changes: 5 additions & 3 deletions docs/rules/no-assert-equal-boolean.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Require use of boolean assertions (no-assert-equal-boolean)
# Require use of boolean assertions (`qunit/no-assert-equal-boolean`)

The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

🔧 The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
🔧 This rule is automatically fixable using the `--fix` [option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.

<!-- end rule header -->

The boolean assertion functions `assert.true()` and `assert.false()` are available as of QUnit 2.11. These assertions can be stricter and clearer about intent when compared to using other assertion functions for boolean comparisons.

Expand Down
8 changes: 5 additions & 3 deletions docs/rules/no-assert-equal.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Disallow the use of assert.equal (no-assert-equal)
# Disallow the use of assert.equal (`qunit/no-assert-equal`)

The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

💡 Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
💡 This rule provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions) that can be applied manually.

<!-- end rule header -->

The `assert.equal` assertion method in QUnit uses loose equality comparison. In a project which favors strict equality comparison, it is better to use `assert.strictEqual` for scalar values and either `assert.deepEqual` or `assert.propEqual` for more complex objects.

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/no-assert-logical-expression.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow binary logical expressions in assert arguments (no-assert-logical-expression)
# Disallow binary logical expressions in assert arguments (`qunit/no-assert-logical-expression`)

✅ The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
✅ This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

<!-- end rule header -->

Generally, it is not a good idea to use logical expressions as assertion arguments. Logical-and assertions can be broken down into multiple assertions, while logical-or assertions may be indicative of uncertainty or nondeterminism in a test.

Expand Down
4 changes: 3 additions & 1 deletion docs/rules/no-assert-ok.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Disallow the use of assert.ok/assert.notOk (no-assert-ok)
# Disallow the use of assert.ok/assert.notOk (`qunit/no-assert-ok`)

<!-- end rule header -->

`assert.ok` and `assert.notOk` pass for any truthy/falsy argument. As [many expressions evaluate to true/false in JavaScript](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) the usage of `assert.ok` is potentially error prone. In general, it should be advisable to always test for exact values in tests which makes tests a lot more solid.

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/no-async-in-loops.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow async calls in loops (no-async-in-loops)
# Disallow async calls in loops (`qunit/no-async-in-loops`)

✅ The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
✅ This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

<!-- end rule header -->

Asynchronous operations are much harder to reason about in loops. To increase
maintainability, asynchronous operations should not be placed within loops.
Expand Down
6 changes: 4 additions & 2 deletions docs/rules/no-async-module-callbacks.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow async module callbacks (no-async-module-callbacks)
# Disallow async module callbacks (`qunit/no-async-module-callbacks`)

✅ The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
✅ This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

<!-- end rule header -->

QUnit does not support async module callbacks. Only test and hook callbacks
will work as expected when using `async` and `await`. Code after an `await`
Expand Down
6 changes: 4 additions & 2 deletions docs/rules/no-async-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Disallow the use of asyncTest or QUnit.asyncTest (no-async-test)
# Disallow the use of asyncTest or QUnit.asyncTest (`qunit/no-async-test`)

✅ The `"extends": "plugin:qunit/recommended"` property in a configuration file enables this rule.
✅ This rule is enabled in the `recommended` [config](https://github.com/platinumazure/eslint-plugin-qunit/blob/master/README.md#configurations).

<!-- end rule header -->

QUnit 2.0 is deprecating `QUnit.asyncTest()` in favor of `assert.async()` within tests. This rule will flag `asyncTest` and `QUnit.asyncTest` calls and recommend that you use `assert.async()` instead.

Expand Down
Loading