Skip to content

Commit 90228b7

Browse files
committed
[[FIX]] Consider all exported bindings "used"
Extend consideration to include bindings created using DestructuringBindingPattern.
1 parent 72a8102 commit 90228b7

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/jshint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4424,7 +4424,7 @@ var JSHINT = (function() {
44244424
t = tokens[t];
44254425
state.funct["(scope)"].initialize(t.id);
44264426

4427-
if (lone && inexport) {
4427+
if (inexport) {
44284428
state.funct["(scope)"].setExported(t.token.value, t.token);
44294429
}
44304430
}
@@ -4571,7 +4571,7 @@ var JSHINT = (function() {
45714571
type: "var",
45724572
token: t.token });
45734573

4574-
if (lone && inexport) {
4574+
if (inexport) {
45754575
state.funct["(scope)"].setExported(t.id, t.token);
45764576
}
45774577
names.push(t.token);

tests/unit/core.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,10 @@ exports.testES6ModulesNamedExportsAffectUnused = function (test) {
10211021
"export var v1u, v2u;",
10221022
"export let l1u, l2u;",
10231023
"export const c1u, c2u;",
1024-
"export function* gen() { yield 1; }"
1024+
"export function* gen() { yield 1; }",
1025+
"export var { varX } = 0;",
1026+
"export let { letX } = 0;",
1027+
"export const { constX } = 0;"
10251028
];
10261029

10271030
TestRun(test)

0 commit comments

Comments
 (0)