From c76a7bfa153d8f206bd88cd3928e3f8bd107be18 Mon Sep 17 00:00:00 2001 From: Spencer Miskoviak <5247455+skovy@users.noreply.github.com> Date: Sun, 2 Oct 2022 11:50:24 -0700 Subject: [PATCH] feat(no-global-regexp-flag-in-query): add to all configs by default (#660) BREAKING CHANGE: `no-global-regexp-flag-in-query` is now enabled by default in all configs --- README.md | 2 +- lib/configs/angular.ts | 1 + lib/configs/dom.ts | 1 + lib/configs/marko.ts | 1 + lib/configs/react.ts | 1 + lib/configs/vue.ts | 1 + lib/rules/no-global-regexp-flag-in-query.ts | 10 +++++----- tests/__snapshots__/index.test.ts.snap | 5 +++++ 8 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f014076d..a7da8c41 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ To enable this configuration use the `extends` property in your | [`no-container`](./docs/rules/no-container.md) | Disallow the use of `container` methods | | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | [`no-debugging-utils`](./docs/rules/no-debugging-utils.md) | Disallow the use of debugging utilities like `debug` | | ![angular-badge][] ![react-badge][] ![vue-badge][] ![marko-badge][] | | [`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 | 🔧 | | +| [`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-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][] | diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index aab442ad..b19f7397 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -11,6 +11,7 @@ export = { 'testing-library/no-container': 'error', 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'angular'], + '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-render-in-lifecycle': 'error', diff --git a/lib/configs/dom.ts b/lib/configs/dom.ts index 83add602..cad0f7f4 100644 --- a/lib/configs/dom.ts +++ b/lib/configs/dom.ts @@ -8,6 +8,7 @@ export = { 'testing-library/await-async-query': 'error', '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-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/configs/marko.ts b/lib/configs/marko.ts index 51d95924..d4f5f427 100644 --- a/lib/configs/marko.ts +++ b/lib/configs/marko.ts @@ -12,6 +12,7 @@ export = { 'testing-library/no-container': 'error', 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'marko'], + '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-render-in-lifecycle': 'error', diff --git a/lib/configs/react.ts b/lib/configs/react.ts index 52f5bc8e..e9beeb6f 100644 --- a/lib/configs/react.ts +++ b/lib/configs/react.ts @@ -11,6 +11,7 @@ export = { 'testing-library/no-container': 'error', 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'react'], + 'testing-library/no-global-regexp-flag-in-query': 'error', 'testing-library/no-manual-cleanup': 'error', 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', diff --git a/lib/configs/vue.ts b/lib/configs/vue.ts index 31883b0d..e2ff94a6 100644 --- a/lib/configs/vue.ts +++ b/lib/configs/vue.ts @@ -12,6 +12,7 @@ export = { 'testing-library/no-container': 'error', 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'vue'], + 'testing-library/no-global-regexp-flag-in-query': 'error', 'testing-library/no-manual-cleanup': 'error', 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', diff --git a/lib/rules/no-global-regexp-flag-in-query.ts b/lib/rules/no-global-regexp-flag-in-query.ts index 9bf9a2ef..15a47617 100644 --- a/lib/rules/no-global-regexp-flag-in-query.ts +++ b/lib/rules/no-global-regexp-flag-in-query.ts @@ -21,11 +21,11 @@ export default createTestingLibraryRule({ docs: { description: 'Disallow the use of the global RegExp flag (/g) in queries', recommendedConfig: { - dom: false, - angular: false, - react: false, - vue: false, - marko: false, + dom: 'error', + angular: 'error', + react: 'error', + vue: 'error', + marko: 'error', }, }, messages: { diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap index cebd4135..f608f04d 100644 --- a/tests/__snapshots__/index.test.ts.snap +++ b/tests/__snapshots__/index.test.ts.snap @@ -16,6 +16,7 @@ Object { "error", "angular", ], + "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-render-in-lifecycle": "error", @@ -38,6 +39,7 @@ Object { "testing-library/await-async-query": "error", "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-promise-in-fire-event": "error", "testing-library/no-wait-for-empty-callback": "error", "testing-library/no-wait-for-multiple-assertions": "error", @@ -64,6 +66,7 @@ Object { "error", "marko", ], + "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-render-in-lifecycle": "error", @@ -93,6 +96,7 @@ Object { "error", "react", ], + "testing-library/no-global-regexp-flag-in-query": "error", "testing-library/no-manual-cleanup": "error", "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error", @@ -124,6 +128,7 @@ Object { "error", "vue", ], + "testing-library/no-global-regexp-flag-in-query": "error", "testing-library/no-manual-cleanup": "error", "testing-library/no-node-access": "error", "testing-library/no-promise-in-fire-event": "error",