Skip to content

Commit

Permalink
fix(await-async-event): pluralize to await-async-events (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
skovy authored Oct 5, 2022
1 parent d0a5d35 commit 7238f76
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,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

0 comments on commit 7238f76

Please sign in to comment.