Skip to content

Commit

Permalink
docs: add eslint-doc-generator (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Oct 29, 2022
1 parent f789574 commit f9840e7
Show file tree
Hide file tree
Showing 45 changed files with 578 additions and 285 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Expand Up @@ -19,23 +19,32 @@ jobs:
node-version: [12.x, 14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Upgrade npm
run: npm install -g npm

- 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
- run: npm run test:unit
- run: npm install --save-dev eslint@7 && npm run test:unit

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./build/coverage/lcov.info

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.x"
- run: npm ci
- run: npm run lint
100 changes: 49 additions & 51 deletions README.md
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 auto-generated rules list -->

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

| 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 || | |

<!-- end auto-generated rules list -->

## Contributors

Expand Down
6 changes: 4 additions & 2 deletions docs/rules/assert-args.md
@@ -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 auto-generated 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
@@ -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 by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end auto-generated 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
@@ -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 by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end auto-generated 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
@@ -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 by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end auto-generated 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
@@ -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 is manually fixable by [editor suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).

<!-- end auto-generated 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
@@ -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 auto-generated 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
@@ -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 auto-generated 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
@@ -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 auto-generated 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

0 comments on commit f9840e7

Please sign in to comment.