diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 11044860..6d92df51 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -44,7 +44,7 @@ If you ever need to update a snapshot, you can run `npm run test:update` Based on [ESLint's Rule Naming Conventions](https://eslint.org/docs/developer-guide/working-with-rules#rule-naming-conventions), you must follow these rules: -- If your rule is disallowing something, prefix it with `no-` such as `no-debug` +- If your rule is disallowing something, prefix it with `no-` such as `no-debugging-utils` for disallowing `debug()`. - If your rule is suggesting to prefer a way of doing something, among other ways, you can **optionally** prefix it with `prefer-`. For example, `prefer-screen-queries` suggests to use `screen.getByText()` from imported `screen` rather @@ -57,11 +57,11 @@ Based on [ESLint's Rule Naming Conventions](https://eslint.org/docs/developer-gu ## Adding new rules In the [same way as ESLint](https://eslint.org/docs/developer-guide/working-with-rules), -each rule has three files named with its identifier (e.g. `no-debug`): +each rule has three files named with its identifier (e.g. `no-debugging-utils`): -- in the `lib/rules` directory: a source file (e.g. `no-debug.ts`) -- in the `tests/lib/rules` directory: a test file (e.g. `no-debug.ts`) -- in the `docs/rules` directory: a Markdown documentation file (e.g. `no-debug.md`) +- in the `lib/rules` directory: a source file (e.g. `no-debugging-utils.ts`) +- in the `tests/lib/rules` directory: a test file (e.g. `no-debugging-utils.ts`) +- in the `docs/rules` directory: a Markdown documentation file (e.g. `no-debugging-utils.md`) Additionally, you need to do a couple of extra things: diff --git a/README.md b/README.md index 92435bfa..3b7cf571 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Then configure the rules you want to use within `rules` property of your `.eslin "rules": { "testing-library/await-async-query": "error", "testing-library/no-await-sync-query": "error", - "testing-library/no-debug": "warn", + "testing-library/no-debugging-utils": "warn", "testing-library/no-dom-import": "off" } } @@ -193,7 +193,7 @@ To enable this configuration use the `extends` property in your | [`testing-library/no-await-sync-events`](./docs/rules/no-await-sync-events.md) | Disallow unnecessary `await` for sync events | | | | [`testing-library/no-await-sync-query`](./docs/rules/no-await-sync-query.md) | Disallow unnecessary `await` for sync queries | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | | [`testing-library/no-container`](./docs/rules/no-container.md) | Disallow the use of `container` methods | | ![angular-badge][] ![react-badge][] ![vue-badge][] | -| [`testing-library/no-debug`](./docs/rules/no-debug.md) | Disallow the use of debugging utilities like `debug` | | ![angular-badge][] ![react-badge][] ![vue-badge][] | +| [`testing-library/no-debugging-utils`](./docs/rules/no-debugging-utils.md) | Disallow the use of debugging utilities like `debug` | | ![angular-badge][] ![react-badge][] ![vue-badge][] | | [`testing-library/no-dom-import`](./docs/rules/no-dom-import.md) | Disallow importing from DOM Testing Library | 🔧 | ![angular-badge][] ![react-badge][] ![vue-badge][] | | [`testing-library/no-manual-cleanup`](./docs/rules/no-manual-cleanup.md) | Disallow the use of `cleanup` | | | | [`testing-library/no-node-access`](./docs/rules/no-node-access.md) | Disallow direct Node access | | ![angular-badge][] ![react-badge][] ![vue-badge][] | diff --git a/docs/rules/no-debug.md b/docs/rules/no-debugging-utils.md similarity index 91% rename from docs/rules/no-debug.md rename to docs/rules/no-debugging-utils.md index 9ae030dd..7737eb9f 100644 --- a/docs/rules/no-debug.md +++ b/docs/rules/no-debugging-utils.md @@ -1,4 +1,4 @@ -# Disallow the use of debugging utilities like `debug` (`testing-library/no-debug`) +# Disallow the use of debugging utilities (`testing-library/no-debugging-utils`) Just like `console.log` statements pollutes the browser's output, debug statements also pollutes the tests if one of your teammates forgot to remove it. `debug` statements should be used when you actually want to debug your tests but should not be pushed to the codebase. @@ -41,7 +41,7 @@ You can control which debugging utils are checked for with the `utilsToCheckFor` ```json { - "testing-library/no-debug": [ + "testing-library/no-debugging-utils": [ "error", { "utilsToCheckFor": { diff --git a/lib/configs/angular.ts b/lib/configs/angular.ts index 671b496b..ab1060b1 100644 --- a/lib/configs/angular.ts +++ b/lib/configs/angular.ts @@ -9,7 +9,7 @@ export = { 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-query': 'error', 'testing-library/no-container': 'error', - 'testing-library/no-debug': 'error', + 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'angular'], 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', diff --git a/lib/configs/react.ts b/lib/configs/react.ts index b2161875..b788c414 100644 --- a/lib/configs/react.ts +++ b/lib/configs/react.ts @@ -9,7 +9,7 @@ export = { 'testing-library/await-async-utils': 'error', 'testing-library/no-await-sync-query': 'error', 'testing-library/no-container': 'error', - 'testing-library/no-debug': 'error', + 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'react'], '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 046bb774..9cb7b0a2 100644 --- a/lib/configs/vue.ts +++ b/lib/configs/vue.ts @@ -10,7 +10,7 @@ export = { 'testing-library/await-fire-event': 'error', 'testing-library/no-await-sync-query': 'error', 'testing-library/no-container': 'error', - 'testing-library/no-debug': 'error', + 'testing-library/no-debugging-utils': 'error', 'testing-library/no-dom-import': ['error', 'vue'], 'testing-library/no-node-access': 'error', 'testing-library/no-promise-in-fire-event': 'error', diff --git a/lib/rules/no-debug.ts b/lib/rules/no-debugging-utils.ts similarity index 99% rename from lib/rules/no-debug.ts rename to lib/rules/no-debugging-utils.ts index a0808154..3f382b5e 100644 --- a/lib/rules/no-debug.ts +++ b/lib/rules/no-debugging-utils.ts @@ -21,7 +21,7 @@ type DebugUtilsToCheckFor = Partial< Record >; -export const RULE_NAME = 'no-debug'; +export const RULE_NAME = 'no-debugging-utils'; export type MessageIds = 'noDebug'; type Options = [{ utilsToCheckFor?: DebugUtilsToCheckFor }]; diff --git a/tests/__snapshots__/index.test.ts.snap b/tests/__snapshots__/index.test.ts.snap index d154465d..68187baf 100644 --- a/tests/__snapshots__/index.test.ts.snap +++ b/tests/__snapshots__/index.test.ts.snap @@ -11,7 +11,7 @@ Object { "testing-library/await-async-utils": "error", "testing-library/no-await-sync-query": "error", "testing-library/no-container": "error", - "testing-library/no-debug": "error", + "testing-library/no-debugging-utils": "error", "testing-library/no-dom-import": Array [ "error", "angular", @@ -47,7 +47,7 @@ Object { "testing-library/await-async-utils": "error", "testing-library/no-await-sync-query": "error", "testing-library/no-container": "error", - "testing-library/no-debug": "error", + "testing-library/no-debugging-utils": "error", "testing-library/no-dom-import": Array [ "error", "react", @@ -70,7 +70,7 @@ Object { "testing-library/await-fire-event": "error", "testing-library/no-await-sync-query": "error", "testing-library/no-container": "error", - "testing-library/no-debug": "error", + "testing-library/no-debugging-utils": "error", "testing-library/no-dom-import": Array [ "error", "vue", diff --git a/tests/lib/rules/no-debug.test.ts b/tests/lib/rules/no-debugging-utils.test.ts similarity index 99% rename from tests/lib/rules/no-debug.test.ts rename to tests/lib/rules/no-debugging-utils.test.ts index aabbfb61..56814597 100644 --- a/tests/lib/rules/no-debug.test.ts +++ b/tests/lib/rules/no-debugging-utils.test.ts @@ -1,4 +1,4 @@ -import rule, { RULE_NAME } from '../../../lib/rules/no-debug'; +import rule, { RULE_NAME } from '../../../lib/rules/no-debugging-utils'; import { createRuleTester } from '../test-utils'; const ruleTester = createRuleTester();