ESlint comma-spacing

v1.18.x
Peter Jaszkowiak 8 years ago
parent 277a7fb8b4
commit 2e031f3759

@ -2,6 +2,7 @@
"extends": "airbnb",
"rules": {
// Customized
"handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],
"comma-dangle": ["error", {
"arrays": "always-multiline",
@ -10,17 +11,22 @@
"exports": "always-multiline",
"functions": "never"
}],
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-underscore-dangle": "off",
"newline-per-chained-call": "off",
"no-console": "off",
// ES6
"prefer-rest-params": "off",
"prefer-spread": "off",
// TODO
"import/no-unresolved": "off",
"import/no-extraneous-dependencies": "off",
"import/no-dynamic-require": "off",
"import/newline-after-import": "off",
"no-bitwise": "off",
"newline-per-chained-call": "off",
"no-console": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"prefer-rest-params": "off",
"prefer-spread": "off",
"no-underscore-dangle": "off",
"global-require": "off",
// "linebreak-style": "off",
// "one-var": "off",
@ -94,8 +100,7 @@
"quotes": "off",
"keyword-spacing": "off",
"no-mixed-operators": "off",
"comma-spacing": "off",
"global-require": "off",
// "comma-spacing": "off",
// "no-trailing-spaces": "off",
// "key-spacing": "off",
// "no-multiple-empty-lines": "off",

@ -36,7 +36,7 @@ winston.add(winston.transports.Console, {
colorize: true,
timestamp: function () {
var date = new Date();
return (!!nconf.get('json-logging')) ? date.toJSON() : date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,8) + ' [' + global.process.pid + ']';
return (!!nconf.get('json-logging')) ? date.toJSON() : date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0, 8) + ' [' + global.process.pid + ']';
},
level: nconf.get('log-level') || (global.env === 'production' ? 'info' : 'verbose'),
json: (!!nconf.get('json-logging')),
@ -155,7 +155,7 @@ function setup() {
var separator = ' ';
if (process.stdout.columns > 10) {
for(var x = 0,cols = process.stdout.columns - 10; x < cols; x += 1) {
for(var x = 0, cols = process.stdout.columns - 10; x < cols; x += 1) {
separator += '=';
}
}

@ -17,7 +17,7 @@ winston.add(winston.transports.File, {
colorize: true,
timestamp: function () {
var date = new Date();
return date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0,5) + ' [' + global.process.pid + ']';
return date.getDate() + '/' + (date.getMonth() + 1) + ' ' + date.toTimeString().substr(0, 5) + ' [' + global.process.pid + ']';
},
level: 'verbose',
});

@ -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);
}

@ -126,7 +126,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
topics: null,
};
var topicColors = ["#bf616a","#5B90BF","#d08770","#ebcb8b","#a3be8c","#96b5b4","#8fa1b3","#b48ead","#ab7967","#46BFBD"];
var topicColors = ["#bf616a", "#5B90BF", "#d08770", "#ebcb8b", "#a3be8c", "#96b5b4", "#8fa1b3", "#b48ead", "#ab7967", "#46BFBD"];
var usedTopicColors = [];
// from chartjs.org
@ -138,7 +138,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
usePound = true;
}
var num = parseInt(col,16);
var num = parseInt(col, 16);
var r = (num >> 16) + amt;
@ -196,7 +196,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
pointHoverBackgroundColor: "#fff",
pointBorderColor: "#fff",
pointHoverBorderColor: "rgba(220,220,220,1)",
data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
},
{
label: translations[1],
@ -206,7 +206,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
pointHoverBackgroundColor: "#fff",
pointBorderColor: "#fff",
pointHoverBorderColor: "rgba(151,187,205,1)",
data: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
},
],
};

