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

fix(await-async-event): pluralize to await-async-events #670

Merged
merged 1 commit into from
Oct 5, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ To enable this configuration use the `extends` property in your

| Name | Description | 🔧 | Included in configurations |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- | --- | ---------------------------------------------------------------------------------- |
| [`await-async-event`](./docs/rules/await-async-event.md) | Enforce promises from async event methods are handled | 🔧 | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] |
| [`await-async-events`](./docs/rules/await-async-events.md) | Enforce promises from async event methods are handled | 🔧 | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] |
| [`await-async-queries`](./docs/rules/await-async-queries.md) | Enforce promises from async queries to be handled | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] |
| [`await-async-utils`](./docs/rules/await-async-utils.md) | Enforce promises from async utils to be awaited properly | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] |
| [`consistent-data-testid`](./docs/rules/consistent-data-testid.md) | Ensures consistent usage of `data-testid` | | |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Enforce promises from async event methods are handled (`testing-library/await-async-event`)
# Enforce promises from async event methods are handled (`testing-library/await-async-events`)

Ensure that promises returned by `userEvent` (v14+) async methods or `fireEvent` (only Vue and Marko) async methods are handled properly.

Expand Down Expand Up @@ -102,7 +102,7 @@ await Promise.all([

```json
{
"testing-library/await-async-event": [
"testing-library/await-async-events": [
2,
{
"eventModule": "userEvent"
Expand All @@ -113,7 +113,7 @@ await Promise.all([

```json
{
"testing-library/await-async-event": [
"testing-library/await-async-events": [
2,
{
"eventModule": "fireEvent"
Expand All @@ -124,7 +124,7 @@ await Promise.all([

```json
{
"testing-library/await-async-event": [
"testing-library/await-async-events": [
2,
{
"eventModule": ["fireEvent", "userEvent"]
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
Expand Up @@ -105,4 +105,4 @@ Example:
## Notes

- Since `user-event` v14 all its methods are async, so you should disable reporting them by setting the `eventModules` to just `"fire-event"` so `user-event` methods are not reported.
- There is another rule `await-async-event`, which is for awaiting async events for `user-event` v14 or `fire-event` only in Vue Testing Library. Please do not confuse with this rule.
- There is another rule `await-async-events`, which is for awaiting async events for `user-event` v14 or `fire-event` only in Vue Testing Library. Please do not confuse with this rule.
2 changes: 1 addition & 1 deletion lib/configs/angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export = {
plugins: ['testing-library'],
rules: {
'testing-library/await-async-event': [
'testing-library/await-async-events': [
'error',
{ eventModule: 'userEvent' },
],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export = {
plugins: ['testing-library'],
rules: {
'testing-library/await-async-event': [
'testing-library/await-async-events': [
'error',
{ eventModule: 'userEvent' },
],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/marko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export = {
plugins: ['testing-library'],
rules: {
'testing-library/await-async-event': [
'testing-library/await-async-events': [
'error',
{ eventModule: ['fireEvent', 'userEvent'] },
],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export = {
plugins: ['testing-library'],
rules: {
'testing-library/await-async-event': [
'testing-library/await-async-events': [
'error',
{ eventModule: 'userEvent' },
],
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
export = {
plugins: ['testing-library'],
rules: {
'testing-library/await-async-event': [
'testing-library/await-async-events': [
'error',
{ eventModule: ['fireEvent', 'userEvent'] },
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '../node-utils';
import { EVENTS_SIMULATORS } from '../utils';

export const RULE_NAME = 'await-async-event';
export const RULE_NAME = 'await-async-events';
export type MessageIds = 'awaitAsyncEvent' | 'awaitAsyncEventWrapper';
const FIRE_EVENT_NAME = 'fireEvent';
const USER_EVENT_NAME = 'userEvent';
Expand Down
10 changes: 5 additions & 5 deletions tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Object {
"testing-library",
],
"rules": Object {
"testing-library/await-async-event": Array [
"testing-library/await-async-events": Array [
"error",
Object {
"eventModule": "userEvent",
Expand Down Expand Up @@ -43,7 +43,7 @@ Object {
"testing-library",
],
"rules": Object {
"testing-library/await-async-event": Array [
"testing-library/await-async-events": Array [
"error",
Object {
"eventModule": "userEvent",
Expand Down Expand Up @@ -71,7 +71,7 @@ Object {
"testing-library",
],
"rules": Object {
"testing-library/await-async-event": Array [
"testing-library/await-async-events": Array [
"error",
Object {
"eventModule": Array [
Expand Down Expand Up @@ -110,7 +110,7 @@ Object {
"testing-library",
],
"rules": Object {
"testing-library/await-async-event": Array [
"testing-library/await-async-events": Array [
"error",
Object {
"eventModule": "userEvent",
Expand Down Expand Up @@ -148,7 +148,7 @@ Object {
"testing-library",
],
"rules": Object {
"testing-library/await-async-event": Array [
"testing-library/await-async-events": Array [
"error",
Object {
"eventModule": Array [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import rule, { Options, RULE_NAME } from '../../../lib/rules/await-async-event';
import rule, {
Options,
RULE_NAME,
} from '../../../lib/rules/await-async-events';
import { createRuleTester } from '../test-utils';

const ruleTester = createRuleTester();
Expand Down