estools / escope

Escope: ECMAScript scope analyzer
BSD 2-Clause "Simplified" License
546 stars 77 forks source link

`childVisitorKeys` and `fallback` options #100

Closed mysticatea closed 8 years ago

mysticatea commented 8 years ago

This PR adds 2 options that configures the behavior when escope encountered unknown nodes.

For example, how to support JSX syntax:

var jsxKeys = require("estraverse-fb/keys");
var result = escope.analyze(ast, {fallback: "none", childVisitorKeys: jsxKeys});

I like the behavior of fallback: "none", but I didn't change the default behavior in order to avoid a breaking change.

Related: https://github.com/eslint/eslint/issues/5007

I'm happy to follow review and direction.

Constellation commented 8 years ago

lgtm

mysticatea commented 8 years ago

Thank you very much!