Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: warning or error when using an undefined variable #160

Open
andrewrk opened this issue Jul 30, 2012 · 3 comments
Open

Proposal: warning or error when using an undefined variable #160

andrewrk opened this issue Jul 30, 2012 · 3 comments

Comments

@andrewrk
Copy link

a = 3
b = a + c

expected output:

SyntaxError: reading from undefined "c" on line 2
@andrewrk
Copy link
Author

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

@satyr
Copy link
Owner

satyr commented Jul 31, 2012

Whitelisting is the hardest part. Can't you simply use JSHint?

@andrewrk
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants