From 72d6d96291c01f74244967f1b01e7c2675899fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Thu, 23 Sep 2021 14:07:39 +0200 Subject: [PATCH] feat(no-unnecessary-act): add to Angular & Vue configs by default BREAKING CHANGE: `no-unnecessary-act` is now enabled by default in the Angular & Vue configs --- README.md | 2 +- lib/configs/angular.ts | 1 + lib/configs/dom.ts | 1 + lib/configs/vue.ts | 1 + lib/rules/no-unnecessary-act.ts | 6 +++--- tests/__snapshots__/index.test.ts.snap | 3 +++ 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8fc62d0c..b49491a2 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ To enable this configuration use the `extends` property in your | [`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 | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | | [`testing-library/no-render-in-setup`](./docs/rules/no-render-in-setup.md) | Disallow the use of `render` in testing frameworks setup functions | | | -| [`testing-library/no-unnecessary-act`](./docs/rules/no-unnecessary-act.md) | Disallow wrapping Testing Library utils or empty callbacks in `act` | | ![react-badge][] | +| [`testing-library/no-unnecessary-act`](./docs/rules/no-unnecessary-act.md) | Disallow wrapping Testing Library utils or empty callbacks in `act` | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | | [`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` calls inside `waitFor` | | | | [`testing-library/no-wait-for-side-effects`](./docs/rules/no-wait-for-side-effects.md) | Disallow the use of side effects in `waitFor` | | | diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index ab1060b1..afa9504c 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -13,6 +13,7 @@ export = { 'testing-library/no-dom-import': ['error', 'angular'], 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', + 'testing-library/no-unnecessary-act': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-screen-queries': 'error', diff --git a/lib/configs/dom.ts b/lib/configs/dom.ts index 261cde83..21eb5435 100644 --- a/lib/configs/dom.ts +++ b/lib/configs/dom.ts @@ -9,6 +9,7 @@ export = { 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-query': 'error', 'testing-library/no-promise-in-fire-event': 'error', + 'testing-library/no-unnecessary-act': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-screen-queries': 'error', diff --git a/lib/configs/vue.ts b/lib/configs/vue.ts index 9cb7b0a2..9912eed4 100644 --- a/lib/configs/vue.ts +++ b/lib/configs/vue.ts @@ -14,6 +14,7 @@ export = { 'testing-library/no-dom-import': ['error', 'vue'], 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', + 'testing-library/no-unnecessary-act': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/prefer-find-by': 'error', 'testing-library/prefer-screen-queries': 'error', diff --git a/lib/rules/no-unnecessary-act.ts b/lib/rules/no-unnecessary-act.ts index 5bdf4fd2..9afd86d8 100644 --- a/lib/rules/no-unnecessary-act.ts +++ b/lib/rules/no-unnecessary-act.ts @@ -25,10 +25,10 @@ export default createTestingLibraryRule({ 'Disallow wrapping Testing Library utils or empty callbacks in `act`', category: 'Possible Errors', recommendedConfig: { - dom: false, - angular: false, + dom: 'error', + angular: 'error', react: 'error', - vue: false, + vue: 'error', }, }, messages: { diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap index d0fd773f..56038ede 100644 --- a/tests/__snapshots__/index.test.ts.snap +++ b/tests/__snapshots__/index.test.ts.snap @@ -18,6 +18,7 @@ Object { ], "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", + "testing-library/no-unnecessary-act": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-screen-queries": "error", @@ -33,6 +34,7 @@ Object { "testing-library/await-async-utils": "error", "testing-library/no-await-sync-query": "error", "testing-library/no-promise-in-fire-event": "error", + "testing-library/no-unnecessary-act": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-screen-queries": "error", @@ -78,6 +80,7 @@ Object { ], "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", + "testing-library/no-unnecessary-act": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/prefer-find-by": "error", "testing-library/prefer-screen-queries": "error",