ESlint no-unneeded-ternary

and no-extend-native, no-sequences
v1.18.x
Peter Jaszkowiak 8 years ago
parent 64a6322002
commit c4bdb72941

@ -86,9 +86,9 @@
"no-nested-ternary": "off",
"operator-linebreak": "off",
"guard-for-in": "off",
"no-unneeded-ternary": "off",
"no-sequences": "off",
"no-extend-native": "off",
// "no-unneeded-ternary": "off",
// "no-sequences": "off",
// "no-extend-native": "off",
// "no-shadow-restricted-names": "off",
// "no-extra-boolean-cast": "off",
// "no-path-concat": "off",

@ -75,8 +75,8 @@ function welcome(req, res) {
res.render('install/index', {
databases: databases,
skipDatabaseSetup: !!nconf.get('database'),
error: res.locals.error ? true : false,
success: res.locals.success ? true : false,
error: !!res.locals.error,
success: !!res.locals.success,
values: req.body,
minimumPasswordLength: defaults.minimumPasswordLength,
});

@ -111,7 +111,7 @@ function forkWorker(index, isPrimary) {
}
process.env.isPrimary = isPrimary;
process.env.isCluster = ports.length > 1 ? true : false;
process.env.isCluster = ports.length > 1;
process.env.port = ports[index];
var worker = fork('app.js', args, {

@ -108,7 +108,7 @@ define('admin/manage/group', [
var btnEl = $(this);
var userRow = btnEl.parents('[data-uid]');
var ownerFlagEl = userRow.find('.member-name i');
var isOwner = !ownerFlagEl.hasClass('invisible') ? true : false;
var isOwner = !ownerFlagEl.hasClass('invisible');
var uid = userRow.attr('data-uid');
var action = btnEl.attr('data-action');

@ -73,7 +73,7 @@ define('admin/modules/search', ['mousetrap'], function (mousetrap) {
if (!selected.length) {
selected = menu.find('li.result > a').first().attr('href');
}
var href = selected ? selected : config.relative_path + '/search/' + input.val();
var href = selected || config.relative_path + '/search/' + input.val();
ajaxify.go(href.replace(/^\//, ''));

@ -129,7 +129,7 @@ app.cacheBuster = null;
title: '[[global:alert.success]]',
message: message,
type: 'success',
timeout: timeout ? timeout : 5000,
timeout: timeout || 5000,
});
};
@ -144,7 +144,7 @@ app.cacheBuster = null;
title: '[[global:alert.error]]',
message: message,
type: 'danger',
timeout: timeout ? timeout : 10000,
timeout: timeout || 10000,
});
};

@ -54,7 +54,7 @@ define('forum/groups/details', [
var btnEl = $(this);
var userRow = btnEl.parents('[data-uid]');
var ownerFlagEl = userRow.find('.member-name > i');
var isOwner = !ownerFlagEl.hasClass('invisible') ? true : false;
var isOwner = !ownerFlagEl.hasClass('invisible');
var uid = userRow.attr('data-uid');
var action = btnEl.attr('data-action');

@ -10,7 +10,7 @@ define('forum/topic/move', function () {
Move.tids = tids;
Move.currentCid = currentCid;
Move.onComplete = onComplete;
Move.moveAll = tids ? false : true;
Move.moveAll = !tids;
socket.emit('categories.getMoveCategories', onCategoriesLoaded);
};

@ -21,7 +21,7 @@ define('forum/topic/posts', [
return;
}
data.loggedIn = app.user.uid ? true : false;
data.loggedIn = !!app.user.uid;
data.privileges = ajaxify.data.privileges;
Posts.modifyPostsByPrivileges(data.posts);

@ -448,6 +448,11 @@
},
};
if ('undefined' !== typeof window) {
window.utils = module.exports;
}
/* eslint "no-extend-native": "off" */
if (typeof String.prototype.startsWith !== 'function') {
String.prototype.startsWith = function (prefix) {
if (this.length < prefix.length) {
@ -474,10 +479,6 @@
return this.replace(/\s+$/g, '');
};
}
if ('undefined' !== typeof window) {
window.utils = module.exports;
}
}('undefined' === typeof module ? {
module: {
exports: {},

@ -214,7 +214,7 @@ authenticationController.login = function (req, res, next) {
if (err) {
return next(err);
}
req.body.username = username ? username : req.body.username;
req.body.username = username || req.body.username;
continueLogin(req, res, next);
});
} else if (loginWith.indexOf('username') !== -1 && !validator.isEmail(req.body.username)) {

@ -138,7 +138,7 @@ module.exports = function (db, module) {
}
db.collection('objects').count(query, function (err, count) {
callback(err, count ? count : 0);
callback(err, count || 0);
});
};
@ -148,7 +148,7 @@ module.exports = function (db, module) {
}
db.collection('objects').count({ _key: key }, function (err, count) {
count = parseInt(count, 10);
callback(err, count ? count : 0);
callback(err, count || 0);
});
};

@ -285,7 +285,7 @@ var utils = require('../public/src/utils');
return callback(err);
}
callback(null, (parseInt(isPrivate, 10) === 0) ? false : true);
callback(null, parseInt(isPrivate, 10) !== 0);
});
};

@ -102,7 +102,7 @@ module.exports = function (middleware) {
authentication: results.custom_header.authentication,
scripts: results.scripts,
'cache-buster': meta.config['cache-buster'] || '',
env: process.env.NODE_ENV ? true : false,
env: !!process.env.NODE_ENV,
title: (acpPath || 'Dashboard') + ' | NodeBB Admin Control Panel',
bodyClass: data.bodyClass,
};

@ -17,7 +17,7 @@ module.exports = function (User) {
return callback(err);
}
onSettingsLoaded(uid, settings ? settings : {}, callback);
onSettingsLoaded(uid, settings || {}, callback);
});
};

Loading…
Cancel
Save