Skip to content

AsaAyers/coffeescope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published