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

refactor: cleanup after migrating all rules to v4 #303

Merged
merged 15 commits into from
Mar 28, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"pkgRoot": "dist",
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
]
}
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,32 +125,32 @@ To enable this configuration use the `extends` property in your

## Supported Rules

| Rule | Description | Configurations | Fixable |
| -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------ |
| [await-async-query](docs/rules/await-async-query.md) | Enforce promises from async queries to be handled | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [await-async-utils](docs/rules/await-async-utils.md) | Enforce async utils to be awaited properly | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [await-fire-event](docs/rules/await-fire-event.md) | Enforce promises from fire event methods to be handled | ![vue-badge][] | |
| [consistent-data-testid](docs/rules/consistent-data-testid.md) | Ensure `data-testid` values match a provided regex. | | |
| [no-await-sync-events](docs/rules/no-await-sync-events.md) | Disallow unnecessary `await` for sync events | | |
| [no-await-sync-query](docs/rules/no-await-sync-query.md) | Disallow unnecessary `await` for sync queries | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [no-container](docs/rules/no-container.md) | Disallow the use of `container` methods | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [no-debug](docs/rules/no-debug.md) | Disallow the use of `debug` | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [no-dom-import](docs/rules/no-dom-import.md) | Disallow importing from DOM Testing Library | ![angular-badge][] ![react-badge][] ![vue-badge][] | ![fixable-badge][] |
| [no-manual-cleanup](docs/rules/no-manual-cleanup.md) | Disallow the use of `cleanup` | | |
| [no-node-access](docs/rules/no-node-access.md) | Disallow direct Node access | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [no-promise-in-fire-event](docs/rules/no-promise-in-fire-event.md) | Disallow the use of promises passed to a `fireEvent` method | | |
| [no-render-in-setup](docs/rules/no-render-in-setup.md) | Disallow the use of `render` in setup functions | | |
| [no-wait-for-empty-callback](docs/rules/no-wait-for-empty-callback.md) | Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved` | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [no-wait-for-multiple-assertions](docs/rules/no-wait-for-multiple-assertions.md) | Disallow the use of multiple expect inside `waitFor` | | |
| [no-wait-for-side-effects](docs/rules/no-wait-for-side-effects.md) | Disallow the use of side effects inside `waitFor` | | |
| [no-wait-for-snapshot](docs/rules/no-wait-for-snapshot.md) | Ensures no snapshot is generated inside of a `waitFor` call | | |
| [prefer-explicit-assert](docs/rules/prefer-explicit-assert.md) | Suggest using explicit assertions rather than just `getBy*` queries | | |
| [prefer-find-by](docs/rules/prefer-find-by.md) | Suggest using `findBy*` methods instead of the `waitFor` + `getBy` queries | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | ![fixable-badge][] |
| [prefer-presence-queries](docs/rules/prefer-presence-queries.md) | Enforce specific queries when checking element is present or not | | |
| [prefer-user-event](docs/rules/prefer-user-event.md) | Suggest using `userEvent` library instead of `fireEvent` for simulating user interaction | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [prefer-screen-queries](docs/rules/prefer-screen-queries.md) | Suggest using screen while using queries | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [prefer-wait-for](docs/rules/prefer-wait-for.md) | Use `waitFor` instead of deprecated wait methods | | ![fixable-badge][] |
| [render-result-naming-convention](docs/rules/render-result-naming-convention.md) | Enforce a valid naming for return value from `render` | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| Rule | Description | Configurations | Fixable |
| ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------ |
| [testing-library/await-async-query](docs/rules/await-async-query.md) | Enforce promises from async queries to be handled | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/await-async-utils](docs/rules/await-async-utils.md) | Enforce async utils to be awaited properly | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/await-fire-event](docs/rules/await-fire-event.md) | Enforce promises from fire event methods to be handled | ![vue-badge][] | |
| [testing-library/consistent-data-testid](docs/rules/consistent-data-testid.md) | Ensure `data-testid` values match a provided regex. | | |
| [testing-library/no-await-sync-events](docs/rules/no-await-sync-events.md) | Disallow unnecessary `await` for sync events | | |
| [testing-library/no-await-sync-query](docs/rules/no-await-sync-query.md) | Disallow unnecessary `await` for sync queries | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/no-container](docs/rules/no-container.md) | Disallow the use of `container` methods | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/no-debug](docs/rules/no-debug.md) | Disallow the use of `debug` | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/no-dom-import](docs/rules/no-dom-import.md) | Disallow importing from DOM Testing Library | ![angular-badge][] ![react-badge][] ![vue-badge][] | ![fixable-badge][] |
| [testing-library/no-manual-cleanup](docs/rules/no-manual-cleanup.md) | Disallow the use of `cleanup` | | |
| [testing-library/no-node-access](docs/rules/no-node-access.md) | Disallow direct Node access | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/no-promise-in-fire-event](docs/rules/no-promise-in-fire-event.md) | Disallow the use of promises passed to a `fireEvent` method | | |
| [testing-library/no-render-in-setup](docs/rules/no-render-in-setup.md) | Disallow the use of `render` in setup functions | | |
| [testing-library/no-wait-for-empty-callback](docs/rules/no-wait-for-empty-callback.md) | Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved` | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/no-wait-for-multiple-assertions](docs/rules/no-wait-for-multiple-assertions.md) | Disallow the use of multiple expect inside `waitFor` | | |
| [testing-library/no-wait-for-side-effects](docs/rules/no-wait-for-side-effects.md) | Disallow the use of side effects inside `waitFor` | | |
| [testing-library/no-wait-for-snapshot](docs/rules/no-wait-for-snapshot.md) | Ensures no snapshot is generated inside of a `waitFor` call | | |
| [testing-library/prefer-explicit-assert](docs/rules/prefer-explicit-assert.md) | Suggest using explicit assertions rather than just `getBy*` queries | | |
| [testing-library/prefer-find-by](docs/rules/prefer-find-by.md) | Suggest using `findBy*` methods instead of the `waitFor` + `getBy` queries | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | ![fixable-badge][] |
| [testing-library/prefer-presence-queries](docs/rules/prefer-presence-queries.md) | Enforce specific queries when checking element is present or not | | |
| [testing-library/prefer-user-event](docs/rules/prefer-user-event.md) | Suggest using `userEvent` library instead of `fireEvent` for simulating user interaction | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/prefer-screen-queries](docs/rules/prefer-screen-queries.md) | Suggest using screen while using queries | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
| [testing-library/prefer-wait-for](docs/rules/prefer-wait-for.md) | Use `waitFor` instead of deprecated wait methods | | ![fixable-badge][] |
| [testing-library/render-result-naming-convention](docs/rules/render-result-naming-convention.md) | Enforce a valid naming for return value from `render` | ![angular-badge][] ![react-badge][] ![vue-badge][] | |

