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
[suggestion] Missing commas in array of arrays #3564
Labels
Comments
(I ran into this problem at least twice this year and it was really hard to debug) |
Thanks for the suggestion! This could make for a good linting rule, though I'd suggest a slightly different heuristic. Instead of considering newlines, JSHint could look for cases where the comma operator is used in a member expression. That would catch mistakes like what you've reported regardless of how folks have formatted their code. |
h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider this code:
This is a valid piece of code and it will execute properly. However, it's probably not something that was intended. JS allows accessing elements of an array/object via brackets with a newline character in between.
jshint warns about function invocation on the next line:
produces a warning "Unorthodox function invocation". I think it would be great to have a similar warning for an "unorthodox" object/array accessor usage
UPD. I just checked the code, the warning has nothing to do with the fact that the braces are placed weirdly. It just doesn't like that a number is being invoked as a function. So adding this feature may be potentially hard
The text was updated successfully, but these errors were encountered: