mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
ESlint guard-for-in, no-nested-ternary
and operator-linebreak
This commit is contained in:
@@ -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 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 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
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
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,6 +48,7 @@ define('settings/array', function () {
|
||||
delete attributes['data-type'];
|
||||
delete attributes.tagName;
|
||||
for (var name in attributes) {
|
||||
if (attributes.hasOwnProperty(name)) {
|
||||
var val = attributes[name];
|
||||
if (name.search('data-') === 0) {
|
||||
element.data(name.substring(5), val);
|
||||
@@ -57,6 +58,7 @@ define('settings/array', function () {
|
||||
element.attr(name, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
helper.fillField(element, value);
|
||||
if ($('[data-parent="_' + key + '"]', field).length) {
|
||||
insertCb(separator);
|
||||
|
||||
@@ -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,6 +30,7 @@ define('settings/object', function () {
|
||||
delete attributes['data-type'];
|
||||
delete attributes.tagName;
|
||||
for (var name in attributes) {
|
||||
if (attributes.hasOwnProperty(name)) {
|
||||
var val = attributes[name];
|
||||
if (name.search('data-') === 0) {
|
||||
element.data(name.substring(5), val);
|
||||
@@ -39,6 +40,7 @@ define('settings/object', function () {
|
||||
element.attr(name, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
helper.fillField(element, value);
|
||||
if ($('[data-parent="_' + key + '"]', field).length) {
|
||||
insertCb(separator);
|
||||
@@ -80,6 +82,7 @@ define('settings/object', function () {
|
||||
}
|
||||
if (Array.isArray(properties)) {
|
||||
for (propertyIndex in properties) {
|
||||
if (properties.hasOwnProperty(propertyIndex)) {
|
||||
attributes = properties[propertyIndex];
|
||||
if (typeof attributes !== 'object') {
|
||||
attributes = {};
|
||||
@@ -93,6 +96,7 @@ define('settings/object', function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
get: function (element, trim, empty) {
|
||||
var key = element.data('key') || element.data('parent');
|
||||
|
||||
@@ -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,9 +240,10 @@ 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) {
|
||||
if (postObj.hasOwnProperty(prop)) {
|
||||
postObj.flagData = postObj.flagData || {};
|
||||
|
||||
if (postObj.hasOwnProperty(prop) && prop.startsWith('flag:')) {
|
||||
if (prop.startsWith('flag:')) {
|
||||
postObj.flagData[prop.slice(5)] = postObj[prop];
|
||||
|
||||
if (prop === 'flag:state') {
|
||||
@@ -265,6 +266,7 @@ module.exports = function (Posts) {
|
||||
delete postObj[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (postObj.flagData.assignee) {
|
||||
user.getUserFields(parseInt(postObj.flagData.assignee, 10), ['username', 'picture'], function (err, userData) {
|
||||
|
||||
Reference in New Issue
Block a user