coco
coco copied to clipboard
Proposal: warning or error when using an undefined variable
a = 3
b = a + c
expected output:
SyntaxError: reading from undefined "c" on line 2
Potential issues: using the window or require object.
Possible solutions:
- whitelist these variables
- accept a command line argument with whitelisted variables
- have a predefined set of whitelisted variables in a "node" category and a "browser" category and have a way to select the target output
- have a config file that coco will look up the directory tree for with the predefined variables listed in them, similar to .jshintrc
- a way to mark globals in coco source
Whitelisting is the hardest part. Can't you simply use JSHint?
Can't you simply use JSHint?
Problems:
- that's a 2 step process instead of 1. For example, that would ruin the syntastic experience.
- coco output isn't suited for jshint
- jshint errors are about the generated source, not the coco source.