Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 6dc2b57

Browse files
committed
Update testing-library rules
1 parent 1efd575 commit 6dc2b57

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/rules/testing-library/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import type { PreferExplicitAssertRule } from './prefer-explicit-assert';
2121
import type { PreferFindByRule } from './prefer-find-by';
2222
import type { PreferPresenceQueriesRule } from './prefer-presence-queries';
2323
import type { PreferQueryByDisappearanceRule } from './prefer-query-by-disappearance';
24+
import type { PreferQueryMatchersRule } from './prefer-query-matchers';
2425
import type { PreferScreenQueriesRule } from './prefer-screen-queries';
2526
import type { PreferUserEventRule } from './prefer-user-event';
2627
import type { PreferWaitForRule } from './prefer-wait-for';
@@ -52,6 +53,7 @@ export type TestingLibraryRules = AwaitAsyncQueryRule &
5253
PreferFindByRule &
5354
PreferPresenceQueriesRule &
5455
PreferQueryByDisappearanceRule &
56+
PreferQueryMatchersRule &
5557
PreferScreenQueriesRule &
5658
PreferUserEventRule &
5759
PreferWaitForRule &
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export interface PreferQueryMatchersOption {
7+
validEntries?: {
8+
query?: 'get' | 'query';
9+
matcher?: string;
10+
[k: string]: any;
11+
}[];
12+
}
13+
14+
/**
15+
* Options.
16+
*/
17+
export type PreferQueryMatchersOptions = [PreferQueryMatchersOption?];
18+
19+
/**
20+
* Ensure the configured `get*`/`query*` query is used with the corresponding matchers.
21+
*
22+
* @see [prefer-query-matchers](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/prefer-query-matchers.md)
23+
*/
24+
export type PreferQueryMatchersRuleConfig =
25+
RuleConfig<PreferQueryMatchersOptions>;
26+
27+
/**
28+
* Ensure the configured `get*`/`query*` query is used with the corresponding matchers.
29+
*
30+
* @see [prefer-query-matchers](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/prefer-query-matchers.md)
31+
*/
32+
export interface PreferQueryMatchersRule {
33+
/**
34+
* Ensure the configured `get*`/`query*` query is used with the corresponding matchers.
35+
*
36+
* @see [prefer-query-matchers](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/prefer-query-matchers.md)
37+
*/
38+
'testing-library/prefer-query-matchers': PreferQueryMatchersRuleConfig;
39+
}

0 commit comments

Comments
 (0)