File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,17 @@ module.exports = function (context) {
17
17
18
18
return {
19
19
"ImportSpecifier" : function ( node ) {
20
+ checkIdentifier ( node . local ) ;
20
21
locals . add ( node . local . name ) ;
21
22
} ,
22
23
23
24
"ImportDefaultSpecifier" : function ( node ) {
25
+ checkIdentifier ( node . local ) ;
24
26
locals . add ( node . local . name ) ;
25
27
} ,
26
28
27
29
"ImportNamespaceSpecifier" : function ( node ) {
30
+ checkIdentifier ( node . local ) ;
28
31
locals . add ( node . local . name ) ;
29
32
namespaces . add ( node . local . name ) ;
30
33
} ,
Original file line number Diff line number Diff line change @@ -42,9 +42,20 @@ eslintTester.addRuleTest("lib/rules/no-reassign", {
42
42
code : "import { foo } from './bar';\nvar bar = 32, foo = function() { return false; }" ,
43
43
errors : [ { message : "Reassignment of local imported name 'foo'." } ] } ) ,
44
44
45
+ test ( {
46
+ code : "import { foo } from './bar';\nimport { foo } from './common';" ,
47
+ errors : [ { message : "Reassignment of local imported name 'foo'." } ] } ) ,
48
+
49
+ test ( {
50
+ code : "import { foo } from './bar';\nimport foo from './common';" ,
51
+ errors : [ { message : "Reassignment of local imported name 'foo'." } ] } ) ,
52
+
53
+ test ( {
54
+ code : "import { foo } from './bar';\nimport * as foo from './common';" ,
55
+ errors : [ { message : "Reassignment of local imported name 'foo'." } ] } ) ,
56
+
45
57
test ( {
46
58
code : "import * as foo from './bar'; foo.x = 'y';" ,
47
- errors : [ { message : "Assignment to member of namespace 'foo'." } ]
48
- } )
59
+ errors : [ { message : "Assignment to member of namespace 'foo'." } ] } )
49
60
]
50
61
} ) ;
You can’t perform that action at this time.
0 commit comments