File tree Expand file tree Collapse file tree
lib/create-testing-library-rule Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { ESLintUtils } from '@typescript-eslint/utils' ;
22
3- import { getDocsUrl , TestingLibraryPluginDocs } from '../utils' ;
3+ import {
4+ getDocsUrl ,
5+ TestingLibraryPluginDocs ,
6+ TestingLibraryPluginRuleModule ,
7+ } from '../utils' ;
48
59import {
610 DetectionOptions ,
@@ -27,11 +31,20 @@ export const createTestingLibraryRule = <
2731 create : EnhancedRuleCreate < TMessageIds , TOptions > ;
2832 detectionOptions ?: Partial < DetectionOptions > ;
2933 }
30- > ) =>
31- ESLintUtils . RuleCreator < TestingLibraryPluginDocs < TOptions > > ( getDocsUrl ) ( {
34+ > ) : TestingLibraryPluginRuleModule < TMessageIds , TOptions > => {
35+ const rule = ESLintUtils . RuleCreator < TestingLibraryPluginDocs < TOptions > > (
36+ getDocsUrl
37+ ) ( {
3238 ...remainingConfig ,
3339 create : detectTestingLibraryUtils < TMessageIds , TOptions > (
3440 create ,
3541 detectionOptions
3642 ) ,
3743 } ) ;
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