Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: remove dead code from prefer-const #8683

Merged
merged 1 commit into from Jun 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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