mazurov / eslevels Goto Github PK
View Code? Open in Web Editor NEWECMAScript scope levels analyzer based on escope library
Home Page: http://mazurov.github.io/eslevels-demo/
License: BSD 2-Clause "Simplified" License
ECMAScript scope levels analyzer based on escope library
Home Page: http://mazurov.github.io/eslevels-demo/
License: BSD 2-Clause "Simplified" License
(function(){
try {} catch(e) {
var a;
}
});
edit: removed function declarations because they're illegal in that position.
I've moved some of my files to ES6, with "import" statements.
This is accepted by escope only with the options { ecmaVersion: 6, sourceType: 'module' }
(see this comment).
Now eslevels doesn't pass options to escope line 314.
Adding the option solved my issue (confirmed by patching in eslevels.js in /usr/lib/node_modules
)
Would you consider adding the option? Maybe an escope
field in the eslevels options...
Thanks,
Eric
See in the example screenshot, where there is an anonymous function assigned to a var. Note that the ; after the assignment is included with the function scope coloring. This ; should be the same color as the parent scope. I have also seen this when passing an anonymous function as an argument to another function... the char after it is included, which is a bit confusing. It seems there may be an 'off by one' error somewhere which is including the additional character.
This may be an esprima bug..
function foo() {
var y = 3;
var w = function baz(){
var p = 2;
};
}
In that code, the identifier baz
should be in the same scope as var p
(aka, level 2), since identifiers of named function expressions are always in their own function's scope (and read-only), not in the containing scope.
However, I tried this on the demo page (http://mazurov.github.io/eslevels-demo/) and it's incorrectly identifying it in the outer scope (level 1), the same as var y
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.