Skip to content

Commit

Permalink
Chore: remove dead code from prefer-const (#8683)
Browse files Browse the repository at this point in the history
This code was added to work around a bug in acorn (acornjs/acorn#487), which has since been fixed.
  • Loading branch information
not-an-aardvark committed Jun 3, 2017
1 parent a8e1c1c commit 026f048
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions lib/rules/prefer-const.js
Expand Up @@ -85,17 +85,6 @@ function getIdentifierIfShouldBeConst(variable, ignoreReadBeforeAssign) {
return null;
}

/*
* Due to a bug in acorn, code such as `let foo = 1; let foo = 2;` will not throw a syntax error. As a sanity
* check, make sure that the variable only has one declaration. After the parsing bug is fixed, this check
* will no longer be necessary, because variables declared with `let` or `const` should always have exactly one
* declaration.
* https://github.com/ternjs/acorn/issues/487
*/
if (variable.defs.length > 1) {
return null;
}

// Finds the unique WriteReference.
let writer = null;
let isReadBeforeInit = false;
Expand Down

0 comments on commit 026f048

Please sign in to comment.