ESlint guard-for-in, no-nested-ternary

and operator-linebreak
v1.18.x
Peter Jaszkowiak 8 years ago
parent c4bdb72941
commit 32dc7c23ea

@ -83,9 +83,9 @@
"no-eq-null": "off",
"no-redeclare": "off",
"no-unreachable": "off",
"no-nested-ternary": "off",
"operator-linebreak": "off",
"guard-for-in": "off",
// "no-nested-ternary": "off",
// "operator-linebreak": "off",
// "guard-for-in": "off",
// "no-unneeded-ternary": "off",
// "no-sequences": "off",
// "no-extend-native": "off",

@ -1,11 +1,6 @@
'use strict';
(function (exports) {
// export the class if we are in a Node-like system.
if (typeof module === 'object' && module.exports === exports) {
exports = module.exports/* = SemVer*/;
}
var helpers = {};
helpers.displayMenuItem = function (data, index) {
@ -276,12 +271,13 @@
});
};
// Use the define() function if we're in AMD land
if (typeof define === 'function' && define.amd) {
// export the class if we are in a Node-like system.
if (typeof module === 'object' && module.exports === exports) {
exports = module.exports/* = SemVer*/;
} else if (typeof define === 'function' && define.amd) {
// Use the define() function if we're in AMD land
define('helpers', exports);
} else if (typeof window === 'object') {
window.helpers = exports;
}
}(
typeof exports === 'object' ? exports :
typeof define === 'function' && define.amd ? {} :
window.helpers = {}
));
}(typeof exports === 'object' ? exports : {}));

@ -131,7 +131,11 @@ define('settings', function () {
for (var i = 0; i < array.length; i += 1) {
var value = array[i];
if (trim) {
value = value === true ? 1 : value === false ? 0 : typeof value.trim === 'function' ? value.trim() : value;
if (value === !!value) {
value = +value;
} else if (value && typeof value.trim === 'function') {
value = value.trim();
}
}
if (empty || (value != null ? value.length : void 0)) {
cleaned.push(value);

@ -48,13 +48,15 @@ define('settings/array', function () {
delete attributes['data-type'];
delete attributes.tagName;
for (var name in attributes) {
var val = attributes[name];
if (name.search('data-') === 0) {
element.data(name.substring(5), val);
} else if (name.search('prop-') === 0) {
element.prop(name.substring(5), val);
} else {
element.attr(name, val);
if (attributes.hasOwnProperty(name)) {
var val = attributes[name];
if (name.search('data-') === 0) {
element.data(name.substring(5), val);
} else if (name.search('prop-') === 0) {
element.prop(name.substring(5), val);
} else {
element.attr(name, val);
}
}
}
helper.fillField(element, value);

@ -118,7 +118,15 @@ define('settings/key', function () {
if (key.m) {
str += (short ? 'M' : 'Meta') + separator;
}
return str + (human ? key.char : key.code ? '#' + key.code : '');
var out;
if (human) {
out = key.char;
} else if (key.code) {
out = '#' + key.code || '';
}
return str + out;
}
/**

@ -30,13 +30,15 @@ define('settings/object', function () {
delete attributes['data-type'];
delete attributes.tagName;
for (var name in attributes) {
var val = attributes[name];
if (name.search('data-') === 0) {
element.data(name.substring(5), val);
} else if (name.search('prop-') === 0) {
element.prop(name.substring(5), val);
} else {
element.attr(name, val);
if (attributes.hasOwnProperty(name)) {
var val = attributes[name];
if (name.search('data-') === 0) {
element.data(name.substring(5), val);
} else if (name.search('prop-') === 0) {
element.prop(name.substring(5), val);
} else {
element.attr(name, val);
}
}
}
helper.fillField(element, value);
@ -80,17 +82,19 @@ define('settings/object', function () {
}
if (Array.isArray(properties)) {
for (propertyIndex in properties) {
attributes = properties[propertyIndex];
if (typeof attributes !== 'object') {
attributes = {};
}
propertyName = attributes['data-prop'] || attributes['data-property'] || propertyIndex;
if (value[propertyName] === void 0 && attributes['data-new'] !== void 0) {
value[propertyName] = attributes['data-new'];
if (properties.hasOwnProperty(propertyIndex)) {
attributes = properties[propertyIndex];
if (typeof attributes !== 'object') {
attributes = {};
}
propertyName = attributes['data-prop'] || attributes['data-property'] || propertyIndex;
if (value[propertyName] === void 0 && attributes['data-new'] !== void 0) {
value[propertyName] = attributes['data-new'];
}
addObjectPropertyElement(element, key, attributes, propertyName, value[propertyName], separator.clone(), function (el) {
element.append(el);
});
}
addObjectPropertyElement(element, key, attributes, propertyName, value[propertyName], separator.clone(), function (el) {
element.append(el);
});
}
}
},

@ -22,7 +22,13 @@ infoController.get = function (req, res, next) {
data.push(info[key]);
});
data.sort(function (a, b) {
return (a.os.hostname < b.os.hostname) ? -1 : (a.os.hostname > b.os.hostname) ? 1 : 0;
if (a.os.hostname < b.os.hostname) {
return -1;
}
if (a.os.hostname > b.os.hostname) {
return 1;
}
return 0;
});
res.render('admin/development/info', { info: data, infoJSON: JSON.stringify(data, null, 4), host: os.hostname(), port: nconf.get('port') });
}, 500);

@ -256,7 +256,7 @@ var middleware;
apiReturn[i].id = apiReturn[i].name;
apiReturn[i].installed = false;
apiReturn[i].active = false;
apiReturn[i].url = apiReturn[i].url ? apiReturn[i].url : apiReturn[i].repository ? apiReturn[i].repository.url : '';
apiReturn[i].url = apiReturn[i].url || (apiReturn[i].repository ? apiReturn[i].repository.url : '');
pluginMap[apiReturn[i].name] = apiReturn[i];
}

@ -240,29 +240,31 @@ module.exports = function (Posts) {
// Parse out flag data into its own object inside each post hash
async.map(posts, function (postObj, next) {
for (var prop in postObj) {
postObj.flagData = postObj.flagData || {};
if (postObj.hasOwnProperty(prop) && prop.startsWith('flag:')) {
postObj.flagData[prop.slice(5)] = postObj[prop];
if (prop === 'flag:state') {
switch (postObj[prop]) {
case 'open':
postObj.flagData.labelClass = 'info';
break;
case 'wip':
postObj.flagData.labelClass = 'warning';
break;
case 'resolved':
postObj.flagData.labelClass = 'success';
break;
case 'rejected':
postObj.flagData.labelClass = 'danger';
break;
if (postObj.hasOwnProperty(prop)) {
postObj.flagData = postObj.flagData || {};
if (prop.startsWith('flag:')) {
postObj.flagData[prop.slice(5)] = postObj[prop];
if (prop === 'flag:state') {
switch (postObj[prop]) {
case 'open':
postObj.flagData.labelClass = 'info';
break;
case 'wip':
postObj.flagData.labelClass = 'warning';
break;
case 'resolved':
postObj.flagData.labelClass = 'success';
break;
case 'rejected':
postObj.flagData.labelClass = 'danger';
break;
}
}
}
delete postObj[prop];
delete postObj[prop];
}
}
}

Loading…
Cancel
Save