[build-badge]: https://github.com/testing-library/eslint-plugin-testing-library/actions/workflows/pipeline.yml/badge.svg
[build-url]: https://github.com/testing-library/eslint-plugin-testing-library/actions/workflows/pipeline.yml
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/await-async-query.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Enforce promises from async queries to be handled (await-async-query)
# Enforce promises from async queries to be handled (`testing-library/await-async-query`)

Ensure that promises returned by async queries are handled properly.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/await-async-utils.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Enforce promises from async utils to be handled (await-async-utils)
# Enforce promises from async utils to be handled (`testing-library/await-async-utils`)

Ensure that promises returned by async utils are handled properly.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/await-fire-event.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Enforce promises from fire event methods to be handled (await-fire-event)
# Enforce promises from fire event methods to be handled (`testing-library/await-fire-event`)

Ensure that promises returned by `fireEvent` methods are handled
properly.
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/consistent-data-testid.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Enforces consistent naming for the data-testid attribute (consistent-data-testid)
# Enforces consistent naming for the data-testid attribute (`testing-library/consistent-data-testid`)

Ensure `data-testid` values match a provided regex. This rule is un-opinionated, and requires configuration.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-await-sync-events.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow unnecessary `await` for sync events (no-await-sync-events)
# Disallow unnecessary `await` for sync events (`testing-library/no-await-sync-events`)

Ensure that sync simulated events are not awaited unnecessarily.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-await-sync-query.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow unnecessary `await` for sync queries (no-await-sync-query)
# Disallow unnecessary `await` for sync queries (`testing-library/no-await-sync-query`)

Ensure that sync queries are not awaited unnecessarily.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-container.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow the use of `container` methods (no-container)
# Disallow the use of `container` methods (`testing-library/no-container`)

By using `container` methods like `.querySelector` you may lose a lot of the confidence that the user can really interact with your UI. Also, the test becomes harder to read, and it will break more frequently.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-debug.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow the use of `debug` (no-debug)
# Disallow the use of `debug` (`testing-library/no-debug`)

Just like `console.log` statements pollutes the browser's output, debug statements also pollutes the tests if one of your teammates forgot to remove it. `debug` statements should be used when you actually want to debug your tests but should not be pushed to the codebase.

Expand Down
10 changes: 5 additions & 5 deletions docs/rules/no-dom-import.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow importing from DOM Testing Library
# Disallow importing from DOM Testing Library (`testing-library/no-dom-import`)

Ensure that there are no direct imports from `@testing-library/dom` or
`dom-testing-library` when using some testing library framework
Expand All @@ -7,18 +7,18 @@ wrapper.
## Rule Details

Testing Library framework wrappers as React Testing Library already
re-exports everything from DOM Testing Library so you always have to
import DOM Testing Library utils from corresponding framework wrapper
re-exports everything from DOM Testing Library, so you always have to
import Testing Library utils from corresponding framework wrapper
module to:

- use proper extended version of some of those methods containing
additional functionality related to specific framework (e.g.
`fireEvent` util)
- avoid importing from extraneous dependencies (similar to
eslint-plugin-import)
`eslint-plugin-import`)

This rule aims to prevent users from import anything directly from
`@testing-library/dom` (or `dom-testing-library`) and it's useful for
`@testing-library/dom`, which is useful for
new starters or when IDEs autoimport from wrong module.

Examples of **incorrect** code for this rule:
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-manual-cleanup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow the use of `cleanup` (no-manual-cleanup)
# Disallow the use of `cleanup` (`testing-library/no-manual-cleanup`)

`cleanup` is performed automatically if the testing framework you're using supports the `afterEach` global (like mocha, Jest, and Jasmine). In this case, it's unnecessary to do manual cleanups after each test unless you skip the auto-cleanup with environment variables such as `RTL_SKIP_AUTO_CLEANUP` for React.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-node-access.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow direct Node access (no-node-access)
# Disallow direct Node access (`testing-library/no-node-access`)

The Testing Library already provides methods for querying DOM elements.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-promise-in-fire-event.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow the use of promises passed to a `fireEvent` method (no-promise-in-fire-event)
# Disallow the use of promises passed to a `fireEvent` method (`testing-library/no-promise-in-fire-event`)

Methods from `fireEvent` expect to receive a DOM element. Passing a promise will end up in an error, so it must be prevented.

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-render-in-setup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Disallow the use of `render` in setup functions (no-render-in-setup)
# Disallow the use of `render` in setup functions (`testing-library/no-render-in-setup`)

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-wait-for-empty-callback.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Empty callbacks inside `waitFor` and `waitForElementToBeRemoved` are not preferred (no-wait-for-empty-callback)
# Empty callbacks inside `waitFor` and `waitForElementToBeRemoved` are not preferred (`testing-library/no-wait-for-empty-callback`)

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-wait-for-multiple-assertions.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Multiple assertions inside `waitFor` are not preferred (no-wait-for-multiple-assertions)
# Disallow the use of multiple expect inside `waitFor` (`testing-library/no-wait-for-multiple-assertions`)

## Rule Details

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-wait-for-side-effects.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Side effects inside `waitFor` are not preferred (no-wait-for-side-effects)
# Disallow the use of side effects inside `waitFor` (`testing-library/no-wait-for-side-effects`)

## Rule Details

Expand Down
Loading