File tree Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Expand file tree Collapse file tree 2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ function isRenderFunction(
118
118
119
119
export function isRenderVariableDeclarator (
120
120
node : TSESTree . VariableDeclarator ,
121
- renderFunctions : string [ ] = [ ]
121
+ renderFunctions : string [ ]
122
122
) {
123
123
if ( node . init ) {
124
124
if ( isAwaitExpression ( node . init ) ) {
Original file line number Diff line number Diff line change @@ -25,16 +25,30 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
25
25
'Unexpected use of container methods. Prefer the use of "screen.someMethod()".' ,
26
26
} ,
27
27
fixable : null ,
28
- schema : [ ] ,
28
+ schema : [
29
+ {
30
+ type : 'object' ,
31
+ properties : {
32
+ renderFunctions : {
33
+ type : 'array' ,
34
+ } ,
35
+ } ,
36
+ } ,
37
+ ] ,
29
38
} ,
30
- defaultOptions : [ ] ,
39
+ defaultOptions : [
40
+ {
41
+ renderFunctions : [ ] ,
42
+ } ,
43
+ ] ,
31
44
32
- create ( context ) {
45
+ create ( context , [ options ] ) {
46
+ const { renderFunctions } = options ;
33
47
let destructuredContainerName = '' ;
34
48
35
49
return {
36
50
VariableDeclarator ( node ) {
37
- if ( isRenderVariableDeclarator ( node ) ) {
51
+ if ( isRenderVariableDeclarator ( node , renderFunctions ) ) {
38
52
if ( isObjectPattern ( node . id ) ) {
39
53
const containerIndex = node . id . properties . findIndex (
40
54
property =>
@@ -45,8 +59,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
45
59
if ( containerIndex !== - 1 ) {
46
60
const nodeValue = node . id . properties [ containerIndex ] . value ;
47
61
destructuredContainerName =
48
- isIdentifier ( nodeValue ) &&
49
- nodeValue . name ;
62
+ isIdentifier ( nodeValue ) && nodeValue . name ;
50
63
}
51
64
}
52
65
}
You can’t perform that action at this time.
0 commit comments