@@ -45,24 +45,24 @@ module.exports = {
4545 }
4646 }
4747
48- const checkPropertyNode = ( p ) => {
49- if ( isForbiddenType ( p . value ) ) {
48+ const checkPropertyNode = ( key , node ) => {
49+ if ( isForbiddenType ( node ) ) {
5050 context . report ( {
51- node : p . value ,
51+ node : node ,
5252 message,
5353 data : {
54- name : utils . getStaticPropertyName ( p . key )
54+ name : utils . getStaticPropertyName ( key )
5555 } ,
56- fix : fix ( p . value )
56+ fix : fix ( node )
5757 } )
58- } else if ( p . value . type === 'ArrayExpression' ) {
59- p . value . elements
58+ } else if ( node . type === 'ArrayExpression' ) {
59+ node . elements
6060 . filter ( prop => isForbiddenType ( prop ) )
6161 . forEach ( prop => context . report ( {
6262 node : prop ,
6363 message,
6464 data : {
65- name : utils . getStaticPropertyName ( p . key )
65+ name : utils . getStaticPropertyName ( key )
6666 } ,
6767 fix : fix ( prop )
6868 } ) )
@@ -82,7 +82,7 @@ module.exports = {
8282 node . value . properties
8383 . forEach ( p => {
8484 if ( isForbiddenType ( p . value ) || p . value . type === 'ArrayExpression' ) {
85- checkPropertyNode ( p )
85+ checkPropertyNode ( p . key , p . value )
8686 } else if ( p . value . type === 'ObjectExpression' ) {
8787 const typeProperty = p . value . properties . find ( prop =>
8888 prop . type === 'Property' &&
@@ -91,7 +91,7 @@ module.exports = {
9191
9292 if ( ! typeProperty ) return
9393
94- checkPropertyNode ( typeProperty )
94+ checkPropertyNode ( p . key , typeProperty . value )
9595 }
9696 } )
9797 } )
0 commit comments