forked from testing-library/eslint-plugin-testing-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
36 lines (33 loc) · 1.16 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import type { TSESLint } from '@typescript-eslint/utils';
type RecommendedConfig<TOptions extends readonly unknown[]> =
| TSESLint.RuleMetaDataDocs['recommended']
| [TSESLint.RuleMetaDataDocs['recommended'], ...TOptions];
// These 2 types are copied from @typescript-eslint/utils' CreateRuleMeta
// and modified to our needs
export type TestingLibraryRuleMetaDocs<TOptions extends readonly unknown[]> =
Omit<TSESLint.RuleMetaDataDocs, 'recommended' | 'url'> & {
/**
* The recommendation level for the rule on a framework basis.
* Used by the build tools to generate the framework config.
* Set to false to not include it the config
*/
recommendedConfig: Record<
SupportedTestingFramework,
RecommendedConfig<TOptions>
>;
};
export type TestingLibraryRuleMeta<
TMessageIds extends string,
TOptions extends readonly unknown[]
> = Omit<TSESLint.RuleMetaData<TMessageIds>, 'docs'> & {
docs: TestingLibraryRuleMetaDocs<TOptions>;
};
export const SUPPORTED_TESTING_FRAMEWORKS = [
'dom',
'angular',
'react',
'vue',
'marko',
] as const;
export type SupportedTestingFramework =
typeof SUPPORTED_TESTING_FRAMEWORKS[number];