From b1b486f729ddc34be44fd35f95c3c40b83b86774 Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Sat, 18 Feb 2017 01:19:20 -0700
Subject: [PATCH] ESlint quote-props
---
.eslintrc | 2 +-
public/src/admin/admin.js | 20 +++++-----
public/src/admin/advanced/errors.js | 2 +-
public/src/admin/general/dashboard.js | 2 +-
public/src/client/account/edit/password.js | 6 +--
public/src/client/chats.js | 2 +-
public/src/client/topic.js | 4 +-
public/src/installer/install.js | 2 +-
public/src/modules/components.js | 4 +-
public/src/modules/search.js | 2 +-
public/src/modules/settings/array.js | 4 +-
public/src/require-config.js | 8 ++--
public/src/utils.js | 46 +++++++++++-----------
src/analytics.js | 2 +-
src/controllers/accounts/settings.js | 40 +++++++++----------
src/controllers/index.js | 2 +-
src/controllers/recent.js | 2 +-
src/controllers/unread.js | 2 +-
src/database/mongo.js | 12 +++---
src/database/redis.js | 6 +--
src/install.js | 6 +--
src/middleware/admin.js | 4 +-
src/posts/create.js | 12 +++---
src/topics/create.js | 26 ++++++------
src/user/create.js | 38 +++++++++---------
25 files changed, 128 insertions(+), 128 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index 0a6be521c6..2a6f9e3368 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -102,7 +102,7 @@
"prefer-rest-params": "off",
"space-in-parens": "off",
"block-spacing": "off",
- "quote-props": "off",
+ // "quote-props": "off",
// "space-unary-ops": "off",
// "no-plusplus": "off",
// "no-empty": "off",
diff --git a/public/src/admin/admin.js b/public/src/admin/admin.js
index 8940d07284..8d1d56ab64 100644
--- a/public/src/admin/admin.js
+++ b/public/src/admin/admin.js
@@ -179,10 +179,10 @@
var env = utils.findBootstrapEnvironment();
var slideout = new Slideout({
- 'panel': document.getElementById('panel'),
- 'menu': document.getElementById('menu'),
- 'padding': 256,
- 'tolerance': 70,
+ panel: document.getElementById('panel'),
+ menu: document.getElementById('menu'),
+ padding: 256,
+ tolerance: 70,
});
if (env === 'md' || env === 'lg') {
@@ -205,20 +205,20 @@
if (env === 'md' || env === 'lg') {
slideout.disableTouch();
$('#header').css({
- 'position': 'relative',
+ position: 'relative',
});
} else {
slideout.enableTouch();
$('#header').css({
- 'position': 'fixed',
+ position: 'fixed',
});
}
});
function onOpeningMenu() {
$('#header').css({
- 'top': $('#panel').position().top * -1 + 'px',
- 'position': 'absolute',
+ top: $('#panel').position().top * -1 + 'px',
+ position: 'absolute',
});
}
@@ -226,8 +226,8 @@
slideout.on('close', function () {
$('#header').css({
- 'top': '0px',
- 'position': 'fixed',
+ top: '0px',
+ position: 'fixed',
});
});
}
diff --git a/public/src/admin/advanced/errors.js b/public/src/admin/advanced/errors.js
index 1d428da4c2..816a145a72 100644
--- a/public/src/admin/advanced/errors.js
+++ b/public/src/admin/advanced/errors.js
@@ -52,7 +52,7 @@ define('admin/advanced/errors', ['Chart', 'translator'], function (Chart, transl
},
],
},
- 'toobusy': {
+ toobusy: {
labels: dailyLabels,
datasets: [
{
diff --git a/public/src/admin/general/dashboard.js b/public/src/admin/general/dashboard.js
index 798f470ae8..2b8709962a 100644
--- a/public/src/admin/general/dashboard.js
+++ b/public/src/admin/general/dashboard.js
@@ -374,7 +374,7 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator'], function (s
function updateTopicsGraph(topics) {
if (!Object.keys(topics).length) {
- topics = {"0": {
+ topics = {0: {
title: "No users browsing",
value: 1,
}};
diff --git a/public/src/client/account/edit/password.js b/public/src/client/account/edit/password.js
index e2210e724c..e6fccf46e5 100644
--- a/public/src/client/account/edit/password.js
+++ b/public/src/client/account/edit/password.js
@@ -63,9 +63,9 @@ define('forum/account/edit/password', ['forum/account/header', 'translator'], fu
if ((passwordvalid && passwordsmatch) || app.user.isAdmin) {
btn.addClass('disabled').find('i').removeClass('hide');
socket.emit('user.changePassword', {
- 'currentPassword': currentPassword.val(),
- 'newPassword': password.val(),
- 'uid': ajaxify.data.theirid,
+ currentPassword: currentPassword.val(),
+ newPassword: password.val(),
+ uid: ajaxify.data.theirid,
}, function (err) {
btn.removeClass('disabled').find('i').addClass('hide');
currentPassword.val('');
diff --git a/public/src/client/chats.js b/public/src/client/chats.js
index e0df5804df..d05e9d2e99 100644
--- a/public/src/client/chats.js
+++ b/public/src/client/chats.js
@@ -321,7 +321,7 @@ define('forum/chats', [
} else {
var recentEl = components.get('chat/recent');
templates.parse('partials/chats/recent_room', {
- rooms: { "roomId": data.roomId, "lastUser": data.message.fromUser, "usernames": data.message.fromUser.username, "unread": true },
+ rooms: { roomId: data.roomId, lastUser: data.message.fromUser, usernames: data.message.fromUser.username, unread: true },
}, function (html) {
translator.translate(html, function (translated) {
recentEl.prepend(translated);
diff --git a/public/src/client/topic.js b/public/src/client/topic.js
index ec64795895..06462f4d87 100644
--- a/public/src/client/topic.js
+++ b/public/src/client/topic.js
@@ -279,8 +279,8 @@ define('forum/topic', [
if (ajaxify.data.postcount > ajaxify.data.bookmarkThreshold && (!currentBookmark || parseInt(index, 10) > parseInt(currentBookmark, 10))) {
if (app.user.uid) {
socket.emit('topics.bookmark', {
- 'tid': ajaxify.data.tid,
- 'index': index,
+ tid: ajaxify.data.tid,
+ index: index,
}, function (err) {
if (err) {
return app.alertError(err.message);
diff --git a/public/src/installer/install.js b/public/src/installer/install.js
index 5f8e59b1eb..540f5c877c 100644
--- a/public/src/installer/install.js
+++ b/public/src/installer/install.js
@@ -42,7 +42,7 @@ $('document').ready(function () {
if ($('form .admin .error').length) {
ev.preventDefault();
- $('html, body').animate({'scrollTop': '0px'}, 400);
+ $('html, body').animate({scrollTop: '0px'}, 400);
return false;
} else {
diff --git a/public/src/modules/components.js b/public/src/modules/components.js
index 2aeefb7f57..da6bd20086 100644
--- a/public/src/modules/components.js
+++ b/public/src/modules/components.js
@@ -10,10 +10,10 @@ define('components', function () {
return $('[component="topic/teaser"]');
}
},
- 'topic': function (name, value) {
+ topic: function (name, value) {
return $('[component="topic"][data-' + name + '="' + value + '"]');
},
- 'post': function (name, value) {
+ post: function (name, value) {
return $('[component="post"][data-' + name + '="' + value + '"]');
},
'post/content': function (pid) {
diff --git a/public/src/modules/search.js b/public/src/modules/search.js
index f6cf3c1621..f17baab285 100644
--- a/public/src/modules/search.js
+++ b/public/src/modules/search.js
@@ -39,7 +39,7 @@ define('search', ['navigator', 'translator'], function (nav, translator) {
var postedBy = data.by || '';
var query = {
term: data.term,
- 'in': searchIn,
+ in: searchIn,
};
if (postedBy && (searchIn === 'posts' || searchIn === 'titles' || searchIn === 'titlesposts')) {
diff --git a/public/src/modules/settings/array.js b/public/src/modules/settings/array.js
index 7096953299..6957b85bc7 100644
--- a/public/src/modules/settings/array.js
+++ b/public/src/modules/settings/array.js
@@ -12,7 +12,7 @@ define('settings/array', function () {
*/
function createRemoveButton(elements) {
var rm = $(helper.createElement('button', {
- "class": 'btn btn-xs btn-primary remove',
+ class: 'btn btn-xs btn-primary remove',
title: 'Remove Item',
}, '-'));
rm.click(function (event) {
@@ -75,7 +75,7 @@ define('settings/array', function () {
var addSpace = $(document.createTextNode(' '));
var newValue = element.data('new') || '';
var add = $(helper.createElement('button', {
- "class": 'btn btn-sm btn-primary add',
+ class: 'btn btn-sm btn-primary add',
title: 'Expand Array',
}, '+'));
add.click(function (event) {
diff --git a/public/src/require-config.js b/public/src/require-config.js
index 661083fb8e..b102a5abae 100644
--- a/public/src/require-config.js
+++ b/public/src/require-config.js
@@ -3,9 +3,9 @@ require.config({
waitSeconds: 7,
urlArgs: config['cache-buster'],
paths: {
- 'forum': '../client',
- 'admin': '../admin',
- 'vendor': '../../vendor',
- 'plugins': '../../plugins',
+ forum: '../client',
+ admin: '../admin',
+ vendor: '../../vendor',
+ plugins: '../../plugins',
},
});
diff --git a/public/src/utils.js b/public/src/utils.js
index 891bb21da1..1d74b53b38 100644
--- a/public/src/utils.js
+++ b/public/src/utils.js
@@ -165,29 +165,29 @@
},
extensionMimeTypeMap: {
- "bmp": "image/bmp",
- "cmx": "image/x-cmx",
- "cod": "image/cis-cod",
- "gif": "image/gif",
- "ico": "image/x-icon",
- "ief": "image/ief",
- "jfif": "image/pipeg",
- "jpe": "image/jpeg",
- "jpeg": "image/jpeg",
- "jpg": "image/jpeg",
- "png": "image/png",
- "pbm": "image/x-portable-bitmap",
- "pgm": "image/x-portable-graymap",
- "pnm": "image/x-portable-anymap",
- "ppm": "image/x-portable-pixmap",
- "ras": "image/x-cmu-raster",
- "rgb": "image/x-rgb",
- "svg": "image/svg+xml",
- "tif": "image/tiff",
- "tiff": "image/tiff",
- "xbm": "image/x-xbitmap",
- "xpm": "image/x-xpixmap",
- "xwd": "image/x-xwindowdump",
+ bmp: "image/bmp",
+ cmx: "image/x-cmx",
+ cod: "image/cis-cod",
+ gif: "image/gif",
+ ico: "image/x-icon",
+ ief: "image/ief",
+ jfif: "image/pipeg",
+ jpe: "image/jpeg",
+ jpeg: "image/jpeg",
+ jpg: "image/jpeg",
+ png: "image/png",
+ pbm: "image/x-portable-bitmap",
+ pgm: "image/x-portable-graymap",
+ pnm: "image/x-portable-anymap",
+ ppm: "image/x-portable-pixmap",
+ ras: "image/x-cmu-raster",
+ rgb: "image/x-rgb",
+ svg: "image/svg+xml",
+ tif: "image/tiff",
+ tiff: "image/tiff",
+ xbm: "image/x-xbitmap",
+ xpm: "image/x-xpixmap",
+ xwd: "image/x-xwindowdump",
},
fileMimeType: function (path) {
diff --git a/src/analytics.js b/src/analytics.js
index e3544aa281..30708d5a22 100644
--- a/src/analytics.js
+++ b/src/analytics.js
@@ -194,7 +194,7 @@ Analytics.getCategoryAnalytics = function (cid, callback) {
Analytics.getErrorAnalytics = function (callback) {
async.parallel({
'not-found': async.apply(Analytics.getDailyStatsForSet, 'analytics:errors:404', Date.now(), 7),
- 'toobusy': async.apply(Analytics.getDailyStatsForSet, 'analytics:errors:503', Date.now(), 7),
+ toobusy: async.apply(Analytics.getDailyStatsForSet, 'analytics:errors:503', Date.now(), 7),
}, callback);
};
diff --git a/src/controllers/accounts/settings.js b/src/controllers/accounts/settings.js
index 39141fcb2f..16939be08d 100644
--- a/src/controllers/accounts/settings.js
+++ b/src/controllers/accounts/settings.js
@@ -51,9 +51,9 @@ settingsController.get = function (req, res, callback) {
userData.homePageRoutes = results.homePageRoutes;
var soundSettings = {
- 'notificationSound': 'notification',
- 'incomingChatSound': 'chat-incoming',
- 'outgoingChatSound': 'chat-outgoing',
+ notificationSound: 'notification',
+ incomingChatSound: 'chat-incoming',
+ outgoingChatSound: 'chat-outgoing',
};
Object.keys(soundSettings).forEach(function (setting) {
@@ -83,23 +83,23 @@ settingsController.get = function (req, res, callback) {
userData.bootswatchSkinOptions = [
- { "name": "Default", "value": "default" },
- { "name": "Cerulean", "value": "cerulean" },
- { "name": "Cosmo", "value": "cosmo" },
- { "name": "Cyborg", "value": "cyborg" },
- { "name": "Darkly", "value": "darkly" },
- { "name": "Flatly", "value": "flatly" },
- { "name": "Journal", "value": "journal" },
- { "name": "Lumen", "value": "lumen" },
- { "name": "Paper", "value": "paper" },
- { "name": "Readable", "value": "readable" },
- { "name": "Sandstone", "value": "sandstone" },
- { "name": "Simplex", "value": "simplex" },
- { "name": "Slate", "value": "slate" },
- { "name": "Spacelab", "value": "spacelab" },
- { "name": "Superhero", "value": "superhero" },
- { "name": "United", "value": "united" },
- { "name": "Yeti", "value": "yeti" },
+ { name: "Default", value: "default" },
+ { name: "Cerulean", value: "cerulean" },
+ { name: "Cosmo", value: "cosmo" },
+ { name: "Cyborg", value: "cyborg" },
+ { name: "Darkly", value: "darkly" },
+ { name: "Flatly", value: "flatly" },
+ { name: "Journal", value: "journal" },
+ { name: "Lumen", value: "lumen" },
+ { name: "Paper", value: "paper" },
+ { name: "Readable", value: "readable" },
+ { name: "Sandstone", value: "sandstone" },
+ { name: "Simplex", value: "simplex" },
+ { name: "Slate", value: "slate" },
+ { name: "Spacelab", value: "spacelab" },
+ { name: "Superhero", value: "superhero" },
+ { name: "United", value: "united" },
+ { name: "Yeti", value: "yeti" },
];
var isCustom = true;
diff --git a/src/controllers/index.js b/src/controllers/index.js
index e8b10ead0b..13927824d3 100644
--- a/src/controllers/index.js
+++ b/src/controllers/index.js
@@ -180,7 +180,7 @@ Controllers.register = function (req, res, next) {
var loginStrategies = require('../routes/authentication').getLoginStrategies();
var data = {
'register_window:spansize': loginStrategies.length ? 'col-md-6' : 'col-md-12',
- 'alternate_logins': !!loginStrategies.length,
+ alternate_logins: !!loginStrategies.length,
};
data.authentication = loginStrategies;
diff --git a/src/controllers/recent.js b/src/controllers/recent.js
index a8abd92d28..94a8c6a9ec 100644
--- a/src/controllers/recent.js
+++ b/src/controllers/recent.js
@@ -13,7 +13,7 @@ var pagination = require('../pagination');
var recentController = {};
-var validFilter = {'': true, 'new': true, 'watched': true};
+var validFilter = {'': true, new: true, watched: true};
recentController.get = function (req, res, next) {
var page = parseInt(req.query.page, 10) || 1;
diff --git a/src/controllers/unread.js b/src/controllers/unread.js
index ef390ba7e0..a0da19c6c4 100644
--- a/src/controllers/unread.js
+++ b/src/controllers/unread.js
@@ -12,7 +12,7 @@ var helpers = require('./helpers');
var unreadController = {};
-var validFilter = {'': true, 'new': true, 'watched': true};
+var validFilter = {'': true, new: true, watched: true};
unreadController.get = function (req, res, next) {
var page = parseInt(req.query.page, 10) || 1;
diff --git a/src/database/mongo.js b/src/database/mongo.js
index 1dfc45ccb4..27cbbef503 100644
--- a/src/database/mongo.js
+++ b/src/database/mongo.js
@@ -17,17 +17,17 @@
{
name: 'mongo:host',
description: 'Host IP or address of your MongoDB instance',
- 'default': nconf.get('mongo:host') || '127.0.0.1',
+ default: nconf.get('mongo:host') || '127.0.0.1',
},
{
name: 'mongo:port',
description: 'Host port of your MongoDB instance',
- 'default': nconf.get('mongo:port') || 27017,
+ default: nconf.get('mongo:port') || 27017,
},
{
name: 'mongo:username',
description: 'MongoDB username',
- 'default': nconf.get('mongo:username') || '',
+ default: nconf.get('mongo:username') || '',
},
{
name: 'mongo:password',
@@ -39,7 +39,7 @@
{
name: "mongo:database",
description: "MongoDB database name",
- 'default': nconf.get('mongo:database') || 'nodebb',
+ default: nconf.get('mongo:database') || 'nodebb',
},
];
@@ -189,10 +189,10 @@
}
async.parallel({
serverStatus: function (next) {
- db.command({ 'serverStatus': 1 }, next);
+ db.command({ serverStatus: 1 }, next);
},
stats: function (next) {
- db.command({ 'dbStats': 1 }, next);
+ db.command({ dbStats: 1 }, next);
},
listCollections: function (next) {
db.listCollections().toArray(function (err, items) {
diff --git a/src/database/redis.js b/src/database/redis.js
index f363aafb5c..83384c06f2 100644
--- a/src/database/redis.js
+++ b/src/database/redis.js
@@ -14,12 +14,12 @@
{
name: 'redis:host',
description: 'Host IP or address of your Redis instance',
- 'default': nconf.get('redis:host') || '127.0.0.1',
+ default: nconf.get('redis:host') || '127.0.0.1',
},
{
name: 'redis:port',
description: 'Host port of your Redis instance',
- 'default': nconf.get('redis:port') || 6379,
+ default: nconf.get('redis:port') || 6379,
},
{
name: 'redis:password',
@@ -31,7 +31,7 @@
{
name: "redis:database",
description: "Which database to use (0..n)",
- 'default': nconf.get('redis:database') || 0,
+ default: nconf.get('redis:database') || 0,
},
];
diff --git a/src/install.js b/src/install.js
index cd94e8726d..19532403a6 100644
--- a/src/install.js
+++ b/src/install.js
@@ -15,7 +15,7 @@ questions.main = [
{
name: 'url',
description: 'URL used to access this NodeBB',
- 'default':
+ default:
nconf.get('url') ||
(nconf.get('base_url') ? (nconf.get('base_url') + (nconf.get('use_port') ? ':' + nconf.get('port') : '')) : null) || // backwards compatibility (remove for v0.7.0)
'http://localhost:4567',
@@ -25,12 +25,12 @@ questions.main = [
{
name: 'secret',
description: 'Please enter a NodeBB secret',
- 'default': nconf.get('secret') || utils.generateUUID(),
+ default: nconf.get('secret') || utils.generateUUID(),
},
{
name: 'database',
description: 'Which database to use',
- 'default': nconf.get('database') || 'mongo',
+ default: nconf.get('database') || 'mongo',
},
];
diff --git a/src/middleware/admin.js b/src/middleware/admin.js
index 0665ff4415..f5439a139b 100644
--- a/src/middleware/admin.js
+++ b/src/middleware/admin.js
@@ -44,8 +44,8 @@ module.exports = function (middleware) {
middleware.admin.renderHeader = function (req, res, data, next) {
var custom_header = {
- 'plugins': [],
- 'authentication': [],
+ plugins: [],
+ authentication: [],
};
user.getUserFields(req.uid, ['username', 'userslug', 'email', 'picture', 'email:confirmed'], function (err, userData) {
diff --git a/src/posts/create.js b/src/posts/create.js
index fcd7bd1109..6e21494137 100644
--- a/src/posts/create.js
+++ b/src/posts/create.js
@@ -38,12 +38,12 @@ module.exports = function (Posts) {
function (pid, next) {
postData = {
- 'pid': pid,
- 'uid': uid,
- 'tid': tid,
- 'content': content,
- 'timestamp': timestamp,
- 'deleted': 0,
+ pid: pid,
+ uid: uid,
+ tid: tid,
+ content: content,
+ timestamp: timestamp,
+ deleted: 0,
};
if (data.toPid) {
diff --git a/src/topics/create.js b/src/topics/create.js
index cdb0a79bf3..8419f56c91 100644
--- a/src/topics/create.js
+++ b/src/topics/create.js
@@ -30,19 +30,19 @@ module.exports = function (Topics) {
},
function (tid, next) {
topicData = {
- 'tid': tid,
- 'uid': data.uid,
- 'cid': data.cid,
- 'mainPid': 0,
- 'title': data.title,
- 'slug': tid + '/' + (utils.slugify(data.title) || 'topic'),
- 'timestamp': timestamp,
- 'lastposttime': 0,
- 'postcount': 0,
- 'viewcount': 0,
- 'locked': 0,
- 'deleted': 0,
- 'pinned': 0,
+ tid: tid,
+ uid: data.uid,
+ cid: data.cid,
+ mainPid: 0,
+ title: data.title,
+ slug: tid + '/' + (utils.slugify(data.title) || 'topic'),
+ timestamp: timestamp,
+ lastposttime: 0,
+ postcount: 0,
+ viewcount: 0,
+ locked: 0,
+ deleted: 0,
+ pinned: 0,
};
if (data.thumb) {
diff --git a/src/user/create.js b/src/user/create.js
index d61a79d39a..ebd3a56d15 100644
--- a/src/user/create.js
+++ b/src/user/create.js
@@ -24,25 +24,25 @@ module.exports = function (User) {
var timestamp = data.timestamp || Date.now();
var userData = {
- 'username': data.username,
- 'userslug': data.userslug,
- 'email': data.email || '',
- 'joindate': timestamp,
- 'lastonline': timestamp,
- 'picture': '',
- 'fullname': data.fullname || '',
- 'location': '',
- 'birthday': '',
- 'website': '',
- 'signature': '',
- 'uploadedpicture': '',
- 'profileviews': 0,
- 'reputation': 0,
- 'postcount': 0,
- 'topiccount': 0,
- 'lastposttime': 0,
- 'banned': 0,
- 'status': 'online',
+ username: data.username,
+ userslug: data.userslug,
+ email: data.email || '',
+ joindate: timestamp,
+ lastonline: timestamp,
+ picture: '',
+ fullname: data.fullname || '',
+ location: '',
+ birthday: '',
+ website: '',
+ signature: '',
+ uploadedpicture: '',
+ profileviews: 0,
+ reputation: 0,
+ postcount: 0,
+ topiccount: 0,
+ lastposttime: 0,
+ banned: 0,
+ status: 'online',
};
async.parallel({