diff --git a/src/ExportMap.js b/src/ExportMap.js index 66b212a21..563ff9e8c 100644 --- a/src/ExportMap.js +++ b/src/ExportMap.js @@ -512,6 +512,10 @@ export function recursivePatternCapture(pattern, callback) { recursivePatternCapture(element, callback) }) break + + case 'AssignmentPattern': + callback(pattern.left) + break } } diff --git a/tests/files/named-exports.js b/tests/files/named-exports.js index 752092e0a..f2881c10c 100644 --- a/tests/files/named-exports.js +++ b/tests/files/named-exports.js @@ -14,6 +14,8 @@ export class ExportedClass { // destructuring exports export var { destructuredProp } = {} + , { destructingAssign = null } = {} + , { destructingAssign: destructingRenamedAssign = null } = {} , [ arrayKeyProp ] = [] , [ { deepProp } ] = [] , { arr: [ ,, deepSparseElement ] } = {} diff --git a/tests/src/core/getExports.js b/tests/src/core/getExports.js index 3423fe3e1..3bda3d3db 100644 --- a/tests/src/core/getExports.js +++ b/tests/src/core/getExports.js @@ -273,7 +273,7 @@ describe('ExportMap', function () { context('#size', function () { it('counts the names', () => expect(ExportMap.get('./named-exports', fakeContext)) - .to.have.property('size', 8)) + .to.have.property('size', 10)) it('includes exported namespace size', () => expect(ExportMap.get('./export-all', fakeContext)) .to.have.property('size', 1)) diff --git a/tests/src/rules/named.js b/tests/src/rules/named.js index cb1a5b843..ed6dc9e04 100644 --- a/tests/src/rules/named.js +++ b/tests/src/rules/named.js @@ -22,6 +22,8 @@ ruleTester.run('named', rule, { test({code: 'import bar, { foo } from "./bar.js"'}), test({code: 'import {a, b, d} from "./named-exports"'}), test({code: 'import {ExportedClass} from "./named-exports"'}), + test({code: 'import { destructingAssign } from "./named-exports"'}), + test({code: 'import { destructingRenamedAssign } from "./named-exports"'}), test({code: 'import { ActionTypes } from "./qc"'}), test({code: 'import {a, b, c, d} from "./re-export"'}),