@ -66,7 +66,7 @@ define('forum/topic/votes', ['components', 'translator'], function (components,
var post = button.parents('[data-pid]');
var currentState = post.find(className).length;
socket.emit(currentState ? 'posts.unvote' : method , {
socket.emit(currentState ? 'posts.unvote' : method, {
pid: post.attr('data-pid'),
room_id: app.currentRoom,
}, function (err) {

@ -56,7 +56,7 @@
helpers.stringify = function (obj) {
// Turns the incoming object into a JSON string
return JSON.stringify(obj).replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/"/g, '&quot;');
return JSON.stringify(obj).replace(/&/gm, "&amp;").replace(/</gm, "&lt;").replace(/>/gm, "&gt;").replace(/"/g, '&quot;');
};
helpers.escape = function (str) {

@ -33,7 +33,7 @@ define('postSelect', ['components'], function (components) {
}
if (PostSelect.pids.length) {
PostSelect.pids.sort(function (a,b) { return a - b; });
PostSelect.pids.sort(function (a, b) { return a - b; });
}
callback();
}

@ -258,7 +258,7 @@
},
escapeHTML: function (raw) {
return raw.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;");
return raw.replace(/&/gm, "&amp;").replace(/</gm, "&lt;").replace(/>/gm, "&gt;");
},
isAndroidBrowser: function () {

@ -33,7 +33,7 @@ pluginsController.get = function (req, res, next) {
return pkgData.name;
});
res.render('admin/extend/plugins' , {
res.render('admin/extend/plugins', {
installed: payload.compatible.filter(function (plugin) {
return plugin.installed;
}),

@ -100,7 +100,7 @@ module.exports = function (db, module) {
}
value = helpers.valueToString(value);
db.collection('objects').findOne({_key: key, members: value}, {_id: 0, members: 0},function (err, item) {
db.collection('objects').findOne({_key: key, members: value}, {_id: 0, members: 0}, function (err, item) {
callback(err, item !== null && item !== undefined);
});
};

@ -157,7 +157,7 @@ module.exports = function (db, module) {
return callback();
}
var pipeline = [
{ $match: { _key: { $in: keys } } } ,
{ $match: { _key: { $in: keys } } },
{ $group: { _id: {_key: '$_key'}, count: { $sum: 1 } } },
{ $project: { _id: 1, count: '$count' } },
];

@ -119,7 +119,7 @@ module.exports = function (Groups) {
}
});
results.users.sort(function (a,b) {
results.users.sort(function (a, b) {
if (a.isOwner && !b.isOwner) {
return -1;
} else if (!a.isOwner && b.isOwner) {

@ -111,7 +111,7 @@ var opts = {
/*
* This monitor's when a user clicks "save" in the Logger section of the admin panel
*/
Logger.setup_one(data.key,data.value);
Logger.setup_one(data.key, data.value);
Logger.io_close(socket);
Logger.io(socket);
};
@ -127,14 +127,14 @@ var opts = {
opts.express.ofn = morgan('combined', {stream: opts.streams.log.f});
};
Logger.expressLogger = function (req,res,next) {
Logger.expressLogger = function (req, res, next) {
/*
* The new express.logger
*
* This hijack allows us to turn logger on/off dynamically within express
*/
if(meta.config.loggerStatus > 0) {
return opts.express.ofn(req,res,next);
return opts.express.ofn(req, res, next);
} else {
return next();
}

@ -139,7 +139,7 @@ Messaging.getRecentChats = function (callerUid, uid, start, stop, callback) {
uids = uids.filter(function (value) {
return value && parseInt(value, 10) !== parseInt(uid, 10);
});
user.getUsersFields(uids, ['uid', 'username', 'userslug', 'picture', 'status', 'lastonline'] , next);
user.getUsersFields(uids, ['uid', 'username', 'userslug', 'picture', 'status', 'lastonline'], next);
});
}, next);
},
@ -206,7 +206,7 @@ Messaging.getTeaser = function (uid, roomId, callback) {
}
teaser.timestampISO = utils.toISOString(teaser.timestamp);
user.getUserFields(teaser.fromuid, ['uid', 'username', 'userslug', 'picture', 'status', 'lastonline'] , next);
user.getUserFields(teaser.fromuid, ['uid', 'username', 'userslug', 'picture', 'status', 'lastonline'], next);
},
function (user, next) {
teaser.user = user;

@ -66,7 +66,7 @@ module.exports = function (privileges) {
memberData.forEach(function (member) {
member.privileges = {};
for(var x = 0,numPrivs = userPrivileges.length; x < numPrivs; x += 1) {
for(var x = 0, numPrivs = userPrivileges.length; x < numPrivs; x += 1) {
member.privileges[userPrivileges[x]] = memberSets[x].indexOf(parseInt(member.uid, 10)) !== -1;
}
});
@ -117,7 +117,7 @@ module.exports = function (privileges) {
var memberData = groupNames.map(function (member) {
memberPrivs = {};
for(var x = 0,numPrivs = groupPrivileges.length; x < numPrivs; x += 1) {
for(var x = 0, numPrivs = groupPrivileges.length; x < numPrivs; x += 1) {
memberPrivs[groupPrivileges[x]] = memberSets[x].indexOf(member) !== -1;
}
return {

@ -98,7 +98,7 @@ module.exports = function (app, middleware, hotswapIds) {
var ensureLoggedIn = require('connect-ensure-login');
if (Array.isArray(hotswapIds) && hotswapIds.length) {
for(var idx,x = 0; x < hotswapIds.length; x += 1) {
for(var idx, x = 0; x < hotswapIds.length; x += 1) {
idx = routers.push(express.Router()) - 1;
routers[idx].hotswapId = hotswapIds[x];
}

@ -14,7 +14,7 @@ var privileges = require('../privileges');
UserNotifications.get = function (uid, callback) {
if (!parseInt(uid, 10)) {
return callback(null , {read: [], unread: []});
return callback(null, {read: [], unread: []});
}
getNotifications(uid, 0, 9, function (err, notifications) {
if (err) {

@ -299,7 +299,7 @@ describe('Categories', function () {
});
});
it('should get category data' , function (done) {
it('should get category data', function (done) {
socketCategories.getCategory({uid: posterUid}, categoryObj.cid, function (err, data) {
assert.ifError(err);
assert.equal(categoryObj.cid, data.cid);

@ -27,7 +27,7 @@ describe('Set methods', function () {
describe('getSetMembers()', function () {
before(function (done) {
db.setAdd('testSet2', [1,2,3,4,5], done);
db.setAdd('testSet2', [1, 2, 3, 4, 5], done);
});
it('should return an empty set', function (done) {
@ -139,7 +139,7 @@ describe('Set methods', function () {
describe('setCount()', function () {
before(function (done) {
db.setAdd('testSet5', [1,2,3,4,5], done);
db.setAdd('testSet5', [1, 2, 3, 4, 5], done);
});
it('should return the element count of set', function (done) {
@ -155,7 +155,7 @@ describe('Set methods', function () {
describe('setsCount()', function () {
before(function (done) {
async.parallel([
async.apply(db.setAdd, 'set5', [1,2,3,4,5]),
async.apply(db.setAdd, 'set5', [1, 2, 3, 4, 5]),
async.apply(db.setAdd, 'set6', 1),
async.apply(db.setAdd, 'set7', 2),
], done);
@ -211,7 +211,7 @@ describe('Set methods', function () {
describe('setRemoveRandom()', function () {
before(function (done) {
db.setAdd('testSet7', [1,2,3,4,5], done);
db.setAdd('testSet7', [1, 2, 3, 4, 5], done);
});
it('should remove a random element from set', function (done) {

@ -521,8 +521,8 @@ describe('Sorted Set methods', function () {
describe('sortedSetsRemove()', function () {
before(function (done) {
async.parallel([
async.apply(db.sortedSetAdd, 'sorted4', [1,2], ['value1', 'value2']),
async.apply(db.sortedSetAdd, 'sorted5', [1,2], ['value1', 'value3']),
async.apply(db.sortedSetAdd, 'sorted4', [1, 2], ['value1', 'value2']),
async.apply(db.sortedSetAdd, 'sorted5', [1, 2], ['value1', 'value3']),
], done);
});
@ -541,7 +541,7 @@ describe('Sorted Set methods', function () {
describe('sortedSetsRemoveRangeByScore()', function () {
before(function (done) {
db.sortedSetAdd('sorted6', [1,2,3,4,5], ['value1','value2','value3','value4','value5'], done);
db.sortedSetAdd('sorted6', [1, 2, 3, 4, 5], ['value1', 'value2', 'value3', 'value4', 'value5'], done);
});
it('should remove elements with scores between min max inclusive', function (done) {
@ -561,10 +561,10 @@ describe('Sorted Set methods', function () {
before(function (done) {
async.parallel([
function (next) {
db.sortedSetAdd('interSet1', [1,2,3], ['value1', 'value2', 'value3'], next);
db.sortedSetAdd('interSet1', [1, 2, 3], ['value1', 'value2', 'value3'], next);
},
function (next) {
db.sortedSetAdd('interSet2', [4,5,6], ['value2', 'value3', 'value5'], next);
db.sortedSetAdd('interSet2', [4, 5, 6], ['value2', 'value3', 'value5'], next);
},
], done);
});

@ -17,7 +17,7 @@
nconf.file({ file: path.join(__dirname, '../../config.json') });
nconf.defaults({
base_dir: path.join(__dirname,'../..'),
base_dir: path.join(__dirname, '../..'),
themes_path: path.join(__dirname, '../../node_modules'),
upload_path: 'public/uploads',
views_dir: path.join(__dirname, '../../build/public/templates'),

@ -473,7 +473,7 @@ describe('Topic\'s', function () {
function (done) {
topics.markUnread(newTid, uid, done);
},
],done);
], done);
});
it('should not appear in the unread list', function (done) {
@ -626,7 +626,7 @@ describe('Topic\'s', function () {
assert.equal(originalBookmark, bookmark);
next();
},
],done);
], done);
});
it('should update the user\'s bookmark ', function (done) {
@ -646,7 +646,7 @@ describe('Topic\'s', function () {
assert.equal(originalBookmark - 2, bookmark);
next();
},
],done);
], done);
});
});

@ -52,7 +52,7 @@ describe('User', function () {
describe('.create(), when created', function () {
it('should be created properly', function (done) {
User.create({username: userData.username, password: userData.password, email: userData.email}, function (error,userId) {
User.create({username: userData.username, password: userData.password, email: userData.email}, function (error, userId) {
assert.equal(error, null, 'was created with error');
assert.ok(userId);
@ -62,7 +62,7 @@ describe('User', function () {
});
it('should have a valid email, if using an email', function (done) {
User.create({username: userData.username, password: userData.password, email: 'fakeMail'},function (err) {
User.create({username: userData.username, password: userData.password, email: 'fakeMail'}, function (err) {
assert(err);
assert.equal(err.message, '[[error:invalid-email]]');
done();

Loading…
Cancel
Save