66 TSESTree ,
77} from '@typescript-eslint/utils' ;
88
9+ import { TestingLibraryContext } from '../create-testing-library-rule/detect-testing-library-utils' ;
910import {
1011 isImportDefaultSpecifier ,
1112 isImportExpression ,
@@ -153,9 +154,12 @@ interface ResolvedTestingLibraryUserEventFn {
153154
154155const USER_EVENT_PACKAGE = '@testing-library/user-event' ;
155156
156- export const resolveToTestingLibraryFn = (
157+ export const resolveToTestingLibraryFn = <
158+ TMessageIds extends string ,
159+ TOptions extends readonly unknown [ ] ,
160+ > (
157161 node : TSESTree . CallExpression ,
158- context : TSESLint . RuleContext < string , unknown [ ] >
162+ context : TestingLibraryContext < TMessageIds , TOptions >
159163) : ResolvedTestingLibraryUserEventFn | null => {
160164 const chain = getNodeChain ( node ) ;
161165 if ( ! chain ?. length ) return null ;
@@ -168,8 +172,9 @@ export const resolveToTestingLibraryFn = (
168172 return null ;
169173 }
170174
175+ const customModuleSetting = context . settings [ 'testing-library/utils-module' ] ;
171176 if (
172- [ ...LIBRARY_MODULES , USER_EVENT_PACKAGE ] . some (
177+ [ ...LIBRARY_MODULES , USER_EVENT_PACKAGE , customModuleSetting ] . some (
173178 ( module ) => module === maybeImport . source
174179 )
175180 ) {
0 commit comments