Closed jskeate closed 9 years ago
Good catch! I added the sourceType:module to the escope options. Did some quick tests, perused the escope source.. looks like there's no downside to adding this option.
The color green is by default assigned to level 0 (global) so that seems correct..(white is undeclared, or implicit global) I dont see change in levels with or without this option, so I don't think there are any side effects as far as I can tell. Modules are there own scope, but it seems that in a module-defining-script, the module scope is the root scope, as a single file can only export one module, so it becomes level 0, hence green.
Did some looking into this myself. Seems like escope has two
sourceType
s: https://github.com/estools/escope/blob/master/src/index.js#L65If it is
'script'
, thenimport
statements will cause an error. Changing this to'module'
makes it work, with the caveat that plain (non-module) JS files seem to be one context-color deeper than expected (e.g. root context is green)edit: the last part (one deeper) might just be because of using
let
and the "block scope with let" flag