@@ -79,8 +79,8 @@ module.exports = {
79
79
} )
80
80
}
81
81
82
- function checkForRestrictedImportPath ( importPath , node ) {
83
- const absoluteImportPath = resolve ( importPath , context )
82
+ function checkForRestrictedImportPath ( importPathNode , importNode ) {
83
+ const absoluteImportPath = resolve ( importPathNode . value , context )
84
84
85
85
if ( ! absoluteImportPath ) {
86
86
return
@@ -101,7 +101,7 @@ module.exports = {
101
101
. every ( ( absoluteExceptionPath ) => isValidExceptionPath ( absoluteFrom , absoluteExceptionPath ) )
102
102
103
103
if ( ! hasValidExceptionPaths ) {
104
- reportInvalidExceptionPath ( node )
104
+ reportInvalidExceptionPath ( importPathNode )
105
105
return
106
106
}
107
107
@@ -113,29 +113,29 @@ module.exports = {
113
113
}
114
114
115
115
const typeIsExpected = ( zone . allowedImportKinds || allowedImportKinds )
116
- . some ( ( kind ) => node . parent && kind === node . parent . importKind )
116
+ . some ( ( kind ) => kind === importNode . importKind )
117
117
118
118
if ( typeIsExpected ) {
119
119
return
120
120
}
121
121
122
122
context . report ( {
123
- node,
123
+ node : importPathNode ,
124
124
message : `Unexpected path "{{importPath}}" imported in restricted zone.${ zone . message ? ` ${ zone . message } ` : '' } ` ,
125
- data : { importPath } ,
125
+ data : { importPath : importPathNode . value } ,
126
126
} )
127
127
} )
128
128
}
129
129
130
130
return {
131
131
ImportDeclaration ( node ) {
132
- checkForRestrictedImportPath ( node . source . value , node . source )
132
+ checkForRestrictedImportPath ( node . source , node )
133
133
} ,
134
134
CallExpression ( node ) {
135
135
if ( isStaticRequire ( node ) ) {
136
136
const [ firstArgument ] = node . arguments
137
137
138
- checkForRestrictedImportPath ( firstArgument . value , firstArgument )
138
+ checkForRestrictedImportPath ( firstArgument , node )
139
139
}
140
140
} ,
141
141
}
0 commit comments