Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion packages/babel-helper-evaluate-path/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# # babel-helper-evaluate-path
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Btw, just noticed an extra "#" :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good catch, addressed 391440b


`path.evaluate` wrapped in a try catch
A wrapper for babel's `path.evaluate`

Fixes / Features:

+ Detect usages before initialization / declaration

```js
function foo() {
console.log(b); // ReferenceError
let b = 1;
}

function bar() {
console.log(a); // a is void 0
var a = 5;
console.log(a); // 5
}
```

+ Detect usages in scopes outside of initialization for vars (hoisted)

```js
function foo() {
if (a) var x = 5;
console.log(x); // cannot determine
}
```

## Installation

Expand Down