Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(no-debug): rename to no-debugging-utils #469

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down Expand Up @@ -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][] |
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/no-debug.md → docs/rules/no-debugging-utils.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion lib/configs/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-debug.ts → lib/rules/no-debugging-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type DebugUtilsToCheckFor = Partial<
Record<typeof DEBUG_UTILS[number], boolean>
>;

export const RULE_NAME = 'no-debug';
export const RULE_NAME = 'no-debugging-utils';
export type MessageIds = 'noDebug';
type Options = [{ utilsToCheckFor?: DebugUtilsToCheckFor }];

Expand Down
6 changes: 3 additions & 3 deletions tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand Down