douglascrockford/JSLint — Issue #87: Bug? inconsistent whitespace flagging
Author: PlNG
Created: 2011-11-22 15:25:25+00:00
State: open

var foo = function () { /* no use strict behavior, middle indentation*/
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var garply = function () { /* no use strict behavior, short indentation*/
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var fred = function () { /* no use strict behavior, long indentation *fully flagged, expected column 9* */
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var bar = function () { /* use strict behavior with middle indentation */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var grault = function () { /* use strict behavior with short indentation */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var plugh = function () { /* use strict behavior with long indentation *fully flagged, expected column 9* */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var bar = function () { /* use strict behavior on middle indentation with a short indentation "accident" on use strict *use strict not flagged, everything else is, expected column 5* */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var waldo = function () { /* use strict behavior on middle indentation with a long indentation "accident" on use strict *use strict flagged, everything else is not, expected column 9* */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var xyzzy = function () { /* use strict behavior on short indentation with a middle indentation "accident" on use strict *use strict not flagged, everything else is, expected column 9* */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var thud = function () { /* use strict behavior on short indentation with a long indentation "accident" on use strict *everything flagged, expected column 9* */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var foofoo = function () { /* use strict behavior on long indentation with a short indentation "accident" on use strict *use strict not flagged, everything else flagged, expected column 5* */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

var foobar = function () { /* use strict behavior on short indentation with a middle indentation "accident" on use strict *use strict not flagged, everything else flagged, expected column 9* */
"use strict";
var qux = true, quux, corge = 0;
if (qux) {
quux = corge;
}
return quux;
};

It really seems like there's inconsistent white space behavior here. At times, column 5 is OK, other times it is defined by use strict's position, otherwise the default indent is 9. Indentation unit was 4.