ESlint no-multi-assign

and max-nested-callbacks, no-mixed-requires, max-statements-per-line
v1.18.x
Peter Jaszkowiak 8 years ago
parent 4bb49a7171
commit 93f38d4f30

@ -26,6 +26,8 @@
"indent": ["error", "tab"], "indent": ["error", "tab"],
"no-eq-null": "off", "no-eq-null": "off",
"camelcase": "off", "camelcase": "off",
"no-new": "off",
"no-shadow": "off",
// ES6 // ES6
"prefer-rest-params": "off", "prefer-rest-params": "off",
@ -33,6 +35,7 @@
"prefer-arrow-callback": "off", "prefer-arrow-callback": "off",
"prefer-template": "off", "prefer-template": "off",
"no-var": "off", "no-var": "off",
"object-shorthand": "off",
// TODO // TODO
"import/no-unresolved": "off", "import/no-unresolved": "off",
@ -41,27 +44,24 @@
"import/newline-after-import": "off", "import/newline-after-import": "off",
"no-bitwise": "off", "no-bitwise": "off",
"global-require": "off", "global-require": "off",
"no-multi-assign": "off",
"max-len": "off", "max-len": "off",
"no-param-reassign": "off", "no-param-reassign": "off",
"object-shorthand": "off",
"no-prototype-builtins": "off", "no-prototype-builtins": "off",
"vars-on-top": "off", "vars-on-top": "off",
"no-restricted-syntax": "off", "no-restricted-syntax": "off",
"no-shadow": "off",
"no-script-url": "off", "no-script-url": "off",
"no-use-before-define": "off", "no-use-before-define": "off",
"default-case": "off", "default-case": "off",
"new-cap": "off", "new-cap": "off",
// "no-multi-assign": "off",
// "linebreak-style": "off", // "linebreak-style": "off",
// "one-var": "off", // "one-var": "off",
// "no-undef": "off", // "no-undef": "off",
"no-new": "off", // "max-nested-callbacks": "off",
"max-nested-callbacks": "off", // "no-mixed-requires": "off",
"no-mixed-requires": "off",
// "brace-style": "off", // "brace-style": "off",
"max-statements-per-line": "off", // "max-statements-per-line": "off",
// "no-unused-vars": "off", // "no-unused-vars": "off",
// "no-mixed-spaces-and-tabs": "off", // "no-mixed-spaces-and-tabs": "off",
// "no-useless-concat": "off", // "no-useless-concat": "off",

@ -108,7 +108,8 @@
var mainTitle; var mainTitle;
var pageTitle; var pageTitle;
if (/admin\/general\/dashboard$/.test(url)) { if (/admin\/general\/dashboard$/.test(url)) {
mainTitle = pageTitle = '[[admin/menu:general/dashboard]]'; pageTitle = '[[admin/menu:general/dashboard]]';
mainTitle = pageTitle;
} else if (/admin\/plugins\//.test(url)) { } else if (/admin\/plugins\//.test(url)) {
mainTitle = fallback; mainTitle = fallback;
pageTitle = '[[admin/menu:section-plugins]] > ' + mainTitle; pageTitle = '[[admin/menu:section-plugins]] > ' + mainTitle;

@ -75,7 +75,8 @@ define('navigator', ['forum/pagination', 'components'], function (pagination, co
navigator.disable = function () { navigator.disable = function () {
count = 0; count = 0;
index = 1; index = 1;
navigator.selector = navigator.callback = null; navigator.callback = null;
navigator.selector = null;
$(window).off('scroll', navigator.update); $(window).off('scroll', navigator.update);
toggle(false); toggle(false);

@ -289,7 +289,8 @@
warn('[translator] Parameter `namespace` is ' + namespace + (namespace === '' ? '(empty string)' : '')); warn('[translator] Parameter `namespace` is ' + namespace + (namespace === '' ? '(empty string)' : ''));
translation = Promise.resolve({}); translation = Promise.resolve({});
} else { } else {
translation = this.translations[namespace] = this.translations[namespace] || this.load(this.lang, namespace).catch(function () { return {}; }); this.translations[namespace] = this.translations[namespace] || this.load(this.lang, namespace).catch(function () { return {}; });
translation = this.translations[namespace];
} }
if (key) { if (key) {

@ -22,7 +22,7 @@
} }
module.exports = utils = { utils = {
generateUUID: function () { generateUUID: function () {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0; var r = Math.random() * 16 | 0;
@ -447,6 +447,7 @@
}, },
}; };
module.exports = utils;
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
window.utils = module.exports; window.utils = module.exports;
} }

@ -45,11 +45,13 @@ module.exports = function (Categories) {
category.disabled = category.hasOwnProperty('disabled') ? parseInt(category.disabled, 10) === 1 : undefined; category.disabled = category.hasOwnProperty('disabled') ? parseInt(category.disabled, 10) === 1 : undefined;
category.icon = category.icon || 'hidden'; category.icon = category.icon || 'hidden';
if (category.hasOwnProperty('post_count')) { if (category.hasOwnProperty('post_count')) {
category.post_count = category.totalPostCount = category.post_count || 0; category.post_count = category.post_count || 0;
category.totalPostCount = category.post_count;
} }
if (category.hasOwnProperty('topic_count')) { if (category.hasOwnProperty('topic_count')) {
category.topic_count = category.totalTopicCount = category.topic_count || 0; category.topic_count = category.topic_count || 0;
category.totalTopicCount = category.topic_count;
} }
if (category.image) { if (category.image) {

@ -131,7 +131,9 @@ module.exports = function (Categories) {
if (teaser) { if (teaser) {
teaser.cid = topicData[index].cid; teaser.cid = topicData[index].cid;
teaser.parentCid = parseInt(parentCids[teaser.cid], 10) || 0; teaser.parentCid = parseInt(parentCids[teaser.cid], 10) || 0;
teaser.tid = teaser.uid = teaser.user.uid = undefined; teaser.tid = undefined;
teaser.uid = undefined;
teaser.user.uid = undefined;
teaser.topic = { teaser.topic = {
slug: topicData[index].slug, slug: topicData[index].slug,
title: validator.escape(String(topicData[index].title)), title: validator.escape(String(topicData[index].title)),

@ -29,7 +29,7 @@ var fallbackTransport;
// Enable Gmail transport if enabled in ACP // Enable Gmail transport if enabled in ACP
if (parseInt(meta.config['email:GmailTransport:enabled'], 10) === 1) { if (parseInt(meta.config['email:GmailTransport:enabled'], 10) === 1) {
fallbackTransport = transports.gmail = nodemailer.createTransport(smtpTransport({ transports.gmail = nodemailer.createTransport(smtpTransport({
host: 'smtp.gmail.com', host: 'smtp.gmail.com',
port: 465, port: 465,
secure: true, secure: true,
@ -38,6 +38,7 @@ var fallbackTransport;
pass: meta.config['email:GmailTransport:pass'], pass: meta.config['email:GmailTransport:pass'],
}, },
})); }));
fallbackTransport = transports.gmail;
} else { } else {
fallbackTransport = transports.sendmail; fallbackTransport = transports.sendmail;
} }

@ -61,7 +61,11 @@ var utils = require('../public/src/utils');
} }
}); });
var e = utils.merge(event); var e = utils.merge(event);
e.eid = e.uid = e.type = e.ip = e.user = undefined; e.eid = undefined;
e.uid = undefined;
e.type = undefined;
e.ip = undefined;
e.user = undefined;
event.jsonString = JSON.stringify(e, null, 4); event.jsonString = JSON.stringify(e, null, 4);
event.timestampISO = new Date(parseInt(event.timestamp, 10)).toUTCString(); event.timestampISO = new Date(parseInt(event.timestamp, 10)).toUTCString();
}); });

