0.1.2 • Published 9 years ago

coffeescope v0.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
9 years ago

coffeescope

Join the chat at https://gitter.im/AsaAyers/coffeescope

The goal is to be able to scan a CoffeeScript file and identify every variable created or used in every scope.

Once this is done it will be used by CoffeeLint to add scope rules like no_undefined_vars, no_unused_vars, no_variable_shadowing, and no_use_before_define.

CoffeeScript is terrible

It is my recommendation that you abandon CoffeeScript immediately. Babel with ES6/ES2015 is a much better solution.

CoffeeScript's AST doesn't have all of the information needed to determine how variables are used. The simplest example is implicit returns, they are simply missing from the AST. My workaround was to have the AST compile itself because for some dumbass reason compiling the AST allows it to modify itself and it puts in the explicit return. This introduces new problems; now the AST contains code you didn't write. Your default parameter now exists as part of the parameter AND inside an if statement in the body. This is a major problem when trying to lint what the user wrote.

I expect I am probably going to abandon this project.

contributing

Right now there are many disabled tests because they are failing. I can be difficult to fix one test without breaking others. My plan is to turn tests on one at a time and fix them.

# This will re-run the tests after every change
npm test -- --autotest