Skip to content

Commit 57602e6

Browse files
committed
feat: recommend no-wait-for-empty-callback
1 parent 185180a commit 57602e6

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
[![Tweet][tweet-badge]][tweet-url]
2424

2525
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
26+
2627
[![All Contributors](https://img.shields.io/badge/all_contributors-24-orange.svg?style=flat-square)](#contributors-)
28+
2729
<!-- ALL-CONTRIBUTORS-BADGE:END -->
2830

2931
## Installation
@@ -141,7 +143,7 @@ To enable this configuration use the `extends` property in your
141143
| [no-debug](docs/rules/no-debug.md) | Disallow the use of `debug` | ![angular-badge][] ![react-badge][] ![vue-badge][] | |
142144
| [no-dom-import](docs/rules/no-dom-import.md) | Disallow importing from DOM Testing Library | ![angular-badge][] ![react-badge][] ![vue-badge][] | ![fixable-badge][] |
143145
| [no-manual-cleanup](docs/rules/no-manual-cleanup.md) | Disallow the use of `cleanup` | | |
144-
| [no-wait-for-empty-callback](docs/rules/no-wait-for-empty-callback.md) | Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved` | | |
146+
| [no-wait-for-empty-callback](docs/rules/no-wait-for-empty-callback.md) | Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved` | ![recommended-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | |
145147
| [prefer-explicit-assert](docs/rules/prefer-explicit-assert.md) | Suggest using explicit assertions rather than just `getBy*` queries | | |
146148
| [prefer-find-by](docs/rules/prefer-find-by.md) | Suggest using `findBy*` methods instead of the `waitFor` + `getBy` queries | ![recommended-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] | ![fixable-badge][] |
147149
| [prefer-presence-queries](docs/rules/prefer-presence-queries.md) | Enforce specific queries when checking element is present or not | | |
@@ -212,6 +214,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
212214

213215
<!-- markdownlint-enable -->
214216
<!-- prettier-ignore-end -->
217+
215218
<!-- ALL-CONTRIBUTORS-LIST:END -->
216219

217220
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

lib/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const recommendedRules = {
3434
'testing-library/await-async-query': 'error',
3535
'testing-library/await-async-utils': 'error',
3636
'testing-library/no-await-sync-query': 'error',
37+
'testing-library/no-wait-for-empty-callback': 'error',
3738
'testing-library/prefer-find-by': 'error',
3839
};
3940

lib/rules/no-wait-for-empty-callback.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)<Options, MessageIds>({
2121
description:
2222
"It's preferred to avoid empty callbacks in `waitFor` and `waitForElementToBeRemoved`",
2323
category: 'Best Practices',
24-
recommended: false,
24+
recommended: 'error',
2525
},
2626
messages: {
2727
noWaitForEmptyCallback:

tests/__snapshots__/index.test.ts.snap

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Object {
1414
"error",
1515
"angular",
1616
],
17+
"testing-library/no-wait-for-empty-callback": "error",
1718
"testing-library/prefer-find-by": "error",
1819
},
1920
}
@@ -33,6 +34,7 @@ Object {
3334
"error",
3435
"react",
3536
],
37+
"testing-library/no-wait-for-empty-callback": "error",
3638
"testing-library/prefer-find-by": "error",
3739
},
3840
}
@@ -47,6 +49,7 @@ Object {
4749
"testing-library/await-async-query": "error",
4850
"testing-library/await-async-utils": "error",
4951
"testing-library/no-await-sync-query": "error",
52+
"testing-library/no-wait-for-empty-callback": "error",
5053
"testing-library/prefer-find-by": "error",
5154
},
5255
}
@@ -67,6 +70,7 @@ Object {
6770
"error",
6871
"vue",
6972
],
73+
"testing-library/no-wait-for-empty-callback": "error",
7074
"testing-library/prefer-find-by": "error",
7175
},
7276
}

0 commit comments

Comments
 (0)