From da09c40e3f7453056be819da2d9b6f2dc4f84e7b Mon Sep 17 00:00:00 2001 From: Kai Cataldo Date: Fri, 23 Sep 2016 21:32:00 -0400 Subject: [PATCH] Check for duplicate named exports in exported destructuring assignments --- src/parser/statement.js | 20 +- .../actual.js | 13 +- .../expected.json | 2256 ++++++++++++++++- .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 3 + .../options.json | 3 + .../actual.js | 3 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + .../actual.js | 2 + .../options.json | 3 + 31 files changed, 2291 insertions(+), 70 deletions(-) create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring10/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring11/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring12/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring13/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring14/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring15/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring2/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring3/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring4/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring5/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring6/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring7/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring8/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring9/actual.js create mode 100644 test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json diff --git a/src/parser/statement.js b/src/parser/statement.js index f6f92d6267..564e290415 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -923,9 +923,7 @@ pp.checkExport = function (node, checkNames, isDefault) { this.checkDuplicateExports(node, node.declaration.id.name, isDefault); } else if (node.declaration.type === "VariableDeclaration") { for (let declaration of node.declaration.declarations) { - if (declaration.id.name) { - this.checkDuplicateExports(declaration, declaration.id.name, isDefault); - } + this.checkDeclaration(declaration.id, isDefault); } } } @@ -940,6 +938,22 @@ pp.checkExport = function (node, checkNames, isDefault) { } }; +pp.checkDeclaration = function(node, isDefault) { + if (node.type === "ObjectPattern") { + for (let prop of node.properties) { + this.checkDeclaration(prop, isDefault); + } + } else if (node.type === "ArrayPattern") { + for (let elem of node.elements) { + this.checkDeclaration(elem, isDefault); + } + } else if (node.type === "ObjectProperty") { + this.checkDeclaration(node.value, isDefault); + } else if (node.type === "Identifier") { + this.checkDuplicateExports(node, node.name, isDefault); + } +}; + pp.checkDuplicateExports = function(node, name, isDefault) { if (this.state.exportedIdentifiers.indexOf(name) > -1) { this.raiseDuplicateExportError(node, name, isDefault); diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring/actual.js index 9d1d9ff7ae..9b0b8ed2b8 100644 --- a/test/fixtures/es2015/modules/duplicate-named-export-destructuring/actual.js +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring/actual.js @@ -1,2 +1,11 @@ -export const { rhythm } = typography; -export const { TypographyStyle } = typography; +export const { foo } = bar; +export const { foo: foo2 } = bar; +export const { foo: { baz } } = bar; +export const { foo: { baz: { qux } } } = bar; +export const { foo: { baz: { qux2 } }, foo3 } = bar; +export const [foo4] = bar; +export const [[foo5]] = bar; +export const [{ foo: [baz2] }, { foo2: [baz3] }] = bar; +export const { foo: { baz: { qux3 } }, foo2: { baz2: [qux4]} } = bar; +export const { foo: { baz: { qux5 } }, foo2: { baz2: [{qux6}]} } = bar; +export const { Foo } = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring/expected.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring/expected.json index 690a0c4990..58e024dec2 100644 --- a/test/fixtures/es2015/modules/duplicate-named-export-destructuring/expected.json +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring/expected.json @@ -1,29 +1,29 @@ { "type": "File", "start": 0, - "end": 84, + "end": 481, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 2, - "column": 46 + "line": 11, + "column": 27 } }, "program": { "type": "Program", "start": 0, - "end": 84, + "end": 481, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 2, - "column": 46 + "line": 11, + "column": 27 } }, "sourceType": "module", @@ -31,7 +31,7 @@ { "type": "ExportNamedDeclaration", "start": 0, - "end": 37, + "end": 27, "loc": { "start": { "line": 1, @@ -39,7 +39,7 @@ }, "end": { "line": 1, - "column": 37 + "column": 27 } }, "specifiers": [], @@ -47,7 +47,7 @@ "declaration": { "type": "VariableDeclaration", "start": 7, - "end": 37, + "end": 27, "loc": { "start": { "line": 1, @@ -55,14 +55,14 @@ }, "end": { "line": 1, - "column": 37 + "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 13, - "end": 36, + "end": 26, "loc": { "start": { "line": 1, @@ -70,13 +70,13 @@ }, "end": { "line": 1, - "column": 36 + "column": 26 } }, "id": { "type": "ObjectPattern", "start": 13, - "end": 23, + "end": 20, "loc": { "start": { "line": 1, @@ -84,14 +84,14 @@ }, "end": { "line": 1, - "column": 23 + "column": 20 } }, "properties": [ { "type": "ObjectProperty", "start": 15, - "end": 21, + "end": 18, "loc": { "start": { "line": 1, @@ -99,7 +99,7 @@ }, "end": { "line": 1, - "column": 21 + "column": 18 } }, "method": false, @@ -108,7 +108,7 @@ "key": { "type": "Identifier", "start": 15, - "end": 21, + "end": 18, "loc": { "start": { "line": 1, @@ -116,16 +116,16 @@ }, "end": { "line": 1, - "column": 21 + "column": 18 }, - "identifierName": "rhythm" + "identifierName": "foo" }, - "name": "rhythm" + "name": "foo" }, "value": { "type": "Identifier", "start": 15, - "end": 21, + "end": 18, "loc": { "start": { "line": 1, @@ -133,11 +133,11 @@ }, "end": { "line": 1, - "column": 21 + "column": 18 }, - "identifierName": "rhythm" + "identifierName": "foo" }, - "name": "rhythm" + "name": "foo" }, "extra": { "shorthand": true @@ -147,20 +147,20 @@ }, "init": { "type": "Identifier", - "start": 26, - "end": 36, + "start": 23, + "end": 26, "loc": { "start": { "line": 1, - "column": 26 + "column": 23 }, "end": { "line": 1, - "column": 36 + "column": 26 }, - "identifierName": "typography" + "identifierName": "bar" }, - "name": "typography" + "name": "bar" } } ], @@ -169,8 +169,8 @@ }, { "type": "ExportNamedDeclaration", - "start": 38, - "end": 84, + "start": 28, + "end": 61, "loc": { "start": { "line": 2, @@ -178,15 +178,15 @@ }, "end": { "line": 2, - "column": 46 + "column": 33 } }, "specifiers": [], "source": null, "declaration": { "type": "VariableDeclaration", - "start": 45, - "end": 84, + "start": 35, + "end": 61, "loc": { "start": { "line": 2, @@ -194,14 +194,14 @@ }, "end": { "line": 2, - "column": 46 + "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 51, - "end": 83, + "start": 41, + "end": 60, "loc": { "start": { "line": 2, @@ -209,13 +209,13 @@ }, "end": { "line": 2, - "column": 45 + "column": 32 } }, "id": { "type": "ObjectPattern", - "start": 51, - "end": 70, + "start": 41, + "end": 54, "loc": { "start": { "line": 2, @@ -223,14 +223,14 @@ }, "end": { "line": 2, - "column": 32 + "column": 26 } }, "properties": [ { "type": "ObjectProperty", - "start": 53, - "end": 68, + "start": 43, + "end": 52, "loc": { "start": { "line": 2, @@ -238,16 +238,16 @@ }, "end": { "line": 2, - "column": 30 + "column": 24 } }, "method": false, - "shorthand": true, + "shorthand": false, "computed": false, "key": { "type": "Identifier", - "start": 53, - "end": 68, + "start": 43, + "end": 46, "loc": { "start": { "line": 2, @@ -255,51 +255,2177 @@ }, "end": { "line": 2, - "column": 30 + "column": 18 }, - "identifierName": "TypographyStyle" + "identifierName": "foo" }, - "name": "TypographyStyle" + "name": "foo" }, "value": { "type": "Identifier", - "start": 53, - "end": 68, + "start": 48, + "end": 52, "loc": { "start": { "line": 2, - "column": 15 + "column": 20 }, "end": { "line": 2, - "column": 30 + "column": 24 }, - "identifierName": "TypographyStyle" + "identifierName": "foo2" }, - "name": "TypographyStyle" - }, - "extra": { - "shorthand": true + "name": "foo2" } } ] }, "init": { "type": "Identifier", - "start": 73, - "end": 83, + "start": 57, + "end": 60, "loc": { "start": { "line": 2, - "column": 35 + "column": 29 }, "end": { "line": 2, + "column": 32 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 62, + "end": 98, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 69, + "end": 98, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 75, + "end": 97, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "id": { + "type": "ObjectPattern", + "start": 75, + "end": 91, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 77, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 27 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 77, + "end": 80, + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "value": { + "type": "ObjectPattern", + "start": 82, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 27 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 84, + "end": 87, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 84, + "end": 87, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "value": { + "type": "Identifier", + "start": 84, + "end": 87, + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 94, + "end": 97, + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 35 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 99, + "end": 145, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 46 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 106, + "end": 145, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 46 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 112, + "end": 144, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 45 + } + }, + "id": { + "type": "ObjectPattern", + "start": 112, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 39 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 114, + "end": 136, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 37 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 114, + "end": 117, + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "value": { + "type": "ObjectPattern", + "start": 119, + "end": 136, + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 121, + "end": 134, + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 35 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 121, + "end": 124, + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "value": { + "type": "ObjectPattern", + "start": 127, + "end": 134, + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 129, + "end": 132, + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 33 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 129, + "end": 132, + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 33 + }, + "identifierName": "qux" + }, + "name": "qux" + }, + "value": { + "type": "Identifier", + "start": 129, + "end": 132, + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 33 + }, + "identifierName": "qux" + }, + "name": "qux" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 141, + "end": 144, + "loc": { + "start": { + "line": 4, + "column": 42 + }, + "end": { + "line": 4, "column": 45 }, - "identifierName": "typography" + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 146, + "end": 199, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 153, + "end": 199, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 53 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 159, + "end": 198, + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 52 + } + }, + "id": { + "type": "ObjectPattern", + "start": 159, + "end": 192, + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 46 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 161, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 161, + "end": 164, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "value": { + "type": "ObjectPattern", + "start": 166, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 168, + "end": 182, + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 168, + "end": 171, + "loc": { + "start": { + "line": 5, + "column": 22 + }, + "end": { + "line": 5, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "value": { + "type": "ObjectPattern", + "start": 174, + "end": 182, + "loc": { + "start": { + "line": 5, + "column": 28 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 176, + "end": 180, + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 176, + "end": 180, + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 34 + }, + "identifierName": "qux2" + }, + "name": "qux2" + }, + "value": { + "type": "Identifier", + "start": 176, + "end": 180, + "loc": { + "start": { + "line": 5, + "column": 30 + }, + "end": { + "line": 5, + "column": 34 + }, + "identifierName": "qux2" + }, + "name": "qux2" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 186, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 40 + }, + "end": { + "line": 5, + "column": 44 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 186, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 40 + }, + "end": { + "line": 5, + "column": 44 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "value": { + "type": "Identifier", + "start": 186, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 40 + }, + "end": { + "line": 5, + "column": 44 + }, + "identifierName": "foo3" + }, + "name": "foo3" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 195, + "end": 198, + "loc": { + "start": { + "line": 5, + "column": 49 + }, + "end": { + "line": 5, + "column": 52 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 200, + "end": 226, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 26 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 207, + "end": 226, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 213, + "end": 225, + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 25 + } + }, + "id": { + "type": "ArrayPattern", + "start": 213, + "end": 219, + "loc": { + "start": { + "line": 6, + "column": 13 + }, + "end": { + "line": 6, + "column": 19 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 214, + "end": 218, + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 18 + }, + "identifierName": "foo4" + }, + "name": "foo4" + } + ] + }, + "init": { + "type": "Identifier", + "start": 222, + "end": 225, + "loc": { + "start": { + "line": 6, + "column": 22 + }, + "end": { + "line": 6, + "column": 25 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 227, + "end": 255, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 28 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 234, + "end": 255, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 28 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 240, + "end": 254, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 27 + } + }, + "id": { + "type": "ArrayPattern", + "start": 240, + "end": 248, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 21 + } + }, + "elements": [ + { + "type": "ArrayPattern", + "start": 241, + "end": 247, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 20 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 242, + "end": 246, + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 19 + }, + "identifierName": "foo5" + }, + "name": "foo5" + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 251, + "end": 254, + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 27 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 256, + "end": 311, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 55 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 263, + "end": 311, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 55 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 269, + "end": 310, + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 54 + } + }, + "id": { + "type": "ArrayPattern", + "start": 269, + "end": 304, + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 48 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 270, + "end": 285, + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 29 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 272, + "end": 283, + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 27 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 272, + "end": 275, + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 19 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "value": { + "type": "ArrayPattern", + "start": 277, + "end": 283, + "loc": { + "start": { + "line": 8, + "column": 21 + }, + "end": { + "line": 8, + "column": 27 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 278, + "end": 282, + "loc": { + "start": { + "line": 8, + "column": 22 + }, + "end": { + "line": 8, + "column": 26 + }, + "identifierName": "baz2" + }, + "name": "baz2" + } + ] + } + } + ] + }, + { + "type": "ObjectPattern", + "start": 287, + "end": 303, + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 47 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 289, + "end": 301, + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 45 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 289, + "end": 293, + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 37 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "value": { + "type": "ArrayPattern", + "start": 295, + "end": 301, + "loc": { + "start": { + "line": 8, + "column": 39 + }, + "end": { + "line": 8, + "column": 45 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 296, + "end": 300, + "loc": { + "start": { + "line": 8, + "column": 40 + }, + "end": { + "line": 8, + "column": 44 + }, + "identifierName": "baz3" + }, + "name": "baz3" + } + ] + } + } + ] + } + ] + }, + "init": { + "type": "Identifier", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 8, + "column": 51 + }, + "end": { + "line": 8, + "column": 54 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 312, + "end": 381, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 69 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 319, + "end": 381, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 69 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 325, + "end": 380, + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 68 + } + }, + "id": { + "type": "ObjectPattern", + "start": 325, + "end": 374, + "loc": { + "start": { + "line": 9, + "column": 13 + }, + "end": { + "line": 9, + "column": 62 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 327, + "end": 349, + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 327, + "end": 330, + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "value": { + "type": "ObjectPattern", + "start": 332, + "end": 349, + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 334, + "end": 347, + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 35 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 334, + "end": 337, + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "value": { + "type": "ObjectPattern", + "start": 339, + "end": 347, + "loc": { + "start": { + "line": 9, + "column": 27 + }, + "end": { + "line": 9, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 341, + "end": 345, + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 33 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 341, + "end": 345, + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 33 + }, + "identifierName": "qux3" + }, + "name": "qux3" + }, + "value": { + "type": "Identifier", + "start": 341, + "end": 345, + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 33 + }, + "identifierName": "qux3" + }, + "name": "qux3" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 351, + "end": 372, + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 60 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 351, + "end": 355, + "loc": { + "start": { + "line": 9, + "column": 39 + }, + "end": { + "line": 9, + "column": 43 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "value": { + "type": "ObjectPattern", + "start": 357, + "end": 372, + "loc": { + "start": { + "line": 9, + "column": 45 + }, + "end": { + "line": 9, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 359, + "end": 371, + "loc": { + "start": { + "line": 9, + "column": 47 + }, + "end": { + "line": 9, + "column": 59 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 359, + "end": 363, + "loc": { + "start": { + "line": 9, + "column": 47 + }, + "end": { + "line": 9, + "column": 51 + }, + "identifierName": "baz2" + }, + "name": "baz2" + }, + "value": { + "type": "ArrayPattern", + "start": 365, + "end": 371, + "loc": { + "start": { + "line": 9, + "column": 53 + }, + "end": { + "line": 9, + "column": 59 + } + }, + "elements": [ + { + "type": "Identifier", + "start": 366, + "end": 370, + "loc": { + "start": { + "line": 9, + "column": 54 + }, + "end": { + "line": 9, + "column": 58 + }, + "identifierName": "qux4" + }, + "name": "qux4" + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 377, + "end": 380, + "loc": { + "start": { + "line": 9, + "column": 65 + }, + "end": { + "line": 9, + "column": 68 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 382, + "end": 453, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 71 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 389, + "end": 453, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 71 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 395, + "end": 452, + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 70 + } + }, + "id": { + "type": "ObjectPattern", + "start": 395, + "end": 446, + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 64 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 397, + "end": 419, + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 37 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 397, + "end": 400, + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 18 + }, + "identifierName": "foo" + }, + "name": "foo" + }, + "value": { + "type": "ObjectPattern", + "start": 402, + "end": 419, + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 37 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 404, + "end": 417, + "loc": { + "start": { + "line": 10, + "column": 22 + }, + "end": { + "line": 10, + "column": 35 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 404, + "end": 407, + "loc": { + "start": { + "line": 10, + "column": 22 + }, + "end": { + "line": 10, + "column": 25 + }, + "identifierName": "baz" + }, + "name": "baz" + }, + "value": { + "type": "ObjectPattern", + "start": 409, + "end": 417, + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 35 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 411, + "end": 415, + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 33 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 411, + "end": 415, + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 33 + }, + "identifierName": "qux5" + }, + "name": "qux5" + }, + "value": { + "type": "Identifier", + "start": 411, + "end": 415, + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 33 + }, + "identifierName": "qux5" + }, + "name": "qux5" + }, + "extra": { + "shorthand": true + } + } + ] + } + } + ] + } + }, + { + "type": "ObjectProperty", + "start": 421, + "end": 444, + "loc": { + "start": { + "line": 10, + "column": 39 + }, + "end": { + "line": 10, + "column": 62 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 421, + "end": 425, + "loc": { + "start": { + "line": 10, + "column": 39 + }, + "end": { + "line": 10, + "column": 43 + }, + "identifierName": "foo2" + }, + "name": "foo2" + }, + "value": { + "type": "ObjectPattern", + "start": 427, + "end": 444, + "loc": { + "start": { + "line": 10, + "column": 45 + }, + "end": { + "line": 10, + "column": 62 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 429, + "end": 443, + "loc": { + "start": { + "line": 10, + "column": 47 + }, + "end": { + "line": 10, + "column": 61 + } + }, + "method": false, + "shorthand": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 429, + "end": 433, + "loc": { + "start": { + "line": 10, + "column": 47 + }, + "end": { + "line": 10, + "column": 51 + }, + "identifierName": "baz2" + }, + "name": "baz2" + }, + "value": { + "type": "ArrayPattern", + "start": 435, + "end": 443, + "loc": { + "start": { + "line": 10, + "column": 53 + }, + "end": { + "line": 10, + "column": 61 + } + }, + "elements": [ + { + "type": "ObjectPattern", + "start": 436, + "end": 442, + "loc": { + "start": { + "line": 10, + "column": 54 + }, + "end": { + "line": 10, + "column": 60 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 437, + "end": 441, + "loc": { + "start": { + "line": 10, + "column": 55 + }, + "end": { + "line": 10, + "column": 59 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 437, + "end": 441, + "loc": { + "start": { + "line": 10, + "column": 55 + }, + "end": { + "line": 10, + "column": 59 + }, + "identifierName": "qux6" + }, + "name": "qux6" + }, + "value": { + "type": "Identifier", + "start": 437, + "end": 441, + "loc": { + "start": { + "line": 10, + "column": 55 + }, + "end": { + "line": 10, + "column": 59 + }, + "identifierName": "qux6" + }, + "name": "qux6" + }, + "extra": { + "shorthand": true + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 449, + "end": 452, + "loc": { + "start": { + "line": 10, + "column": 67 + }, + "end": { + "line": 10, + "column": 70 + }, + "identifierName": "bar" + }, + "name": "bar" + } + } + ], + "kind": "const" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 454, + "end": 481, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 27 + } + }, + "specifiers": [], + "source": null, + "declaration": { + "type": "VariableDeclaration", + "start": 461, + "end": 481, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 467, + "end": 480, + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 26 + } + }, + "id": { + "type": "ObjectPattern", + "start": 467, + "end": 474, + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 20 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 469, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 18 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 469, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 18 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "value": { + "type": "Identifier", + "start": 469, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 18 + }, + "identifierName": "Foo" + }, + "name": "Foo" + }, + "extra": { + "shorthand": true + } + } + ] + }, + "init": { + "type": "Identifier", + "start": 477, + "end": 480, + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 26 + }, + "identifierName": "bar" }, - "name": "typography" + "name": "bar" } } ], diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/actual.js new file mode 100644 index 0000000000..677b12c6e4 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/actual.js @@ -0,0 +1,2 @@ +export function foo() {}; +export const { a: [{foo}] } = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json new file mode 100644 index 0000000000..c8c111d88d --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:20)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/actual.js new file mode 100644 index 0000000000..b32b976964 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/actual.js @@ -0,0 +1,2 @@ +export function foo4() {}; +export const [{ a: [{ foo }], b: { foo2: [{ foo3: foo4 }] } }] = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json new file mode 100644 index 0000000000..cf1dcd59dc --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo4` has already been exported. Exported identifiers must be unique. (2:50)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/actual.js new file mode 100644 index 0000000000..281270a96c --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/actual.js @@ -0,0 +1,2 @@ +export function foo4() {}; +export const { a: [{ foo }], b: { foo2: [{ foo3: foo4 }] } } = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json new file mode 100644 index 0000000000..c2f8cdda98 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo4` has already been exported. Exported identifiers must be unique. (2:49)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/actual.js new file mode 100644 index 0000000000..1dda6d87dd --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/actual.js @@ -0,0 +1,2 @@ +export function foo4() {}; +export const { a: [{ foo4: foo }], b, c: { foo2: [{ foo3: foo4 }] } } = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json new file mode 100644 index 0000000000..1cd229e76c --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo4` has already been exported. Exported identifiers must be unique. (2:58)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/actual.js new file mode 100644 index 0000000000..0fe491a318 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/actual.js @@ -0,0 +1,3 @@ +export const foo = 1; +export const { foo2: foo } = bar; + diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json new file mode 100644 index 0000000000..e6aaa311fc --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:21)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/actual.js new file mode 100644 index 0000000000..6858879d82 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/actual.js @@ -0,0 +1,3 @@ +export const { foo: foo2 } = bar; +export const foo2 = 1; + diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json new file mode 100644 index 0000000000..4eb6f26f95 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo2` has already been exported. Exported identifiers must be unique. (2:13)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/actual.js new file mode 100644 index 0000000000..b3152fa5d9 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/actual.js @@ -0,0 +1,2 @@ +export function foo() {}; +export const { foo } = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json new file mode 100644 index 0000000000..f28333f6f8 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:15)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/actual.js new file mode 100644 index 0000000000..fc87dd7ffb --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/actual.js @@ -0,0 +1,2 @@ +export const { foo } = bar; +export function foo() {}; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json new file mode 100644 index 0000000000..1923e47523 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:0)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/actual.js new file mode 100644 index 0000000000..ec6f5dd9d9 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/actual.js @@ -0,0 +1,2 @@ +export function foo() {}; +export const [foo] = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json new file mode 100644 index 0000000000..37d131b70f --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:14)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/actual.js new file mode 100644 index 0000000000..6729f72762 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/actual.js @@ -0,0 +1,2 @@ +export const [foo] = bar; +export function foo() {}; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json new file mode 100644 index 0000000000..1923e47523 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:0)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/actual.js new file mode 100644 index 0000000000..a4c9ec451e --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/actual.js @@ -0,0 +1,2 @@ +export const { foo } = bar; +export const [foo] = bar2; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json new file mode 100644 index 0000000000..37d131b70f --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:14)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/actual.js new file mode 100644 index 0000000000..e947c44df0 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/actual.js @@ -0,0 +1,2 @@ +export const [foo] = bar; +export const { foo } = bar2; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json new file mode 100644 index 0000000000..f28333f6f8 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`foo` has already been exported. Exported identifiers must be unique. (2:15)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/actual.js new file mode 100644 index 0000000000..c5d0d8cf12 --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/actual.js @@ -0,0 +1,2 @@ +export class Foo {}; +export const { Foo } = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json new file mode 100644 index 0000000000..8ef246d83c --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`Foo` has already been exported. Exported identifiers must be unique. (2:15)" +} diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/actual.js b/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/actual.js new file mode 100644 index 0000000000..19abf32d7c --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/actual.js @@ -0,0 +1,2 @@ +export class Foo {}; +export const [Foo] = bar; diff --git a/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json b/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json new file mode 100644 index 0000000000..6b46482b6e --- /dev/null +++ b/test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json @@ -0,0 +1,3 @@ +{ + "throws": "`Foo` has already been exported. Exported identifiers must be unique. (2:14)" +}