From 7238f76c44d026798c8ad7c41700a717a065aef6 Mon Sep 17 00:00:00 2001 From: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Date: Wed, 5 Oct 2022 14:43:50 -0700 Subject: [PATCH] fix(await-async-event): pluralize to await-async-events (#670) --- README.md | 2 +- .../{await-async-event.md => await-async-events.md} | 8 ++++---- docs/rules/no-await-sync-events.md | 2 +- lib/configs/angular.ts | 2 +- lib/configs/dom.ts | 2 +- lib/configs/marko.ts | 2 +- lib/configs/react.ts | 2 +- lib/configs/vue.ts | 2 +- .../{await-async-event.ts => await-async-events.ts} | 2 +- tests/__snapshots__/index.test.ts.snap | 10 +++++----- ...-async-event.test.ts => await-async-events.test.ts} | 5 ++++- 11 files changed, 21 insertions(+), 18 deletions(-) rename docs/rules/{await-async-event.md => await-async-events.md} (95%) rename lib/rules/{await-async-event.ts => await-async-events.ts} (98%) rename tests/lib/rules/{await-async-event.test.ts => await-async-events.test.ts} (99%) diff --git a/README.md b/README.md index 5f75cf08..35b8d645 100644 --- a/README.md +++ b/README.md @@ -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` | | | diff --git a/docs/rules/await-async-event.md b/docs/rules/await-async-events.md similarity index 95% rename from docs/rules/await-async-event.md rename to docs/rules/await-async-events.md index ef555409..d9b5f00f 100644 --- a/docs/rules/await-async-event.md +++ b/docs/rules/await-async-events.md @@ -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. @@ -102,7 +102,7 @@ await Promise.all([ ```json { - "testing-library/await-async-event": [ + "testing-library/await-async-events": [ 2, { "eventModule": "userEvent" @@ -113,7 +113,7 @@ await Promise.all([ ```json { - "testing-library/await-async-event": [ + "testing-library/await-async-events": [ 2, { "eventModule": "fireEvent" @@ -124,7 +124,7 @@ await Promise.all([ ```json { - "testing-library/await-async-event": [ + "testing-library/await-async-events": [ 2, { "eventModule": ["fireEvent", "userEvent"] diff --git a/docs/rules/no-await-sync-events.md b/docs/rules/no-await-sync-events.md index 39cfdf45..1392006b 100644 --- a/docs/rules/no-await-sync-events.md +++ b/docs/rules/no-await-sync-events.md @@ -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. diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index 0e6f9774..77921fcb 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -5,7 +5,7 @@ export = { plugins: ['testing-library'], rules: { - 'testing-library/await-async-event': [ + 'testing-library/await-async-events': [ 'error', { eventModule: 'userEvent' }, ], diff --git a/lib/configs/dom.ts b/lib/configs/dom.ts index e46afbe0..d0317251 100644 --- a/lib/configs/dom.ts +++ b/lib/configs/dom.ts @@ -5,7 +5,7 @@ export = { plugins: ['testing-library'], rules: { - 'testing-library/await-async-event': [ + 'testing-library/await-async-events': [ 'error', { eventModule: 'userEvent' }, ], diff --git a/lib/configs/marko.ts b/lib/configs/marko.ts index 7a7abdd2..ca496765 100644 --- a/lib/configs/marko.ts +++ b/lib/configs/marko.ts @@ -5,7 +5,7 @@ export = { plugins: ['testing-library'], rules: { - 'testing-library/await-async-event': [ + 'testing-library/await-async-events': [ 'error', { eventModule: ['fireEvent', 'userEvent'] }, ], diff --git a/lib/configs/react.ts b/lib/configs/react.ts index 4d483ad7..a89ee93e 100644 --- a/lib/configs/react.ts +++ b/lib/configs/react.ts @@ -5,7 +5,7 @@ export = { plugins: ['testing-library'], rules: { - 'testing-library/await-async-event': [ + 'testing-library/await-async-events': [ 'error', { eventModule: 'userEvent' }, ], diff --git a/lib/configs/vue.ts b/lib/configs/vue.ts index faa0f61c..449f2936 100644 --- a/lib/configs/vue.ts +++ b/lib/configs/vue.ts @@ -5,7 +5,7 @@ export = { plugins: ['testing-library'], rules: { - 'testing-library/await-async-event': [ + 'testing-library/await-async-events': [ 'error', { eventModule: ['fireEvent', 'userEvent'] }, ], diff --git a/lib/rules/await-async-event.ts b/lib/rules/await-async-events.ts similarity index 98% rename from lib/rules/await-async-event.ts rename to lib/rules/await-async-events.ts index c5aebff6..57ce0694 100644 --- a/lib/rules/await-async-event.ts +++ b/lib/rules/await-async-events.ts @@ -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'; diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap index 5304da46..0084e4a0 100644 --- a/tests/__snapshots__/index.test.ts.snap +++ b/tests/__snapshots__/index.test.ts.snap @@ -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", @@ -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", @@ -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 [ @@ -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", @@ -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 [ diff --git a/tests/lib/rules/await-async-event.test.ts b/tests/lib/rules/await-async-events.test.ts similarity index 99% rename from tests/lib/rules/await-async-event.test.ts rename to tests/lib/rules/await-async-events.test.ts index 5b245908..e0acd43c 100644 --- a/tests/lib/rules/await-async-event.test.ts +++ b/tests/lib/rules/await-async-events.test.ts @@ -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();