@ -36,9 +36,10 @@ module.exports = function (Messaging) {
queueObj.message.content += '\n' + messageObj.content; queueObj.message.content += '\n' + messageObj.content;
clearTimeout(queueObj.timeout); clearTimeout(queueObj.timeout);
} else { } else {
queueObj = Messaging.notifyQueue[fromUid + ':' + roomId] = { queueObj = {
message: messageObj, message: messageObj,
}; };
Messaging.notifyQueue[fromUid + ':' + roomId] = queueObj;
} }
queueObj.timeout = setTimeout(function () { queueObj.timeout = setTimeout(function () {

@ -133,7 +133,8 @@ module.exports = function (Meta) {
winston.verbose('[meta/js] Minifying ' + target); winston.verbose('[meta/js] Minifying ' + target);
var forkProcessParams = setupDebugging(); var forkProcessParams = setupDebugging();
var minifier = Meta.js.minifierProc = fork('minifier.js', [], forkProcessParams); var minifier = fork('minifier.js', [], forkProcessParams);
Meta.js.minifierProc = minifier;
Meta.js.target[target] = {}; Meta.js.target[target] = {};

@ -116,7 +116,8 @@ module.exports = function (User) {
} }
if (user.picture && user.picture === user.uploadedpicture) { if (user.picture && user.picture === user.uploadedpicture) {
user.picture = user.uploadedpicture = user.picture.startsWith('http') ? user.picture : nconf.get('relative_path') + user.picture; user.uploadedpicture = user.picture.startsWith('http') ? user.picture : nconf.get('relative_path') + user.picture;
user.picture = user.uploadedpicture;
} else if (user.uploadedpicture) { } else if (user.uploadedpicture) {
user.uploadedpicture = user.uploadedpicture.startsWith('http') ? user.uploadedpicture : nconf.get('relative_path') + user.uploadedpicture; user.uploadedpicture = user.uploadedpicture.startsWith('http') ? user.uploadedpicture : nconf.get('relative_path') + user.uploadedpicture;
} }

@ -794,7 +794,7 @@ describe('Groups', function () {
helpers.uploadFile(nconf.get('url') + '/api/groups/uploadpicture', logoPath, { params: JSON.stringify({ groupName: 'Test' }) }, jar, csrf_token, function (err, res, body) { helpers.uploadFile(nconf.get('url') + '/api/groups/uploadpicture', logoPath, { params: JSON.stringify({ groupName: 'Test' }) }, jar, csrf_token, function (err, res, body) {
assert.ifError(err); assert.ifError(err);
assert.equal(res.statusCode, 500); assert.equal(res.statusCode, 500);
assert.equal(body.error, '[[error:no-privileges]]'); assert(/\[\[error:no-privileges\]\]/.test(body));
done(); done();
}); });
}); });

Loading…
Cancel
Save