ESlint space-in-parens, block-spacing

v1.18.x
Peter Jaszkowiak 8 years ago
parent b1b486f729
commit 532951c24f

@ -100,8 +100,8 @@
// "no-multiple-empty-lines": "off", // "no-multiple-empty-lines": "off",
"spaced-comment": "off", "spaced-comment": "off",
"prefer-rest-params": "off", "prefer-rest-params": "off",
"space-in-parens": "off", // "space-in-parens": "off",
"block-spacing": "off", // "block-spacing": "off",
// "quote-props": "off", // "quote-props": "off",
// "space-unary-ops": "off", // "space-unary-ops": "off",
// "no-plusplus": "off", // "no-plusplus": "off",

@ -73,7 +73,7 @@ define('admin/appearance/skins', ['translator'], function (translator) {
if (config['theme:src']) { if (config['theme:src']) {
var skin = config['theme:src'] var skin = config['theme:src']
.match(/latest\/(\S+)\/bootstrap.min.css/)[1] .match(/latest\/(\S+)\/bootstrap.min.css/)[1]
.replace(/(^|\s)([a-z])/g , function (m,p1,p2) {return p1 + p2.toUpperCase();}); .replace(/(^|\s)([a-z])/g , function (m,p1,p2) { return p1 + p2.toUpperCase(); });
highlightSelectedTheme(skin); highlightSelectedTheme(skin);
} }

@ -67,7 +67,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
} }
}); });
}).on('mouseup', '> .panel > .panel-heading', function (evt) { }).on('mouseup', '> .panel > .panel-heading', function (evt) {
if ( !( $(this).parent().is('.ui-sortable-helper') || $(evt.target).closest('.delete-widget').length ) ) { if (!($(this).parent().is('.ui-sortable-helper') || $(evt.target).closest('.delete-widget').length)) {
$(this).parent().children('.panel-body').toggleClass('hidden'); $(this).parent().children('.panel-body').toggleClass('hidden');
} }
}); });

@ -236,7 +236,7 @@ define('forum/topic/threadTools', [
components.get('topic/not-following/check').toggleClass('fa-check', state === 'unfollow'); components.get('topic/not-following/check').toggleClass('fa-check', state === 'unfollow');
menu = components.get('topic/ignoring/menu'); menu = components.get('topic/ignoring/menu');
menu.toggleClass('hidden', state !== 'ignore' ); menu.toggleClass('hidden', state !== 'ignore');
components.get('topic/ignoring/check').toggleClass('fa-check', state === 'ignore'); components.get('topic/ignoring/check').toggleClass('fa-check', state === 'ignore');
} }

@ -424,7 +424,7 @@
return undefined; return undefined;
} }
var i = props.indexOf('.'); var i = props.indexOf('.');
if( i == -1 ) { if(i == -1) {
if(value !== undefined) { if(value !== undefined) {
obj[props] = value; obj[props] = value;
} }
@ -433,7 +433,7 @@
var prop = props.slice(0, i); var prop = props.slice(0, i);
var newProps = props.slice(i + 1); var newProps = props.slice(i + 1);
if(props !== undefined && !(obj[prop] instanceof Object) ) { if(props !== undefined && !(obj[prop] instanceof Object)) {
obj[prop] = {}; obj[prop] = {};
} }

@ -214,7 +214,7 @@ var privileges = require('./privileges');
}); });
if (!parentCids.length) { if (!parentCids.length) {
return callback(null, cids.map(function () {return null;})); return callback(null, cids.map(function () { return null; }));
} }
Categories.getCategoriesData(parentCids, next); Categories.getCategoriesData(parentCids, next);

@ -40,7 +40,7 @@ module.exports = function (Categories) {
order: order, order: order,
link: '', link: '',
numRecentReplies: 1, numRecentReplies: 1,
class: ( data.class ? data.class : 'col-md-3 col-xs-6' ), class: (data.class ? data.class : 'col-md-3 col-xs-6'),
imageClass: 'cover', imageClass: 'cover',
}; };

