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(
118118
119119export function isRenderVariableDeclarator (
120120 node : TSESTree . VariableDeclarator ,
121- renderFunctions : string [ ] = [ ]
121+ renderFunctions : string [ ]
122122) {
123123 if ( node . init ) {
124124 if ( isAwaitExpression ( node . init ) ) {
Original file line number Diff line number Diff line change @@ -25,16 +25,30 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
2525 'Unexpected use of container methods. Prefer the use of "screen.someMethod()".' ,
2626 } ,
2727 fixable : null ,
28- schema : [ ] ,
28+ schema : [
29+ {
30+ type : 'object' ,
31+ properties : {
32+ renderFunctions : {
33+ type : 'array' ,
34+ } ,
35+ } ,
36+ } ,
37+ ] ,
2938 } ,
30- defaultOptions : [ ] ,
39+ defaultOptions : [
40+ {
41+ renderFunctions : [ ] ,
42+ } ,
43+ ] ,
3144
32- create ( context ) {
45+ create ( context , [ options ] ) {
46+ const { renderFunctions } = options ;
3347 let destructuredContainerName = '' ;
3448
3549 return {
3650 VariableDeclarator ( node ) {
37- if ( isRenderVariableDeclarator ( node ) ) {
51+ if ( isRenderVariableDeclarator ( node , renderFunctions ) ) {
3852 if ( isObjectPattern ( node . id ) ) {
3953 const containerIndex = node . id . properties . findIndex (
4054 property =>
@@ -45,8 +59,7 @@ export default ESLintUtils.RuleCreator(getDocsUrl)({
4559 if ( containerIndex !== - 1 ) {
4660 const nodeValue = node . id . properties [ containerIndex ] . value ;
4761 destructuredContainerName =
48- isIdentifier ( nodeValue ) &&
49- nodeValue . name ;
62+ isIdentifier ( nodeValue ) && nodeValue . name ;
5063 }
5164 }
5265 }
You can’t perform that action at this time.
0 commit comments