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",
"spaced-comment": "off",
"prefer-rest-params": "off",
"space-in-parens": "off",
"block-spacing": "off",
// "space-in-parens": "off",
// "block-spacing": "off",
// "quote-props": "off",
// "space-unary-ops": "off",
// "no-plusplus": "off",

@ -73,7 +73,7 @@ define('admin/appearance/skins', ['translator'], function (translator) {
if (config['theme:src']) {
var skin = config['theme:src']
.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);
}

@ -67,7 +67,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {
}
});
}).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');
}
});

@ -236,7 +236,7 @@ define('forum/topic/threadTools', [
components.get('topic/not-following/check').toggleClass('fa-check', state === 'unfollow');
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');
}

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

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

@ -40,7 +40,7 @@ module.exports = function (Categories) {
order: order,
link: '',
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',
};

@ -355,7 +355,7 @@ module.exports = function (Groups) {
}
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) {
@ -388,7 +388,7 @@ module.exports = function (Groups) {
}
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) {

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

@ -95,7 +95,7 @@ module.exports = function (Posts) {
uid = parseInt(uid, 10);
if (Array.isArray(pid)) {
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) {
if (err) {
@ -118,7 +118,7 @@ module.exports = function (Posts) {
Posts.isModerator = function (pids, uid, callback) {
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) {
if (err) {

@ -40,7 +40,7 @@ module.exports = function (privileges) {
function isModeratorOfCategories(cids, uid, callback) {
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) {
@ -48,7 +48,7 @@ module.exports = function (privileges) {
return callback(err);
}
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);
},
}, 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();
callback(err, data);
});

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

@ -252,7 +252,7 @@ module.exports = function (Topics) {
topicTags.forEach(function (tags, index) {
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) {
assert.ifError(err);
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}, {
someField1: 'someValue1',
someField2: 'someValue2',

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

Loading…
Cancel
Save