jshint/jshint — Issue #363: Odd behavior with Extra Comma
Author: goatslacker
Created: 2011-11-27 08:56:28+00:00
State: open

When `white` is true

/*jshint white: true */
var f = [1,];

JSHint will tell me I'm missing a space after the comma and that there is an extra comma. It should just tell me there's an extra comma.

And the following is even stranger:

var a = { a: 1,, b: 2};

Outputs

othertest.js: line 1, col 16, Missing space after ','.
othertest.js: line 1, col 16, Extra comma.
othertest.js: line 1, col 16, Expected '}' to match '{' from line 1 and instead saw ','.
othertest.js: line 1, col 17, Missing semicolon.
othertest.js: line 1, col 21, Label 'b' on 2 statement.
othertest.js: line 1, col 21, Expected '2' to have an indentation at 1 instead at 21.
othertest.js: line 1, col 21, Expected an assignment or function call and instead saw an expression.
othertest.js: line 1, col 22, Missing semicolon.
othertest.js: line 1, col 22, Expected '(end)' and instead saw '}'.

I just need to know there's an extra comma.