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

Option to disallow "var" keyword with esnext: true #1549

Closed
fluidsonic opened this issue Feb 25, 2014 · 9 comments · Fixed by #2234
Closed

Option to disallow "var" keyword with esnext: true #1549

fluidsonic opened this issue Feb 25, 2014 · 9 comments · Fixed by #2234

Comments

@fluidsonic
Copy link

esnext: true adds support for let and const which make var obsolete in most cases, esp. in node.js environments. It would be great to have an option to warn about variables declared with var since its usage is most likely a mistake in ES6 files.

@rwaldron
Copy link
Member

The let and const that are available in v8 --harmony and subsequently node.js are obsolete implementations.

@fluidsonic
Copy link
Author

Why are they obsolete?

@rwaldron
Copy link
Member

The implementation is limited to strict-mode only, which is incorrect. I suppose for node.js purposes, this is not a problem, but it remains an issue in code that is expected to run in browsers: IE11 is implemented correctly, Chrome (w/ flags on) is limited to strict-mode and Firefox is an ancient implementation that's so wrong it doesn't even count.

To be clear, I definitely support a future "novar" (or whatever) flag, but it's important to understand the consequences before jumping to something like that.

@fluidsonic
Copy link
Author

You're right that it depends on the environment whether you can fully rely on let and const. But as with most options it should be up to the developers to decide which flags they want use since they know the targeted runtime environment best.

As usual there should be a sane default.

@rwaldron
Copy link
Member

I find that compelling enough to +1

@callumlocke
Copy link

@rwaldron
Copy link
Member

rwaldron commented Mar 4, 2015

@caitp @jugglinmike are either of you interested in this one?

@caitp
Copy link
Member

caitp commented Mar 4, 2015

I guess if it's a linting rule people want, why not?

@callumlocke
Copy link

thanks for this @caitp 👍

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

Successfully merging a pull request may close this issue.

4 participants