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
move_var should be configurable #17
Comments
It is possible, but it would be stupid. Scope confusion is a problem in this language. |
Thanks for your answer, |
The purpose of JSLint is to inform you of weaknesses in your code. If you do not want that information, don't use it. |
erm, sorry if I'm disturbing you but, lots of checks for these "weaknesses" can be toggled by a configuration parameter, and I want move_var parameter also to be configured by a parameter. Regards Osman |
All JavaScript interpreters automatically hoist variable and function declarations. This is a feature of the language, not a coding weakness. |
You can write all the crappy code you want. I don't care, because you don't work for me. The purpose of JSLint is not to make you feel good about your bad choices. It is to help you conform to a more reliable subset of the language. |
I don't see how something that is clearly documented in the ECMAScript specification can be unreliable. On the contrary, it is a legitimate coding practice. You're absolutely correct that you shouldn't care about my code, but, at the same time, JSLint should not be lying to developers by falsely claiming that a certain practice is bad. Just because my code does not conform to your pedantic style does not mean that it is bad or crappy. |
I am sorry I hurt your feelings. |
Douglas, there are other experienced and thoughtful JavaScript developers that have opinions that are not the same as yours. I am fully aware of your very valid reasons for putting all var statements at the top of a function, but there are also valid reasons (such as readability) for not doing so. I and others who fully understand the issues choose not to adhere to your preferred var style and therefore cannot currently use JSLint. I appreciate your efforts and am grateful for JSLint, but it would be more useful if you gave the people who use it a little more credit and allowed them to choose which stylistic variations they consider to be tolerable. The default options make your opinions plain enough. |
The research that I did when developing JSLint showed that there were good reasons in this language to declare variables before that they are used. In some future edition, when let forms respect block scope, my advice will change to never use var. If you have any evidence that violation of JSLint's rules produces programs that are provably more reliable and cruft-resistant, then I will implement your suggestion. |
Hi,
Is it possible, to make this check configurable?
"Move 'var' declarations to the top of the function."
The text was updated successfully, but these errors were encountered: