From 9acba430da3729bf3e4c781d1b9d2f3ff3ed6962 Mon Sep 17 00:00:00 2001 From: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Date: Mon, 19 Sep 2022 23:42:53 -0700 Subject: [PATCH] feat(no-render-in-setup): rename to `no-render-in-lifecycle` (#649) BREAKING CHANGE: `no-render-in-setup` is now called `no-render-in-lifecycle` --- README.md | 2 +- .../{no-render-in-setup.md => no-render-in-lifecycle.md} | 4 ++-- lib/configs/angular.ts | 2 +- lib/configs/marko.ts | 2 +- lib/configs/react.ts | 2 +- lib/configs/vue.ts | 2 +- .../{no-render-in-setup.ts => no-render-in-lifecycle.ts} | 2 +- tests/__snapshots__/index.test.ts.snap | 8 ++++---- ...er-in-setup.test.ts => no-render-in-lifecycle.test.ts} | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) rename docs/rules/{no-render-in-setup.md => no-render-in-lifecycle.md} (93%) rename lib/rules/{no-render-in-setup.ts => no-render-in-lifecycle.ts} (98%) rename tests/lib/rules/{no-render-in-setup.test.ts => no-render-in-lifecycle.test.ts} (99%) diff --git a/README.md b/README.md index c7ea121d..ab27d091 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ To enable this configuration use the `extends` property in your | [`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][] ![marko-badge][] | | [`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][] ![marko-badge][] | -| [`no-render-in-setup`](./docs/rules/no-render-in-setup.md) | Disallow the use of `render` in testing frameworks setup functions | | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | +| [`no-render-in-lifecycle`](./docs/rules/no-render-in-lifecycle.md) | Disallow the use of `render` in testing frameworks setup functions | | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | [`no-unnecessary-act`](./docs/rules/no-unnecessary-act.md) | Disallow wrapping Testing Library utils or empty callbacks in `act` | | ![react-badge][] ![marko-badge][] | | [`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][] ![marko-badge][] | | [`no-wait-for-multiple-assertions`](./docs/rules/no-wait-for-multiple-assertions.md) | Disallow the use of multiple `expect` calls inside `waitFor` | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | diff --git a/docs/rules/no-render-in-setup.md b/docs/rules/no-render-in-lifecycle.md similarity index 93% rename from docs/rules/no-render-in-setup.md rename to docs/rules/no-render-in-lifecycle.md index cd27e366..f195243f 100644 --- a/docs/rules/no-render-in-setup.md +++ b/docs/rules/no-render-in-lifecycle.md @@ -1,4 +1,4 @@ -# Disallow the use of `render` in setup functions (`testing-library/no-render-in-setup`) +# Disallow the use of `render` in setup functions (`testing-library/no-render-in-lifecycle`) ## Rule Details @@ -77,5 +77,5 @@ it('Should have foo and bar', () => { If you would like to allow the use of `render` (or a custom render function) in _either_ `beforeAll` or `beforeEach`, this can be configured using the option `allowTestingFrameworkSetupHook`. This may be useful if you have configured your tests to [skip auto cleanup](https://testing-library.com/docs/react-testing-library/setup#skipping-auto-cleanup). `allowTestingFrameworkSetupHook` is an enum that accepts either `"beforeAll"` or `"beforeEach"`. ``` - "testing-library/no-render-in-setup": ["error", {"allowTestingFrameworkSetupHook": "beforeAll"}], + "testing-library/no-render-in-lifecycle": ["error", {"allowTestingFrameworkSetupHook": "beforeAll"}], ``` diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index 6f4388b8..aab442ad 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -13,7 +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-render-in-setup': 'error', + 'testing-library/no-render-in-lifecycle': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/no-wait-for-multiple-assertions': 'error', 'testing-library/no-wait-for-side-effects': 'error', diff --git a/lib/configs/marko.ts b/lib/configs/marko.ts index d5dc1311..51d95924 100644 --- a/lib/configs/marko.ts +++ b/lib/configs/marko.ts @@ -14,7 +14,7 @@ export = { 'testing-library/no-dom-import': ['error', 'marko'], 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', - 'testing-library/no-render-in-setup': 'error', + 'testing-library/no-render-in-lifecycle': 'error', 'testing-library/no-unnecessary-act': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/no-wait-for-multiple-assertions': 'error', diff --git a/lib/configs/react.ts b/lib/configs/react.ts index 066d9fd7..9876f2c7 100644 --- a/lib/configs/react.ts +++ b/lib/configs/react.ts @@ -13,7 +13,7 @@ export = { 'testing-library/no-dom-import': ['error', 'react'], 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', - 'testing-library/no-render-in-setup': 'error', + 'testing-library/no-render-in-lifecycle': 'error', 'testing-library/no-unnecessary-act': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/no-wait-for-multiple-assertions': 'error', diff --git a/lib/configs/vue.ts b/lib/configs/vue.ts index 2a3b2d2b..97b6c14b 100644 --- a/lib/configs/vue.ts +++ b/lib/configs/vue.ts @@ -14,7 +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-render-in-setup': 'error', + 'testing-library/no-render-in-lifecycle': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/no-wait-for-multiple-assertions': 'error', 'testing-library/no-wait-for-side-effects': 'error', diff --git a/lib/rules/no-render-in-setup.ts b/lib/rules/no-render-in-lifecycle.ts similarity index 98% rename from lib/rules/no-render-in-setup.ts rename to lib/rules/no-render-in-lifecycle.ts index f40c7d1e..4496522c 100644 --- a/lib/rules/no-render-in-setup.ts +++ b/lib/rules/no-render-in-lifecycle.ts @@ -9,7 +9,7 @@ import { } from '../node-utils'; import { TESTING_FRAMEWORK_SETUP_HOOKS } from '../utils'; -export const RULE_NAME = 'no-render-in-setup'; +export const RULE_NAME = 'no-render-in-lifecycle'; export type MessageIds = 'noRenderInSetup'; type Options = [ { diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap index 3a191824..32ceabeb 100644 --- a/tests/__snapshots__/index.test.ts.snap +++ b/tests/__snapshots__/index.test.ts.snap @@ -18,7 +18,7 @@ Object { ], "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", + "testing-library/no-render-in-lifecycle": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/no-wait-for-multiple-assertions": "error", "testing-library/no-wait-for-side-effects": "error", @@ -66,7 +66,7 @@ Object { ], "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", + "testing-library/no-render-in-lifecycle": "error", "testing-library/no-unnecessary-act": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/no-wait-for-multiple-assertions": "error", @@ -95,7 +95,7 @@ Object { ], "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", + "testing-library/no-render-in-lifecycle": "error", "testing-library/no-unnecessary-act": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/no-wait-for-multiple-assertions": "error", @@ -125,7 +125,7 @@ Object { ], "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", - "testing-library/no-render-in-setup": "error", + "testing-library/no-render-in-lifecycle": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/no-wait-for-multiple-assertions": "error", "testing-library/no-wait-for-side-effects": "error", diff --git a/tests/lib/rules/no-render-in-setup.test.ts b/tests/lib/rules/no-render-in-lifecycle.test.ts similarity index 99% rename from tests/lib/rules/no-render-in-setup.test.ts rename to tests/lib/rules/no-render-in-lifecycle.test.ts index 0e66802e..9665afcc 100644 --- a/tests/lib/rules/no-render-in-setup.test.ts +++ b/tests/lib/rules/no-render-in-lifecycle.test.ts @@ -1,4 +1,4 @@ -import rule, { RULE_NAME } from '../../../lib/rules/no-render-in-setup'; +import rule, { RULE_NAME } from '../../../lib/rules/no-render-in-lifecycle'; import { TESTING_FRAMEWORK_SETUP_HOOKS } from '../../../lib/utils'; import { createRuleTester } from '../test-utils';