Skip to content

Commit

Permalink
feat(no-unnecessary-act): add to React config by default (#468)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `no-unnecessary-act` is now enabled by default in the React config (with `isStrict` set to `true`)
  • Loading branch information
MichaelDeBoey authored Sep 6, 2021
1 parent ea52ff0 commit cf78530
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ To enable this configuration use the `extends` property in your
| [`testing-library/no-node-access`](./docs/rules/no-node-access.md) | Disallow direct Node access | | ![angular-badge][] ![react-badge][] ![vue-badge][] |
| [`testing-library/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][] |
| [`testing-library/no-render-in-setup`](./docs/rules/no-render-in-setup.md) | Disallow the use of `render` in testing frameworks setup functions | | |
| [`testing-library/no-unnecessary-act`](./docs/rules/no-unnecessary-act.md) | Disallow wrapping Testing Library utils or empty callbacks in `act` | | |
| [`testing-library/no-unnecessary-act`](./docs/rules/no-unnecessary-act.md) | Disallow wrapping Testing Library utils or empty callbacks in `act` | | ![react-badge][] |
| [`testing-library/no-wait-for-empty-callback`](./docs/rules/no-wait-for-empty-callback.md) | Disallow empty callbacks for `waitFor` and `waitForElementToBeRemoved` | | ![dom-badge][] ![angular-badge][] ![react-badge][] ![vue-badge][] |
| [`testing-library/no-wait-for-multiple-assertions`](./docs/rules/no-wait-for-multiple-assertions.md) | Disallow the use of multiple `expect` calls inside `waitFor` | | |
| [`testing-library/no-wait-for-side-effects`](./docs/rules/no-wait-for-side-effects.md) | Disallow the use of side effects in `waitFor` | | |
Expand Down
1 change: 1 addition & 0 deletions lib/configs/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export = {
'testing-library/no-dom-import': ['error', 'react'],
'testing-library/no-node-access': 'error',
'testing-library/no-promise-in-fire-event': 'error',
'testing-library/no-unnecessary-act': ['error', { isStrict: true }],
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/prefer-find-by': 'error',
'testing-library/prefer-screen-queries': 'error',
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/no-unnecessary-act.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default createTestingLibraryRule<Options, MessageIds>({
recommendedConfig: {
dom: false,
angular: false,
react: false,
react: ['error', { isStrict: true }],
vue: false,
},
},
Expand Down
6 changes: 6 additions & 0 deletions tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ Object {
],
"testing-library/no-node-access": "error",
"testing-library/no-promise-in-fire-event": "error",
"testing-library/no-unnecessary-act": Array [
"error",
Object {
"isStrict": true,
},
],
"testing-library/no-wait-for-empty-callback": "error",
"testing-library/prefer-find-by": "error",
"testing-library/prefer-screen-queries": "error",
Expand Down

0 comments on commit cf78530

Please sign in to comment.