From 8dfe155f5658c14004c80ddef274171e1d2950b1 Mon Sep 17 00:00:00 2001 From: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Date: Sun, 2 Oct 2022 13:40:04 -0700 Subject: [PATCH] feat(no-node-access): add to DOM config by default (#661) BREAKING CHANGE: `no-node-access` is now enabled by default in the DOM config --- README.md | 2 +- lib/configs/dom.ts | 1 + lib/rules/no-node-access.ts | 2 +- tests/__snapshots__/index.test.ts.snap | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 856c593c..8ece9fd0 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ To enable this configuration use the `extends` property in your | [`no-dom-import`](./docs/rules/no-dom-import.md) | Disallow importing from DOM Testing Library | 🔧 | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | [`no-global-regexp-flag-in-query`](./docs/rules/no-global-regexp-flag-in-query.md) | Disallow the use of the global RegExp flag (/g) in queries | 🔧 | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | [`no-manual-cleanup`](./docs/rules/no-manual-cleanup.md) | Disallow the use of `cleanup` | | ![react-badge][] ![vue-badge][] | -| [`no-node-access`](./docs/rules/no-node-access.md) | Disallow direct Node access | | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | +| [`no-node-access`](./docs/rules/no-node-access.md) | Disallow direct Node access | | ![dom-badge][] ![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-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][] | diff --git a/lib/configs/dom.ts b/lib/configs/dom.ts index 13fbc8d7..b0fd6d33 100644 --- a/lib/configs/dom.ts +++ b/lib/configs/dom.ts @@ -13,6 +13,7 @@ export = { 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-query': 'error', 'testing-library/no-global-regexp-flag-in-query': 'error', + 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', 'testing-library/no-wait-for-empty-callback': 'error', 'testing-library/no-wait-for-multiple-assertions': 'error', diff --git a/lib/rules/no-node-access.ts b/lib/rules/no-node-access.ts index 1beb3f2c..78ffdc31 100644 --- a/lib/rules/no-node-access.ts +++ b/lib/rules/no-node-access.ts @@ -14,7 +14,7 @@ export default createTestingLibraryRule({ docs: { description: 'Disallow direct Node access', recommendedConfig: { - dom: false, + dom: 'error', angular: 'error', react: 'error', vue: 'error', diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap index 4dc40ef7..33902d1e 100644 --- a/tests/__snapshots__/index.test.ts.snap +++ b/tests/__snapshots__/index.test.ts.snap @@ -52,6 +52,7 @@ Object { "testing-library/await-async-utils": "error", "testing-library/no-await-sync-query": "error", "testing-library/no-global-regexp-flag-in-query": "error", + "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/no-wait-for-multiple-assertions": "error",