File tree 2 files changed +39
-3
lines changed
2 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ module.exports = {
58
58
return
59
59
}
60
60
61
- for ( let specifier of declaration . specifiers ) {
61
+ for ( const specifier of declaration . specifiers ) {
62
62
switch ( specifier . type ) {
63
63
case 'ImportNamespaceSpecifier' :
64
64
if ( ! imports . size ) {
@@ -160,8 +160,12 @@ module.exports = {
160
160
161
161
if ( pattern . type !== 'ObjectPattern' ) return
162
162
163
- for ( let property of pattern . properties ) {
164
- if ( property . type === 'ExperimentalRestProperty' || ! property . key ) {
163
+ for ( const property of pattern . properties ) {
164
+ if (
165
+ property . type === 'ExperimentalRestProperty'
166
+ || property . type === 'RestElement'
167
+ || ! property . key
168
+ ) {
165
169
continue
166
170
}
167
171
@@ -189,6 +193,17 @@ module.exports = {
189
193
190
194
testKey ( id , namespaces . get ( init . name ) )
191
195
} ,
196
+
197
+ 'JSXMemberExpression' : function ( { object, property} ) {
198
+ if ( ! namespaces . has ( object . name ) ) return
199
+ var namespace = namespaces . get ( object . name )
200
+ if ( ! namespace . has ( property . name ) ) {
201
+ context . report ( {
202
+ node : property ,
203
+ message : makeMessage ( property , [ object . name ] ) ,
204
+ } )
205
+ }
206
+ } ,
192
207
}
193
208
} ,
194
209
}
Original file line number Diff line number Diff line change @@ -104,6 +104,16 @@ const valid = [
104
104
parser : 'babel-eslint' ,
105
105
} ) ,
106
106
107
+ // JSX
108
+ test ( {
109
+ code : 'import * as Names from "./named-exports"; const Foo = <Names.a/>' ,
110
+ parserOptions : {
111
+ ecmaFeatures : {
112
+ jsx : true ,
113
+ } ,
114
+ } ,
115
+ } ) ,
116
+
107
117
...SYNTAX_CASES ,
108
118
]
109
119
@@ -185,6 +195,17 @@ const invalid = [
185
195
errors : [ `'default' not found in imported namespace 'ree'.` ] ,
186
196
} ) ,
187
197
198
+ // JSX
199
+ test ( {
200
+ code : 'import * as Names from "./named-exports"; const Foo = <Names.e/>' ,
201
+ errors : [ error ( 'e' , 'Names' ) ] ,
202
+ parserOptions : {
203
+ ecmaFeatures : {
204
+ jsx : true ,
205
+ } ,
206
+ } ,
207
+ } ) ,
208
+
188
209
]
189
210
190
211
///////////////////////
You can’t perform that action at this time.
0 commit comments