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

docs: generate with eslint-doc-generator #275

Merged
merged 1 commit into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/validate.yml
Expand Up @@ -47,6 +47,10 @@ jobs:
if: ${{ matrix.eslint == 8 }}
run: npm run validate

- name: ▶️ Ensure docs are up-to-date
if: ${{ matrix.eslint == 8 && matrix.node == 16 }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attempting to fix CI by ensuring this check only runs on the latest Node version. No need to run on earlier versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone approve CI to run?

run: npm run lint:generate-readme-table

- name: ⬆️ Upload coverage report
uses: codecov/codecov-action@v3

Expand Down
43 changes: 21 additions & 22 deletions README.md
Expand Up @@ -92,27 +92,27 @@ module.exports = {

## Supported Rules

👍 indicates that a rule is recommended for all users.

🔧 indicates that a rule is fixable.

<!-- __BEGIN AUTOGENERATED TABLE__ -->

| Name | 👍 | 🔧 | Description |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- | --------------------------------------------------------------------- |
| [prefer-checked](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-checked.md) | 👍 | 🔧 | prefer toBeChecked over checking attributes |
| [prefer-empty](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-empty.md) | 👍 | 🔧 | Prefer toBeEmpty over checking innerHTML |
| [prefer-enabled-disabled](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-enabled-disabled.md) | 👍 | 🔧 | prefer toBeDisabled or toBeEnabled over checking attributes |
| [prefer-focus](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-focus.md) | 👍 | 🔧 | prefer toHaveFocus over checking document.activeElement |
| [prefer-in-document](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-in-document.md) | 👍 | 🔧 | Prefer .toBeInTheDocument() for asserting the existence of a DOM node |
| [prefer-required](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-required.md) | 👍 | 🔧 | prefer toBeRequired over checking properties |
| [prefer-to-have-attribute](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-attribute.md) | 👍 | 🔧 | prefer toHaveAttribute over checking getAttribute/hasAttribute |
| [prefer-to-have-class](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-class.md) | 👍 | 🔧 | prefer toHaveClass over checking element className |
| [prefer-to-have-style](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-style.md) | 👍 | 🔧 | prefer toHaveStyle over checking element style |
| [prefer-to-have-text-content](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-text-content.md) | 👍 | 🔧 | Prefer toHaveTextContent over checking element.textContent |
| [prefer-to-have-value](https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/docs/rules/prefer-to-have-value.md) | 👍 | 🔧 | prefer toHaveValue over checking element.value |

<!-- __END AUTOGENERATED TABLE__ -->
<!-- begin auto-generated rules list -->

💼 Configurations enabled in.\
✅ Set in the `recommended` configuration.\
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).

| Name                        | Description | 💼 | 🔧 |
| :----------------------------------------------------------------------- | :-------------------------------------------------------------------- | :- | :- |
| [prefer-checked](docs/rules/prefer-checked.md) | prefer toBeChecked over checking attributes | ✅ | 🔧 |
| [prefer-empty](docs/rules/prefer-empty.md) | Prefer toBeEmpty over checking innerHTML | ✅ | 🔧 |
| [prefer-enabled-disabled](docs/rules/prefer-enabled-disabled.md) | prefer toBeDisabled or toBeEnabled over checking attributes | ✅ | 🔧 |
| [prefer-focus](docs/rules/prefer-focus.md) | prefer toHaveFocus over checking document.activeElement | ✅ | 🔧 |
| [prefer-in-document](docs/rules/prefer-in-document.md) | Prefer .toBeInTheDocument() for asserting the existence of a DOM node | ✅ | 🔧 |
| [prefer-required](docs/rules/prefer-required.md) | prefer toBeRequired over checking properties | ✅ | 🔧 |
| [prefer-to-have-attribute](docs/rules/prefer-to-have-attribute.md) | prefer toHaveAttribute over checking getAttribute/hasAttribute | ✅ | 🔧 |
| [prefer-to-have-class](docs/rules/prefer-to-have-class.md) | prefer toHaveClass over checking element className | ✅ | 🔧 |
| [prefer-to-have-style](docs/rules/prefer-to-have-style.md) | prefer toHaveStyle over checking element style | ✅ | 🔧 |
| [prefer-to-have-text-content](docs/rules/prefer-to-have-text-content.md) | Prefer toHaveTextContent over checking element.textContent | ✅ | 🔧 |
| [prefer-to-have-value](docs/rules/prefer-to-have-value.md) | prefer toHaveValue over checking element.value | ✅ | 🔧 |

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

## Issues

Expand Down Expand Up @@ -196,7 +196,6 @@ MIT
[coc]: https://github.com/testing-library/eslint-plugin-jest-dom/blob/main/other/CODE_OF_CONDUCT.md
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
[all-contributors]: https://github.com/all-contributors/all-contributors
[all-contributors-badge]: https://img.shields.io/github/all-contributors/testing-library/eslint-plugin-jest-dom?color=orange&style=flat-square
[bugs]: https://github.com/testing-library/eslint-plugin-jest-dom/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Acreated-desc+label%3Abug
[requests]: https://github.com/testing-library/eslint-plugin-jest-dom/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement
[good-first-issue]: https://github.com/testing-library/eslint-plugin-jest-dom/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement+label%3A%22good+first+issue%22
Expand Down
55 changes: 0 additions & 55 deletions build/generate-readme-table.js

This file was deleted.

8 changes: 7 additions & 1 deletion docs/rules/prefer-checked.md
@@ -1,4 +1,10 @@
# prefer toBeChecked() or not.toBeChecked() over toHaveProperty('checked', true|false) (prefer-enabled-checked)
# Prefer toBeChecked over checking attributes (`jest-dom/prefer-checked`)

💼 This rule is enabled in the ✅ `recommended` 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

Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-empty.md
@@ -1,4 +1,10 @@
# Prefer toBeEmptyDOMElement over checking innerHTML / firstChild (prefer-empty)
# Prefer toBeEmpty over checking innerHTML (`jest-dom/prefer-empty`)

💼 This rule is enabled in the ✅ `recommended` 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 -->

This rule ensures people will use toBeEmptyDOMElement() rather than checking dom
nodes/properties. It is primarily aimed at consistently using jest-dom for
Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-enabled-disabled.md
@@ -1,4 +1,10 @@
# prefer toBeDisabled() or toBeEnabled() over toHaveProperty('disabled', true|false) (prefer-enabled-disabled)
# Prefer toBeDisabled or toBeEnabled over checking attributes (`jest-dom/prefer-enabled-disabled`)

💼 This rule is enabled in the ✅ `recommended` 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

Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-focus.md
@@ -1,4 +1,10 @@
# prefer-focus
# Prefer toHaveFocus over checking document.activeElement (`jest-dom/prefer-focus`)

💼 This rule is enabled in the ✅ `recommended` 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 -->

prefer toHaveFocus over checking document.activeElement (prefer-focus)

Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-in-document.md
@@ -1,4 +1,10 @@
# Prefer .toBeInTheDocument in favor of .toHaveLength(1) (prefer-in-document)
# Prefer .toBeInTheDocument() for asserting the existence of a DOM node (`jest-dom/prefer-in-document`)

💼 This rule is enabled in the ✅ `recommended` 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

Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-required.md
@@ -1,4 +1,10 @@
# prefer toBeRequired() or not.toBeRequired() over toHaveProperty('required', true|false) (prefer-required)
# Prefer toBeRequired over checking properties (`jest-dom/prefer-required`)

💼 This rule is enabled in the ✅ `recommended` 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

Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-to-have-attribute.md
@@ -1,4 +1,10 @@
# prefer toHaveAttribute over checking getAttribute/hasAttribute (prefer-to-have-attribute)
# Prefer toHaveAttribute over checking getAttribute/hasAttribute (`jest-dom/prefer-to-have-attribute`)

💼 This rule is enabled in the ✅ `recommended` 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 -->

This rule is an autofixable rule that reports usages of `getAttribute` or
`hasAttribute` in expect statements in preference of using the jest-dom
Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-to-have-class.md
@@ -1,4 +1,10 @@
# prefer toHaveClass over checking element.class (prefer-to-have-class)
# Prefer toHaveClass over checking element className (`jest-dom/prefer-to-have-class`)

💼 This rule is enabled in the ✅ `recommended` 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 -->

This rule is an autofixable rule that reports usages of checking element className or classList in expect statements in preference of using the jest-dom
`toHaveClass` matcher.
Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-to-have-style.md
@@ -1,4 +1,10 @@
# prefer toHaveStyle over checking element.style (prefer-to-have-style)
# Prefer toHaveStyle over checking element style (`jest-dom/prefer-to-have-style`)

💼 This rule is enabled in the ✅ `recommended` 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 -->

This rule is an autofixable rule that reports usages of checking element.style in expect statements in preference of using the jest-dom
`toHaveStyle` matcher.
Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-to-have-text-content.md
@@ -1,4 +1,10 @@
# Prefer toHaveTextContent over checking element.textContent (prefer-to-have-text-content)
# Prefer toHaveTextContent over checking element.textContent (`jest-dom/prefer-to-have-text-content`)

💼 This rule is enabled in the ✅ `recommended` 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 -->

Please describe the origin of the rule here.

Expand Down
8 changes: 7 additions & 1 deletion docs/rules/prefer-to-have-value.md
@@ -1,4 +1,10 @@
# prefer toHaveAttribute over checking getAttribute/hasAttribute (prefer-to-have-attribute)
# Prefer toHaveValue over checking element.value (`jest-dom/prefer-to-have-value`)

💼 This rule is enabled in the ✅ `recommended` 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 -->

This rule is an autofixable rule that encourages the use of toHaveValue over checking the value attribute.

Expand Down
6 changes: 4 additions & 2 deletions package.json
Expand Up @@ -30,9 +30,10 @@
],
"scripts": {
"build": "kcd-scripts build",
"pregenerate-readme-table": "yarn build",
"generate-readme-table": "node build/generate-readme-table.js",
"pregenerate-readme-table": "npm run build",
"generate-readme-table": "eslint-doc-generator --ignore-config all",
"lint": "kcd-scripts lint",
"lint:generate-readme-table": "npm run generate-readme-table -- --check",
"setup": "npm install && npm run validate -s",
"test": "kcd-scripts test",
"test:coverage": "npm test -- --coverage",
Expand All @@ -47,6 +48,7 @@
"devDependencies": {
"@typescript-eslint/parser": "^5.9.1",
"eslint": "^8.7.0",
"eslint-doc-generator": "^0.19.0",
"eslint-remote-tester": "^3.0.0",
"eslint-remote-tester-repositories": "^0.0.7",
"kcd-scripts": "^12.0.0",
Expand Down