@ -355,7 +355,7 @@ module.exports = function (Groups) {
} }
if (!groupName || !uids.length) { if (!groupName || !uids.length) {
return callback(null, uids.map(function () {return false;})); return callback(null, uids.map(function () { return false; }));
} }
var nonCachedUids = uids.filter(function (uid) { var nonCachedUids = uids.filter(function (uid) {
@ -388,7 +388,7 @@ module.exports = function (Groups) {
} }
if (!uid || parseInt(uid, 10) <= 0 || !groups.length) { if (!uid || parseInt(uid, 10) <= 0 || !groups.length) {
return callback(null, groups.map(function () {return false;})); return callback(null, groups.map(function () { return false; }));
} }
var nonCachedGroups = groups.filter(function (groupName) { var nonCachedGroups = groups.filter(function (groupName) {

@ -312,9 +312,9 @@ var middleware;
} }
pluginArray.sort(function (a, b) { pluginArray.sort(function (a, b) {
if (a.name > b.name ) { if (a.name > b.name) {
return 1; return 1;
} else if (a.name < b.name ) { } else if (a.name < b.name) {
return -1; return -1;
} else { } else {
return 0; return 0;

@ -95,7 +95,7 @@ module.exports = function (Posts) {
uid = parseInt(uid, 10); uid = parseInt(uid, 10);
if (Array.isArray(pid)) { if (Array.isArray(pid)) {
if (!uid) { if (!uid) {
return callback(null, pid.map(function () {return false;})); return callback(null, pid.map(function () { return false; }));
} }
Posts.getPostsFields(pid, ['uid'], function (err, posts) { Posts.getPostsFields(pid, ['uid'], function (err, posts) {
if (err) { if (err) {
@ -118,7 +118,7 @@ module.exports = function (Posts) {
Posts.isModerator = function (pids, uid, callback) { Posts.isModerator = function (pids, uid, callback) {
if (!parseInt(uid, 10)) { if (!parseInt(uid, 10)) {
return callback(null, pids.map(function () {return false;})); return callback(null, pids.map(function () { return false; }));
} }
Posts.getCidsByPids(pids, function (err, cids) { Posts.getCidsByPids(pids, function (err, cids) {
if (err) { if (err) {

@ -40,7 +40,7 @@ module.exports = function (privileges) {
function isModeratorOfCategories(cids, uid, callback) { function isModeratorOfCategories(cids, uid, callback) {
if (!parseInt(uid, 10)) { if (!parseInt(uid, 10)) {
return filterIsModerator(cids, uid, cids.map(function () {return false;}), callback); return filterIsModerator(cids, uid, cids.map(function () { return false; }), callback);
} }
privileges.users.isGlobalModerator(uid, function (err, isGlobalModerator) { privileges.users.isGlobalModerator(uid, function (err, isGlobalModerator) {
@ -48,7 +48,7 @@ module.exports = function (privileges) {
return callback(err); return callback(err);
} }
if (isGlobalModerator) { if (isGlobalModerator) {
return filterIsModerator(cids, uid, cids.map(function () {return true;}), callback); return filterIsModerator(cids, uid, cids.map(function () { return true; }), callback);
} }

@ -232,7 +232,7 @@ SocketAdmin.analytics.get = function (socket, data, callback) {
analytics.getMonthlyPageViews(next); analytics.getMonthlyPageViews(next);
}, },
}, function (err, data) { }, function (err, data) {
data.pastDay = data.pageviews.reduce(function (a, b) {return parseInt(a, 10) + parseInt(b, 10);}); data.pastDay = data.pageviews.reduce(function (a, b) { return parseInt(a, 10) + parseInt(b, 10); });
data.pageviews[data.pageviews.length - 1] = parseInt(data.pageviews[data.pageviews.length - 1], 10) + analytics.getUnwrittenPageviews(); data.pageviews[data.pageviews.length - 1] = parseInt(data.pageviews[data.pageviews.length - 1], 10) + analytics.getUnwrittenPageviews();
callback(err, data); callback(err, data);
}); });

@ -56,7 +56,7 @@ module.exports = function (Topics) {
Topics.create({uid: results.postData.uid, title: title, cid: cid}, next); Topics.create({uid: results.postData.uid, title: title, cid: cid}, next);
}, },
function (results, next) { function (results, next) {
Topics.updateTopicBookmarks(fromTid, pids, function () { next( null, results );} ); Topics.updateTopicBookmarks(fromTid, pids, function () { next(null, results); });
}, },
function (_tid, next) { function (_tid, next) {
function move(pid, next) { function move(pid, next) {

@ -252,7 +252,7 @@ module.exports = function (Topics) {
topicTags.forEach(function (tags, index) { topicTags.forEach(function (tags, index) {
if (Array.isArray(tags)) { if (Array.isArray(tags)) {
topicTags[index] = tags.map(function (tag) {return tagData[tag];}); topicTags[index] = tags.map(function (tag) { return tagData[tag]; });
} }
}); });

@ -871,7 +871,7 @@ describe('Controllers', function () {
}); });
}); });
it('should return empty after unfollow', function (done ) { it('should return empty after unfollow', function (done) {
socketUser.unfollow({uid: uid}, {uid: fooUid}, function (err) { socketUser.unfollow({uid: uid}, {uid: fooUid}, function (err) {
assert.ifError(err); assert.ifError(err);
request(nconf.get('url') + '/api/user/foo/followers', {json: true}, function (err, res, body) { request(nconf.get('url') + '/api/user/foo/followers', {json: true}, function (err, res, body) {

@ -142,7 +142,7 @@ describe('meta', function () {
}); });
}); });
it('should set multiple values', function (done ) { it('should set multiple values', function (done) {
socketAdmin.config.setMultiple({uid: fooUid}, { socketAdmin.config.setMultiple({uid: fooUid}, {
someField1: 'someValue1', someField1: 'someValue1',
someField2: 'someValue2', someField2: 'someValue2',

@ -471,7 +471,7 @@ describe('Topic\'s', function () {
}); });
}, },
function (done) { function (done) {
topics.markUnread( newTid, uid, done ); topics.markUnread(newTid, uid, done);
}, },
],done); ],done);
}); });
@ -479,14 +479,14 @@ describe('Topic\'s', function () {
it('should not appear in the unread list', function (done) { it('should not appear in the unread list', function (done) {
async.waterfall([ async.waterfall([
function (done) { function (done) {
topics.ignore( newTid, uid, done ); topics.ignore(newTid, uid, done);
}, },
function (done) { function (done) {
topics.getUnreadTopics(0, uid, 0, -1, '', done ); topics.getUnreadTopics(0, uid, 0, -1, '', done);
}, },
function (results, done) { function (results, done) {
var topics = results.topics; var topics = results.topics;
var tids = topics.map( function (topic) { return topic.tid; } ); var tids = topics.map(function (topic) { return topic.tid; });
assert.equal(tids.indexOf(newTid), -1, 'The topic appeared in the unread list.'); assert.equal(tids.indexOf(newTid), -1, 'The topic appeared in the unread list.');
done(); done();
}, },
@ -496,10 +496,10 @@ describe('Topic\'s', function () {
it('should not appear as unread in the recent list', function (done) { it('should not appear as unread in the recent list', function (done) {
async.waterfall([ async.waterfall([
function (done) { function (done) {
topics.ignore( newTid, uid, done ); topics.ignore(newTid, uid, done);
}, },
function (done) { function (done) {
topics.getLatestTopics( uid, 0, -1, 'year', done ); topics.getLatestTopics(uid, 0, -1, 'year', done);
}, },
function (results, done) { function (results, done) {
var topics = results.topics; var topics = results.topics;
@ -520,17 +520,17 @@ describe('Topic\'s', function () {
it('should appear as unread again when marked as reading', function (done) { it('should appear as unread again when marked as reading', function (done) {
async.waterfall([ async.waterfall([
function (done) { function (done) {
topics.ignore( newTid, uid, done ); topics.ignore(newTid, uid, done);
}, },
function (done) { function (done) {
topics.follow( newTid, uid, done ); topics.follow(newTid, uid, done);
}, },
function (done) { function (done) {
topics.getUnreadTopics(0, uid, 0, -1, '', done ); topics.getUnreadTopics(0, uid, 0, -1, '', done);
}, },
function (results, done) { function (results, done) {
var topics = results.topics; var topics = results.topics;
var tids = topics.map( function (topic) { return topic.tid; } ); var tids = topics.map(function (topic) { return topic.tid; });
assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.'); assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.');
done(); done();
}, },
@ -540,17 +540,17 @@ describe('Topic\'s', function () {
it('should appear as unread again when marked as following', function (done) { it('should appear as unread again when marked as following', function (done) {
async.waterfall([ async.waterfall([
function (done) { function (done) {
topics.ignore( newTid, uid, done ); topics.ignore(newTid, uid, done);
}, },
function (done) { function (done) {
topics.follow( newTid, uid, done ); topics.follow(newTid, uid, done);
}, },
function (done) { function (done) {
topics.getUnreadTopics(0, uid, 0, -1, '', done ); topics.getUnreadTopics(0, uid, 0, -1, '', done);
}, },
function (results, done) { function (results, done) {
var topics = results.topics; var topics = results.topics;
var tids = topics.map( function (topic) { return topic.tid; } ); var tids = topics.map(function (topic) { return topic.tid; });
assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.'); assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.');
done(); done();
}, },
@ -578,34 +578,34 @@ describe('Topic\'s', function () {
function (next) { function (next) {
groups.join('administrators', topic.userId, next); groups.join('administrators', topic.userId, next);
}, },
function ( next ) { function (next) {
topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function (err, result) { topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function (err, result) {
assert.ifError( err ); assert.ifError(err);
newTopic = result.topicData; newTopic = result.topicData;
next(); next();
}); });
}, },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { postReply( next );}, function (next) { postReply(next); },
function ( next ) { function (next) {
topicPids = replies.map( function ( reply ) { return reply.pid; } ); topicPids = replies.map(function (reply) { return reply.pid; });
topics.setUserBookmark( newTopic.tid, topic.userId, originalBookmark, next ); topics.setUserBookmark(newTopic.tid, topic.userId, originalBookmark, next);
}], }],
done ); done);
}); });
it('should have 12 replies', function (done) { it('should have 12 replies', function (done) {
assert.equal( 12, replies.length ); assert.equal(12, replies.length);
done(); done();
}); });
@ -615,15 +615,15 @@ describe('Topic\'s', function () {
topics.createTopicFromPosts( topics.createTopicFromPosts(
topic.userId, topic.userId,
'Fork test, no bookmark update', 'Fork test, no bookmark update',
topicPids.slice( -2 ), topicPids.slice(-2),
newTopic.tid, newTopic.tid,
next ); next);
}, },
function ( forkedTopicData, next) { function (forkedTopicData, next) {
topics.getUserBookmark( newTopic.tid, topic.userId, next ); topics.getUserBookmark(newTopic.tid, topic.userId, next);
}, },
function ( bookmark, next ) { function (bookmark, next) {
assert.equal( originalBookmark, bookmark ); assert.equal(originalBookmark, bookmark);
next(); next();
}, },
],done); ],done);
@ -635,15 +635,15 @@ describe('Topic\'s', function () {
topics.createTopicFromPosts( topics.createTopicFromPosts(
topic.userId, topic.userId,
'Fork test, no bookmark update', 'Fork test, no bookmark update',
topicPids.slice( 1, 3 ), topicPids.slice(1, 3),
newTopic.tid, newTopic.tid,
next ); next);
}, },
function ( forkedTopicData, next) { function (forkedTopicData, next) {
topics.getUserBookmark( newTopic.tid, topic.userId, next ); topics.getUserBookmark(newTopic.tid, topic.userId, next);
}, },
function ( bookmark, next ) { function (bookmark, next) {
assert.equal( originalBookmark - 2, bookmark ); assert.equal(originalBookmark - 2, bookmark);
next(); next();
}, },
],done); ],done);

Loading…
Cancel
Save