Skip to content

Latest commit

 

History

History
22 lines (12 loc) · 1.58 KB

README.md

File metadata and controls

22 lines (12 loc) · 1.58 KB

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