Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

bugfix - no-use-before-declare - exception for destructuring w/ rename #3876

Merged
merged 3 commits into from
May 30, 2018

Conversation

aervin
Copy link
Contributor

@aervin aervin commented May 4, 2018

PR checklist

Overview of change:

The rule checks that identifiers have a declaration with a pos <= to the reference pos, which isn't the case when destructuring w/ a rename.

var { x: y } = { x: 43 };

Is there anything you'd like reviewers to focus on?

Any edge cases with the destructuring syntax that would require additional tests?

CHANGELOG.md entry:

[bugfix] no-use-before-declare Fixes false positives when using the destructuring syntax (#3761)

@@ -68,7 +74,8 @@ export {
};

var undeclaredA = 42;
let { undeclaredB } = { undeclaredB: 43 };
var { undeclaredB } = { undeclaredB: 43 };
var { undeclaredB: undeclaredA } = { undeclaredB: 43 };
const [ undeclaredC, [undeclaredD] ] = [ 1, [2] ];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add test cases for multiple reassignments and reassignment and non-reassignment in the same destructuring?

@suchanlee suchanlee merged commit 2cd3dee into palantir:master May 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants