Skip to content

Commit 64baa91

Browse files
committed
[import/named] fix destructuring assignemnt
1 parent db471a8 commit 64baa91

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/ExportMap.js

+4
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,10 @@ export function recursivePatternCapture(pattern, callback) {
512512
recursivePatternCapture(element, callback)
513513
})
514514
break
515+
516+
case 'AssignmentPattern':
517+
callback(pattern.left)
518+
break
515519
}
516520
}
517521

tests/files/named-exports.js

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export class ExportedClass {
1414
// destructuring exports
1515

1616
export var { destructuredProp } = {}
17+
, { destructingAssign = null } = {}
18+
, { destructingAssign: destructingRenamedAssign = null } = {}
1719
, [ arrayKeyProp ] = []
1820
, [ { deepProp } ] = []
1921
, { arr: [ ,, deepSparseElement ] } = {}

tests/src/rules/named.js

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ ruleTester.run('named', rule, {
2222
test({code: 'import bar, { foo } from "./bar.js"'}),
2323
test({code: 'import {a, b, d} from "./named-exports"'}),
2424
test({code: 'import {ExportedClass} from "./named-exports"'}),
25+
test({code: 'import { destructingAssign } from "./named-exports"'}),
26+
test({code: 'import { destructingRenamedAssign } from "./named-exports"'}),
2527
test({code: 'import { ActionTypes } from "./qc"'}),
2628
test({code: 'import {a, b, c, d} from "./re-export"'}),
2729

0 commit comments

Comments
 (0)