allow space separated list of globals

This commit is contained in:
nightwing 2013-08-12 18:32:36 +04:00
commit 0f2ca66d76

View file

@ -2369,9 +2369,6 @@ var JSHINT = (function () {
} }
function assume() { function assume() {
if (state.option.es5) {
warning("I003");
}
if (state.option.couch) { if (state.option.couch) {
combine(predefined, vars.couch); combine(predefined, vars.couch);
} }
@ -2440,16 +2437,10 @@ var JSHINT = (function () {
// Let's assume that chronologically ES3 < ES5 < ES6/ESNext < Moz // Let's assume that chronologically ES3 < ES5 < ES6/ESNext < Moz
state.option.inMoz = function (strict) { state.option.inMoz = function (strict) {
if (strict) {
return state.option.moz && !state.option.esnext;
}
return state.option.moz; return state.option.moz;
}; };
state.option.inESNext = function (strict) { state.option.inESNext = function (strict) {
if (strict) {
return !state.option.moz && state.option.esnext;
}
return state.option.moz || state.option.esnext; return state.option.moz || state.option.esnext;
}; };
@ -2627,14 +2618,14 @@ var JSHINT = (function () {
function doOption() { function doOption() {
var nt = state.tokens.next; var nt = state.tokens.next;
var body = nt.body.split(",").map(function (s) { return s.trim(); }); var body = nt.body.match(/(-\s+)?[^\s,]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g);
var predef = {}; var predef = {};
if (nt.type === "globals") { if (nt.type === "globals") {
body.forEach(function (g) { body.forEach(function (g) {
g = g.split(":"); g = g.split(":");
var key = g[0]; var key = (g[0] || "").trim();
var val = g[1]; var val = (g[1] || "").trim();
if (key.charAt(0) === "-") { if (key.charAt(0) === "-") {
key = key.slice(1); key = key.slice(1);