-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
815 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Enforce promises from async queries to be handled. | ||
* | ||
* @see [await-async-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-async-query.md) | ||
*/ | ||
export type AwaitAsyncQueryRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* Enforce promises from async queries to be handled. | ||
* | ||
* @see [await-async-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-async-query.md) | ||
*/ | ||
export interface AwaitAsyncQueryRule { | ||
/** | ||
* Enforce promises from async queries to be handled. | ||
* | ||
* @see [await-async-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-async-query.md) | ||
*/ | ||
'testing-library/await-async-query': AwaitAsyncQueryRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Enforce promises from async utils to be awaited properly. | ||
* | ||
* @see [await-async-utils](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-async-utils.md) | ||
*/ | ||
export type AwaitAsyncUtilsRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* Enforce promises from async utils to be awaited properly. | ||
* | ||
* @see [await-async-utils](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-async-utils.md) | ||
*/ | ||
export interface AwaitAsyncUtilsRule { | ||
/** | ||
* Enforce promises from async utils to be awaited properly. | ||
* | ||
* @see [await-async-utils](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-async-utils.md) | ||
*/ | ||
'testing-library/await-async-utils': AwaitAsyncUtilsRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Enforce promises from `fireEvent` methods to be handled. | ||
* | ||
* @see [await-fire-event](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-fire-event.md) | ||
*/ | ||
export type AwaitFireEventRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* Enforce promises from `fireEvent` methods to be handled. | ||
* | ||
* @see [await-fire-event](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-fire-event.md) | ||
*/ | ||
export interface AwaitFireEventRule { | ||
/** | ||
* Enforce promises from `fireEvent` methods to be handled. | ||
* | ||
* @see [await-fire-event](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/await-fire-event.md) | ||
*/ | ||
'testing-library/await-fire-event': AwaitFireEventRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export interface ConsistentDataTestidOption { | ||
testIdPattern: string; | ||
testIdAttribute?: string | string[]; | ||
customMessage?: string; | ||
} | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type ConsistentDataTestidOptions = [ConsistentDataTestidOption?]; | ||
|
||
/** | ||
* Ensures consistent usage of `data-testid`. | ||
* | ||
* @see [consistent-data-testid](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/consistent-data-testid.md) | ||
*/ | ||
export type ConsistentDataTestidRuleConfig = | ||
RuleConfig<ConsistentDataTestidOptions>; | ||
|
||
/** | ||
* Ensures consistent usage of `data-testid`. | ||
* | ||
* @see [consistent-data-testid](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/consistent-data-testid.md) | ||
*/ | ||
export interface ConsistentDataTestidRule { | ||
/** | ||
* Ensures consistent usage of `data-testid`. | ||
* | ||
* @see [consistent-data-testid](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/consistent-data-testid.md) | ||
*/ | ||
'testing-library/consistent-data-testid': ConsistentDataTestidRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import type { AwaitAsyncQueryRule } from './await-async-query'; | ||
import type { AwaitAsyncUtilsRule } from './await-async-utils'; | ||
import type { AwaitFireEventRule } from './await-fire-event'; | ||
import type { ConsistentDataTestidRule } from './consistent-data-testid'; | ||
import type { NoAwaitSyncEventsRule } from './no-await-sync-events'; | ||
import type { NoAwaitSyncQueryRule } from './no-await-sync-query'; | ||
import type { NoContainerRule } from './no-container'; | ||
import type { NoDebuggingUtilsRule } from './no-debugging-utils'; | ||
import type { NoDomImportRule } from './no-dom-import'; | ||
import type { NoGlobalRegexpFlagInQueryRule } from './no-global-regexp-flag-in-query'; | ||
import type { NoManualCleanupRule } from './no-manual-cleanup'; | ||
import type { NoNodeAccessRule } from './no-node-access'; | ||
import type { NoPromiseInFireEventRule } from './no-promise-in-fire-event'; | ||
import type { NoRenderInSetupRule } from './no-render-in-setup'; | ||
import type { NoUnnecessaryActRule } from './no-unnecessary-act'; | ||
import type { NoWaitForEmptyCallbackRule } from './no-wait-for-empty-callback'; | ||
import type { NoWaitForMultipleAssertionsRule } from './no-wait-for-multiple-assertions'; | ||
import type { NoWaitForSideEffectsRule } from './no-wait-for-side-effects'; | ||
import type { NoWaitForSnapshotRule } from './no-wait-for-snapshot'; | ||
import type { PreferExplicitAssertRule } from './prefer-explicit-assert'; | ||
import type { PreferFindByRule } from './prefer-find-by'; | ||
import type { PreferPresenceQueriesRule } from './prefer-presence-queries'; | ||
import type { PreferQueryByDisappearanceRule } from './prefer-query-by-disappearance'; | ||
import type { PreferScreenQueriesRule } from './prefer-screen-queries'; | ||
import type { PreferUserEventRule } from './prefer-user-event'; | ||
import type { PreferWaitForRule } from './prefer-wait-for'; | ||
import type { RenderResultNamingConventionRule } from './render-result-naming-convention'; | ||
|
||
/** | ||
* All TestingLibrary rules. | ||
*/ | ||
export type TestingLibraryRules = AwaitAsyncQueryRule & | ||
AwaitAsyncUtilsRule & | ||
AwaitFireEventRule & | ||
ConsistentDataTestidRule & | ||
NoAwaitSyncEventsRule & | ||
NoAwaitSyncQueryRule & | ||
NoContainerRule & | ||
NoDebuggingUtilsRule & | ||
NoDomImportRule & | ||
NoGlobalRegexpFlagInQueryRule & | ||
NoManualCleanupRule & | ||
NoNodeAccessRule & | ||
NoPromiseInFireEventRule & | ||
NoRenderInSetupRule & | ||
NoUnnecessaryActRule & | ||
NoWaitForEmptyCallbackRule & | ||
NoWaitForMultipleAssertionsRule & | ||
NoWaitForSideEffectsRule & | ||
NoWaitForSnapshotRule & | ||
PreferExplicitAssertRule & | ||
PreferFindByRule & | ||
PreferPresenceQueriesRule & | ||
PreferQueryByDisappearanceRule & | ||
PreferScreenQueriesRule & | ||
PreferUserEventRule & | ||
PreferWaitForRule & | ||
RenderResultNamingConventionRule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export interface NoAwaitSyncEventsOption { | ||
/** | ||
* @minItems 1 | ||
*/ | ||
eventModules?: [ | ||
'fire-event' | 'user-event', | ||
...('fire-event' | 'user-event')[], | ||
]; | ||
} | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type NoAwaitSyncEventsOptions = [NoAwaitSyncEventsOption?]; | ||
|
||
/** | ||
* Disallow unnecessary `await` for sync events. | ||
* | ||
* @see [no-await-sync-events](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-await-sync-events.md) | ||
*/ | ||
export type NoAwaitSyncEventsRuleConfig = RuleConfig<NoAwaitSyncEventsOptions>; | ||
|
||
/** | ||
* Disallow unnecessary `await` for sync events. | ||
* | ||
* @see [no-await-sync-events](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-await-sync-events.md) | ||
*/ | ||
export interface NoAwaitSyncEventsRule { | ||
/** | ||
* Disallow unnecessary `await` for sync events. | ||
* | ||
* @see [no-await-sync-events](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-await-sync-events.md) | ||
*/ | ||
'testing-library/no-await-sync-events': NoAwaitSyncEventsRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Disallow unnecessary `await` for sync queries. | ||
* | ||
* @see [no-await-sync-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-await-sync-query.md) | ||
*/ | ||
export type NoAwaitSyncQueryRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* Disallow unnecessary `await` for sync queries. | ||
* | ||
* @see [no-await-sync-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-await-sync-query.md) | ||
*/ | ||
export interface NoAwaitSyncQueryRule { | ||
/** | ||
* Disallow unnecessary `await` for sync queries. | ||
* | ||
* @see [no-await-sync-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-await-sync-query.md) | ||
*/ | ||
'testing-library/no-await-sync-query': NoAwaitSyncQueryRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Disallow the use of `container` methods. | ||
* | ||
* @see [no-container](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-container.md) | ||
*/ | ||
export type NoContainerRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* Disallow the use of `container` methods. | ||
* | ||
* @see [no-container](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-container.md) | ||
*/ | ||
export interface NoContainerRule { | ||
/** | ||
* Disallow the use of `container` methods. | ||
* | ||
* @see [no-container](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-container.md) | ||
*/ | ||
'testing-library/no-container': NoContainerRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export interface NoDebuggingUtilsOption { | ||
utilsToCheckFor?: { | ||
prettyFormat?: boolean; | ||
logDOM?: boolean; | ||
logRoles?: boolean; | ||
prettyDOM?: boolean; | ||
logTestingPlaygroundURL?: boolean; | ||
debug?: boolean; | ||
}; | ||
} | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type NoDebuggingUtilsOptions = [NoDebuggingUtilsOption?]; | ||
|
||
/** | ||
* Disallow the use of debugging utilities like `debug`. | ||
* | ||
* @see [no-debugging-utils](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-debugging-utils.md) | ||
*/ | ||
export type NoDebuggingUtilsRuleConfig = RuleConfig<NoDebuggingUtilsOptions>; | ||
|
||
/** | ||
* Disallow the use of debugging utilities like `debug`. | ||
* | ||
* @see [no-debugging-utils](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-debugging-utils.md) | ||
*/ | ||
export interface NoDebuggingUtilsRule { | ||
/** | ||
* Disallow the use of debugging utilities like `debug`. | ||
* | ||
* @see [no-debugging-utils](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-debugging-utils.md) | ||
*/ | ||
'testing-library/no-debugging-utils': NoDebuggingUtilsRuleConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Option. | ||
*/ | ||
export type NoDomImportOption = string; | ||
|
||
/** | ||
* Options. | ||
*/ | ||
export type NoDomImportOptions = [NoDomImportOption?]; | ||
|
||
/** | ||
* Disallow importing from DOM Testing Library. | ||
* | ||
* @see [no-dom-import](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-dom-import.md) | ||
*/ | ||
export type NoDomImportRuleConfig = RuleConfig<NoDomImportOptions>; | ||
|
||
/** | ||
* Disallow importing from DOM Testing Library. | ||
* | ||
* @see [no-dom-import](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-dom-import.md) | ||
*/ | ||
export interface NoDomImportRule { | ||
/** | ||
* Disallow importing from DOM Testing Library. | ||
* | ||
* @see [no-dom-import](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-dom-import.md) | ||
*/ | ||
'testing-library/no-dom-import': NoDomImportRuleConfig; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/rules/testing-library/no-global-regexp-flag-in-query.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { RuleConfig } from '../rule-config'; | ||
|
||
/** | ||
* Disallow the use of the global RegExp flag (/g) in queries. | ||
* | ||
* @see [no-global-regexp-flag-in-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-global-regexp-flag-in-query.md) | ||
*/ | ||
export type NoGlobalRegexpFlagInQueryRuleConfig = RuleConfig<[]>; | ||
|
||
/** | ||
* Disallow the use of the global RegExp flag (/g) in queries. | ||
* | ||
* @see [no-global-regexp-flag-in-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-global-regexp-flag-in-query.md) | ||
*/ | ||
export interface NoGlobalRegexpFlagInQueryRule { | ||
/** | ||
* Disallow the use of the global RegExp flag (/g) in queries. | ||
* | ||
* @see [no-global-regexp-flag-in-query](https://github.com/testing-library/eslint-plugin-testing-library/tree/main/docs/rules/no-global-regexp-flag-in-query.md) | ||
*/ | ||
'testing-library/no-global-regexp-flag-in-query': NoGlobalRegexpFlagInQueryRuleConfig; | ||
} |
Oops, something went wrong.