Skip to content

Commit 68a2274

Browse files
authored
Exporting the same identifier twice is not allowed by spec (#157)
This will throw with babylon >6 an maybe other parsers
1 parent 691e3b6 commit 68a2274

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/__tests__/fixtures/component_2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function templateLiteral() {
3434
return `foo bar`.split(' ');
3535
}
3636

37-
export default function withThis() {
37+
export function withThis() {
3838
return this.foo();
3939
}
4040

src/resolver/__tests__/findAllExportedComponentDefinitions-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ describe('findAllExportedComponentDefinitions', () => {
826826
import React from 'React';
827827
var ComponentA = class extends React.Component {};
828828
var ComponentB = class extends React.Component {};
829-
export {ComponentA, ComponentA};
829+
export {ComponentA as foo, ComponentA as bar};
830830
`);
831831
var actual = findComponents(parsed);
832832

@@ -903,7 +903,7 @@ describe('findAllExportedComponentDefinitions', () => {
903903
import React from 'React';
904904
var ComponentA = () => <div />;
905905
var ComponentB = () => <div />;
906-
export {ComponentA, ComponentA};
906+
export {ComponentA as foo, ComponentA as bar};
907907
`);
908908
var actual = findComponents(parsed);
909909

src/resolver/__tests__/findExportedComponentDefinition-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ describe('findExportedComponentDefinition', () => {
470470

471471
source = `
472472
var R = require("React");
473-
export var ComponentA = R.createClass({}),
473+
export var ComponentA = R.createClass({});
474474
var ComponentB = R.createClass({});
475475
export {ComponentB};
476476
`;
@@ -665,7 +665,7 @@ describe('findExportedComponentDefinition', () => {
665665
it('errors if multiple components are exported', () => {
666666
var source = `
667667
var R = require("React");
668-
var ComponentA = R.createClass({}),
668+
var ComponentA = R.createClass({});
669669
var ComponentB = R.createClass({});
670670
export {ComponentA as foo, ComponentB};
671671
`;

0 commit comments

Comments
 (0)