Skip to content

Commit

Permalink
[[FIX]] Consider all exported bindings "used"
Browse files Browse the repository at this point in the history
Extend consideration to include bindings created using
DestructuringBindingPattern.
  • Loading branch information
jugglinmike committed Mar 1, 2021
1 parent 72a8102 commit 90228b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/jshint.js
Original file line number Diff line number Diff line change
Expand Up @@ -4424,7 +4424,7 @@ var JSHINT = (function() {
t = tokens[t];
state.funct["(scope)"].initialize(t.id);

if (lone && inexport) {
if (inexport) {
state.funct["(scope)"].setExported(t.token.value, t.token);
}
}
Expand Down Expand Up @@ -4571,7 +4571,7 @@ var JSHINT = (function() {
type: "var",
token: t.token });

if (lone && inexport) {
if (inexport) {
state.funct["(scope)"].setExported(t.id, t.token);
}
names.push(t.token);
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,10 @@ exports.testES6ModulesNamedExportsAffectUnused = function (test) {
"export var v1u, v2u;",
"export let l1u, l2u;",
"export const c1u, c2u;",
"export function* gen() { yield 1; }"
"export function* gen() { yield 1; }",
"export var { varX } = 0;",
"export let { letX } = 0;",
"export const { constX } = 0;"
];

TestRun(test)
Expand Down

0 comments on commit 90228b7

Please sign in to comment.