@@ -45,24 +45,24 @@ module.exports = {
45
45
}
46
46
}
47
47
48
- const checkPropertyNode = ( p ) => {
49
- if ( isForbiddenType ( p . value ) ) {
48
+ const checkPropertyNode = ( key , node ) => {
49
+ if ( isForbiddenType ( node ) ) {
50
50
context . report ( {
51
- node : p . value ,
51
+ node : node ,
52
52
message,
53
53
data : {
54
- name : utils . getStaticPropertyName ( p . key )
54
+ name : utils . getStaticPropertyName ( key )
55
55
} ,
56
- fix : fix ( p . value )
56
+ fix : fix ( node )
57
57
} )
58
- } else if ( p . value . type === 'ArrayExpression' ) {
59
- p . value . elements
58
+ } else if ( node . type === 'ArrayExpression' ) {
59
+ node . elements
60
60
. filter ( prop => isForbiddenType ( prop ) )
61
61
. forEach ( prop => context . report ( {
62
62
node : prop ,
63
63
message,
64
64
data : {
65
- name : utils . getStaticPropertyName ( p . key )
65
+ name : utils . getStaticPropertyName ( key )
66
66
} ,
67
67
fix : fix ( prop )
68
68
} ) )
@@ -82,7 +82,7 @@ module.exports = {
82
82
node . value . properties
83
83
. forEach ( p => {
84
84
if ( isForbiddenType ( p . value ) || p . value . type === 'ArrayExpression' ) {
85
- checkPropertyNode ( p )
85
+ checkPropertyNode ( p . key , p . value )
86
86
} else if ( p . value . type === 'ObjectExpression' ) {
87
87
const typeProperty = p . value . properties . find ( prop =>
88
88
prop . type === 'Property' &&
@@ -91,7 +91,7 @@ module.exports = {
91
91
92
92
if ( ! typeProperty ) return
93
93
94
- checkPropertyNode ( typeProperty )
94
+ checkPropertyNode ( p . key , typeProperty . value )
95
95
}
96
96
} )
97
97
} )
0 commit comments