6
6
TSESTree ,
7
7
} from '@typescript-eslint/utils' ;
8
8
9
+ import { TestingLibraryContext } from '../create-testing-library-rule/detect-testing-library-utils' ;
9
10
import {
10
11
isImportDefaultSpecifier ,
11
12
isImportExpression ,
@@ -153,9 +154,12 @@ interface ResolvedTestingLibraryUserEventFn {
153
154
154
155
const USER_EVENT_PACKAGE = '@testing-library/user-event' ;
155
156
156
- export const resolveToTestingLibraryFn = (
157
+ export const resolveToTestingLibraryFn = <
158
+ TMessageIds extends string ,
159
+ TOptions extends readonly unknown [ ] ,
160
+ > (
157
161
node : TSESTree . CallExpression ,
158
- context : TSESLint . RuleContext < string , unknown [ ] >
162
+ context : TestingLibraryContext < TMessageIds , TOptions >
159
163
) : ResolvedTestingLibraryUserEventFn | null => {
160
164
const chain = getNodeChain ( node ) ;
161
165
if ( ! chain ?. length ) return null ;
@@ -168,8 +172,9 @@ export const resolveToTestingLibraryFn = (
168
172
return null ;
169
173
}
170
174
175
+ const customModuleSetting = context . settings [ 'testing-library/utils-module' ] ;
171
176
if (
172
- [ ...LIBRARY_MODULES , USER_EVENT_PACKAGE ] . some (
177
+ [ ...LIBRARY_MODULES , USER_EVENT_PACKAGE , customModuleSetting ] . some (
173
178
( module ) => module === maybeImport . source
174
179
)
175
180
) {
0 commit comments