Check for duplicate named exports in exported destructuring assignments (#144)
* Check for duplicate named exports in exported destructuring assignments * Refactor duplicate error reporting * Remove unnecessary check
This commit is contained in:
committed by
Daniel Tschinder
parent
7c2302a02f
commit
76e69277d7
@@ -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 [[baz2]] = bar;
|
||||
export const [{ foo: [baz3] }, { foo2: [baz4] }] = bar;
|
||||
export const { foo: { baz: { qux3 } }, foo2: { baz2: [qux4]} } = bar;
|
||||
export const { foo: { baz: { qux5 } }, foo2: { baz2: [{qux6}]} } = bar;
|
||||
export const { Foo } = bar;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring10/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring10/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export function foo() {};
|
||||
export const { a: [{foo}] } = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring10/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:20)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring11/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring11/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export function foo4() {};
|
||||
export const [{ a: [{ foo }], b: { foo2: [{ foo3: foo4 }] } }] = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring11/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo4` has already been exported. Exported identifiers must be unique. (2:50)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring12/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring12/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export function foo4() {};
|
||||
export const { a: [{ foo }], b: { foo2: [{ foo3: foo4 }] } } = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring12/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo4` has already been exported. Exported identifiers must be unique. (2:49)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring13/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring13/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export function foo4() {};
|
||||
export const { a: [{ foo4: foo }], b, c: { foo2: [{ foo3: foo4 }] } } = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring13/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo4` has already been exported. Exported identifiers must be unique. (2:58)"
|
||||
}
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring14/actual.js
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring14/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export const foo = 1;
|
||||
export const { foo2: foo } = bar;
|
||||
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring14/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:21)"
|
||||
}
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring15/actual.js
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring15/actual.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export const { foo: foo2 } = bar;
|
||||
export const foo2 = 1;
|
||||
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring15/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo2` has already been exported. Exported identifiers must be unique. (2:13)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring2/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring2/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export function foo() {};
|
||||
export const { foo } = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring2/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:15)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring3/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring3/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const { foo } = bar;
|
||||
export function foo() {};
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring3/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:0)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring4/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring4/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export function foo() {};
|
||||
export const [foo] = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring4/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:14)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring5/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring5/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const [foo] = bar;
|
||||
export function foo() {};
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring5/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:0)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring6/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring6/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const { foo } = bar;
|
||||
export const [foo] = bar2;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring6/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:14)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring7/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring7/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const [foo] = bar;
|
||||
export const { foo } = bar2;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring7/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`foo` has already been exported. Exported identifiers must be unique. (2:15)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring8/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring8/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export class Foo {};
|
||||
export const { Foo } = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring8/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`Foo` has already been exported. Exported identifiers must be unique. (2:15)"
|
||||
}
|
||||
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring9/actual.js
vendored
Normal file
2
test/fixtures/es2015/modules/duplicate-named-export-destructuring9/actual.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export class Foo {};
|
||||
export const [Foo] = bar;
|
||||
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json
vendored
Normal file
3
test/fixtures/es2015/modules/duplicate-named-export-destructuring9/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "`Foo` has already been exported. Exported identifiers must be unique. (2:14)"
|
||||
}
|
||||
Reference in New Issue
Block a user