File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
lib/create-testing-library-rule Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { ESLintUtils } from '@typescript-eslint/utils' ;
2
2
3
- import { getDocsUrl , TestingLibraryPluginDocs } from '../utils' ;
3
+ import {
4
+ getDocsUrl ,
5
+ TestingLibraryPluginDocs ,
6
+ TestingLibraryPluginRuleModule ,
7
+ } from '../utils' ;
4
8
5
9
import {
6
10
DetectionOptions ,
@@ -27,11 +31,20 @@ export const createTestingLibraryRule = <
27
31
create : EnhancedRuleCreate < TMessageIds , TOptions > ;
28
32
detectionOptions ?: Partial < DetectionOptions > ;
29
33
}
30
- > ) =>
31
- ESLintUtils . RuleCreator < TestingLibraryPluginDocs < TOptions > > ( getDocsUrl ) ( {
34
+ > ) : TestingLibraryPluginRuleModule < TMessageIds , TOptions > => {
35
+ const rule = ESLintUtils . RuleCreator < TestingLibraryPluginDocs < TOptions > > (
36
+ getDocsUrl
37
+ ) ( {
32
38
...remainingConfig ,
33
39
create : detectTestingLibraryUtils < TMessageIds , TOptions > (
34
40
create ,
35
41
detectionOptions
36
42
) ,
37
43
} ) ;
44
+ const { docs } = rule . meta ;
45
+ if ( docs === undefined ) {
46
+ throw new Error ( 'Rule metadata must contain `docs` property' ) ;
47
+ }
48
+
49
+ return { ...rule , meta : { ...rule . meta , docs } } ;
50
+ } ;
You can’t perform that action at this time.
0 commit comments