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