From 4ee0f1459d8095f2d33daef1d0a00c0a474c49b4 Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Wed, 3 Feb 2021 23:53:16 -0700
Subject: [PATCH] chore: eslint import/newline-after-import
---
.eslintrc | 1 -
Gruntfile.js | 3 +++
app.js | 2 ++
install/web.js | 1 +
src/api/topics.js | 1 +
src/cli/upgrade-plugins.js | 1 +
src/controllers/admin/settings.js | 1 +
src/database/index.js | 1 +
src/meta/build.js | 1 +
src/meta/css.js | 1 +
src/meta/js.js | 1 +
src/meta/languages.js | 2 ++
src/meta/logs.js | 1 +
src/meta/templates.js | 1 +
src/plugins/install.js | 3 ++-
src/routes/accounts.js | 1 +
src/socket.io/admin/analytics.js | 1 +
src/socket.io/admin/errors.js | 1 +
src/socket.io/admin/logs.js | 1 +
src/socket.io/admin/navigation.js | 1 +
src/socket.io/admin/rewards.js | 1 +
src/socket.io/admin/settings.js | 1 +
src/socket.io/admin/social.js | 1 +
src/socket.io/admin/widgets.js | 1 +
src/socket.io/notifications.js | 1 +
src/socket.io/posts.js | 1 +
src/socket.io/user.js | 1 +
src/upgrades/1.15.0/verified_users_group.js | 1 +
src/user/jobs/export-posts.js | 2 ++
src/user/jobs/export-profile.js | 2 ++
src/user/jobs/export-uploads.js | 2 ++
src/webserver.js | 1 +
test/api.js | 1 +
test/flags.js | 1 +
test/mocks/databasemock.js | 1 +
test/socket.io.js | 2 ++
test/translator.js | 1 +
37 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index 2290d9a6be..2dc290ffcf 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -114,7 +114,6 @@
"prefer-template": "off",
"no-var": "off",
"vars-on-top": "off",
- "import/newline-after-import": "off",
// TODO
"consistent-return": "off",
diff --git a/Gruntfile.js b/Gruntfile.js
index 9596b7dd97..7f61bad989 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -2,11 +2,13 @@
const path = require('path');
const nconf = require('nconf');
+
nconf.argv().env({
separator: '__',
});
const winston = require('winston');
const fork = require('child_process').fork;
+
const env = process.env;
var worker;
@@ -14,6 +16,7 @@ env.NODE_ENV = env.NODE_ENV || 'development';
const configFile = path.resolve(__dirname, nconf.any(['config', 'CONFIG']) || 'config.json');
const prestart = require('./src/prestart');
+
prestart.loadConfig(configFile);
var db = require('./src/database');
diff --git a/app.js b/app.js
index 1c7e5017d5..d55802f76c 100644
--- a/app.js
+++ b/app.js
@@ -22,6 +22,7 @@
require('./require-main');
const nconf = require('nconf');
+
nconf.argv().env({
separator: '__',
});
@@ -40,6 +41,7 @@ const configFile = path.resolve(__dirname, nconf.any(['config', 'CONFIG']) || 'c
const configExists = file.existsSync(configFile) || (nconf.get('url') && nconf.get('secret') && nconf.get('database'));
const prestart = require('./src/prestart');
+
prestart.loadConfig(configFile);
prestart.setupWinston();
prestart.versionCheck();
diff --git a/install/web.js b/install/web.js
index da63173139..4e216e99d9 100644
--- a/install/web.js
+++ b/install/web.js
@@ -8,6 +8,7 @@ const path = require('path');
const childProcess = require('child_process');
const less = require('less');
const util = require('util');
+
const lessRenderAsync = util.promisify(
(style, opts, cb) => less.render(String(style), opts, cb)
);
diff --git a/src/api/topics.js b/src/api/topics.js
index de62942370..67accba68b 100644
--- a/src/api/topics.js
+++ b/src/api/topics.js
@@ -7,6 +7,7 @@ const meta = require('../meta');
const privileges = require('../privileges');
const apiHelpers = require('./helpers');
+
const doTopicAction = apiHelpers.doTopicAction;
const websockets = require('../socket.io');
diff --git a/src/cli/upgrade-plugins.js b/src/cli/upgrade-plugins.js
index 577f8140b9..c45dd10405 100644
--- a/src/cli/upgrade-plugins.js
+++ b/src/cli/upgrade-plugins.js
@@ -10,6 +10,7 @@ const path = require('path');
const nconf = require('nconf');
const { paths, pluginNamePattern } = require('../constants');
+
const packageManager = nconf.get('package_manager');
const supportedPackageManagerList = require('./package-install').supportedPackageManager; // load config from src/cli/package-install.js
diff --git a/src/controllers/admin/settings.js b/src/controllers/admin/settings.js
index 46bca36835..15bf20ac79 100644
--- a/src/controllers/admin/settings.js
+++ b/src/controllers/admin/settings.js
@@ -10,6 +10,7 @@ const social = require('../../social');
const helpers = require('../helpers');
const translator = require('../../../public/src/modules/translator');
+
const settingsController = module.exports;
settingsController.get = async function (req, res) {
diff --git a/src/database/index.js b/src/database/index.js
index 0590b042d6..6ecfb42778 100644
--- a/src/database/index.js
+++ b/src/database/index.js
@@ -1,6 +1,7 @@
'use strict';
var nconf = require('nconf');
+
var databaseName = nconf.get('database');
var winston = require('winston');
diff --git a/src/meta/build.js b/src/meta/build.js
index dbf69296e1..3bcb9911b6 100644
--- a/src/meta/build.js
+++ b/src/meta/build.js
@@ -9,6 +9,7 @@ const mkdirp = require('mkdirp');
const cacheBuster = require('./cacheBuster');
const { aliases } = require('./aliases');
+
let meta;
const targetHandlers = {
diff --git a/src/meta/css.js b/src/meta/css.js
index 4a58f3c06f..be251538e7 100644
--- a/src/meta/css.js
+++ b/src/meta/css.js
@@ -6,6 +6,7 @@ const fs = require('fs');
const util = require('util');
const path = require('path');
const rimraf = require('rimraf');
+
const rimrafAsync = util.promisify(rimraf);
const plugins = require('../plugins');
diff --git a/src/meta/js.js b/src/meta/js.js
index 7e093890f7..67753e4455 100644
--- a/src/meta/js.js
+++ b/src/meta/js.js
@@ -10,6 +10,7 @@ if (!mkdirp.hasOwnProperty('native')) {
}
const rimraf = require('rimraf');
+
const rimrafAsync = util.promisify(rimraf);
const file = require('../file');
diff --git a/src/meta/languages.js b/src/meta/languages.js
index 7487c2b8d7..6e06411302 100644
--- a/src/meta/languages.js
+++ b/src/meta/languages.js
@@ -6,8 +6,10 @@ const path = require('path');
const fs = require('fs');
const util = require('util');
let mkdirp = require('mkdirp');
+
mkdirp = mkdirp.hasOwnProperty('native') ? mkdirp : util.promisify(mkdirp);
const rimraf = require('rimraf');
+
const rimrafAsync = util.promisify(rimraf);
const file = require('../file');
diff --git a/src/meta/logs.js b/src/meta/logs.js
index 7e00d36fdd..1b66cb4144 100644
--- a/src/meta/logs.js
+++ b/src/meta/logs.js
@@ -2,6 +2,7 @@
const path = require('path');
const fs = require('fs');
+
const Logs = module.exports;
Logs.path = path.resolve(__dirname, '../../logs/output.log');
diff --git a/src/meta/templates.js b/src/meta/templates.js
index 3ec9e03930..526fa6f26a 100644
--- a/src/meta/templates.js
+++ b/src/meta/templates.js
@@ -2,6 +2,7 @@
const util = require('util');
let mkdirp = require('mkdirp');
+
mkdirp = mkdirp.hasOwnProperty('native') ? mkdirp : util.promisify(mkdirp);
const rimraf = require('rimraf');
const winston = require('winston');
diff --git a/src/plugins/install.js b/src/plugins/install.js
index 49d0068b7e..89ff915484 100644
--- a/src/plugins/install.js
+++ b/src/plugins/install.js
@@ -14,7 +14,8 @@ const meta = require('../meta');
const pubsub = require('../pubsub');
const { paths } = require('../constants');
-const supportedPackageManagerList = require('../cli/package-install').supportedPackageManager; // load config from src/cli/package-install.js
+const supportedPackageManagerList = require('../cli/package-install').supportedPackageManager;
+// load config from src/cli/package-install.js
const packageManager = supportedPackageManagerList.indexOf(nconf.get('package_manager')) >= 0 ? nconf.get('package_manager') : 'npm';
let packageManagerExecutable = packageManager;
const packageManagerCommands = {
diff --git a/src/routes/accounts.js b/src/routes/accounts.js
index 1dc77cfd9b..45d147f712 100644
--- a/src/routes/accounts.js
+++ b/src/routes/accounts.js
@@ -4,6 +4,7 @@ const winston = require('winston');
const nconf = require('nconf');
var helpers = require('./helpers');
+
var setupPageRoute = helpers.setupPageRoute;
module.exports = function (app, middleware, controllers) {
diff --git a/src/socket.io/admin/analytics.js b/src/socket.io/admin/analytics.js
index 16cc82ec6d..533e7f2e32 100644
--- a/src/socket.io/admin/analytics.js
+++ b/src/socket.io/admin/analytics.js
@@ -2,6 +2,7 @@
const async = require('async');
const analytics = require('../../analytics');
+
const Analytics = module.exports;
Analytics.get = function (socket, data, callback) {
diff --git a/src/socket.io/admin/errors.js b/src/socket.io/admin/errors.js
index ba19ae8339..f60e9dfea2 100644
--- a/src/socket.io/admin/errors.js
+++ b/src/socket.io/admin/errors.js
@@ -1,6 +1,7 @@
'use strict';
const meta = require('../../meta');
+
const Errors = module.exports;
Errors.clear = function (socket, data, callback) {
diff --git a/src/socket.io/admin/logs.js b/src/socket.io/admin/logs.js
index 22bcbe71a7..662527b21b 100644
--- a/src/socket.io/admin/logs.js
+++ b/src/socket.io/admin/logs.js
@@ -1,6 +1,7 @@
'use strict';
const meta = require('../../meta');
+
const Logs = module.exports;
Logs.get = function (socket, data, callback) {
diff --git a/src/socket.io/admin/navigation.js b/src/socket.io/admin/navigation.js
index 9898117d99..a4dc1d1a35 100644
--- a/src/socket.io/admin/navigation.js
+++ b/src/socket.io/admin/navigation.js
@@ -1,6 +1,7 @@
'use strict';
const navigationAdmin = require('../../navigation/admin');
+
const SocketNavigation = module.exports;
SocketNavigation.save = async function (socket, data) {
diff --git a/src/socket.io/admin/rewards.js b/src/socket.io/admin/rewards.js
index 97a64f1f68..e68527547c 100644
--- a/src/socket.io/admin/rewards.js
+++ b/src/socket.io/admin/rewards.js
@@ -1,6 +1,7 @@
'use strict';
const rewardsAdmin = require('../../rewards/admin');
+
const SocketRewards = module.exports;
SocketRewards.save = async function (socket, data) {
diff --git a/src/socket.io/admin/settings.js b/src/socket.io/admin/settings.js
index 063c8ca4ee..fe4843821f 100644
--- a/src/socket.io/admin/settings.js
+++ b/src/socket.io/admin/settings.js
@@ -2,6 +2,7 @@
const meta = require('../../meta');
const events = require('../../events');
+
const Settings = module.exports;
Settings.get = function (socket, data, callback) {
diff --git a/src/socket.io/admin/social.js b/src/socket.io/admin/social.js
index 596f5aea72..378d736e89 100644
--- a/src/socket.io/admin/social.js
+++ b/src/socket.io/admin/social.js
@@ -1,6 +1,7 @@
'use strict';
const social = require('../../social');
+
const SocketSocial = module.exports;
SocketSocial.savePostSharingNetworks = async function (socket, data) {
diff --git a/src/socket.io/admin/widgets.js b/src/socket.io/admin/widgets.js
index 58a2a019d6..7dfc8e7ab7 100644
--- a/src/socket.io/admin/widgets.js
+++ b/src/socket.io/admin/widgets.js
@@ -2,6 +2,7 @@
const async = require('async');
const widgets = require('../../widgets');
+
const Widgets = module.exports;
Widgets.set = function (socket, data, callback) {
diff --git a/src/socket.io/notifications.js b/src/socket.io/notifications.js
index 0b555823a6..2b0df88114 100644
--- a/src/socket.io/notifications.js
+++ b/src/socket.io/notifications.js
@@ -2,6 +2,7 @@
const user = require('../user');
const notifications = require('../notifications');
+
const SocketNotifs = module.exports;
SocketNotifs.get = async function (socket, data) {
diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js
index e9fc770338..df9a773154 100644
--- a/src/socket.io/posts.js
+++ b/src/socket.io/posts.js
@@ -13,6 +13,7 @@ const utils = require('../utils');
const api = require('../api');
const sockets = require('.');
+
const SocketPosts = module.exports;
require('./posts/edit')(SocketPosts);
diff --git a/src/socket.io/user.js b/src/socket.io/user.js
index 6e7f03321f..4617b97b0e 100644
--- a/src/socket.io/user.js
+++ b/src/socket.io/user.js
@@ -2,6 +2,7 @@
const util = require('util');
const winston = require('winston');
+
const sleep = util.promisify(setTimeout);
const api = require('../api');
diff --git a/src/upgrades/1.15.0/verified_users_group.js b/src/upgrades/1.15.0/verified_users_group.js
index 9d940f1f84..37032b2f0a 100644
--- a/src/upgrades/1.15.0/verified_users_group.js
+++ b/src/upgrades/1.15.0/verified_users_group.js
@@ -7,6 +7,7 @@ const user = require('../../user');
const groups = require('../../groups');
const meta = require('../../meta');
const privileges = require('../../privileges');
+
const now = Date.now();
module.exports = {
name: 'Create verified/unverified user groups',
diff --git a/src/user/jobs/export-posts.js b/src/user/jobs/export-posts.js
index 643fa25d71..72f35464cd 100644
--- a/src/user/jobs/export-posts.js
+++ b/src/user/jobs/export-posts.js
@@ -1,6 +1,7 @@
'use strict';
const nconf = require('nconf');
+
nconf.argv().env({
separator: '__',
});
@@ -14,6 +15,7 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production';
// Alternate configuration file support
const configFile = path.resolve(__dirname, '../../../', nconf.any(['config', 'CONFIG']) || 'config.json');
const prestart = require('../../prestart');
+
prestart.loadConfig(configFile);
prestart.setupWinston();
diff --git a/src/user/jobs/export-profile.js b/src/user/jobs/export-profile.js
index 7f506e09eb..c934024fa9 100644
--- a/src/user/jobs/export-profile.js
+++ b/src/user/jobs/export-profile.js
@@ -1,6 +1,7 @@
'use strict';
const nconf = require('nconf');
+
nconf.argv().env({
separator: '__',
});
@@ -14,6 +15,7 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production';
// Alternate configuration file support
const configFile = path.resolve(__dirname, '../../../', nconf.any(['config', 'CONFIG']) || 'config.json');
const prestart = require('../../prestart');
+
prestart.loadConfig(configFile);
prestart.setupWinston();
diff --git a/src/user/jobs/export-uploads.js b/src/user/jobs/export-uploads.js
index 797ba35efb..4cba80cd25 100644
--- a/src/user/jobs/export-uploads.js
+++ b/src/user/jobs/export-uploads.js
@@ -1,6 +1,7 @@
'use strict';
const nconf = require('nconf');
+
nconf.argv().env({
separator: '__',
});
@@ -15,6 +16,7 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production';
// Alternate configuration file support
const configFile = path.resolve(__dirname, '../../../', nconf.any(['config', 'CONFIG']) || 'config.json');
const prestart = require('../../prestart');
+
prestart.loadConfig(configFile);
prestart.setupWinston();
diff --git a/src/webserver.js b/src/webserver.js
index 827baa5cc4..63254a08ed 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -7,6 +7,7 @@ var path = require('path');
var os = require('os');
var nconf = require('nconf');
var express = require('express');
+
var app = express();
app.renderAsync = util.promisify((tpl, data, callback) => app.render(tpl, data, callback));
var server;
diff --git a/test/api.js b/test/api.js
index 20956ee361..67d6bcf00d 100644
--- a/test/api.js
+++ b/test/api.js
@@ -9,6 +9,7 @@ const request = require('request-promise-native');
const nconf = require('nconf');
const jwt = require('jsonwebtoken');
const util = require('util');
+
const wait = util.promisify(setTimeout);
const db = require('./mocks/databasemock');
diff --git a/test/flags.js b/test/flags.js
index 1bbd764827..a243cbcc9a 100644
--- a/test/flags.js
+++ b/test/flags.js
@@ -3,6 +3,7 @@
const assert = require('assert');
const async = require('async');
const util = require('util');
+
const sleep = util.promisify(setTimeout);
const db = require('./mocks/databasemock');
diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js
index 34d9cf58c2..c5a9a5545b 100644
--- a/test/mocks/databasemock.js
+++ b/test/mocks/databasemock.js
@@ -116,6 +116,7 @@ winston.info('database config %s', dbType, testDbConfig);
winston.info('environment ' + global.env);
const db = require('../../src/database');
+
module.exports = db;
before(async function () {
diff --git a/test/socket.io.js b/test/socket.io.js
index 8af832cb83..3c3241d599 100644
--- a/test/socket.io.js
+++ b/test/socket.io.js
@@ -6,11 +6,13 @@
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const util = require('util');
+
const sleep = util.promisify(setTimeout);
var assert = require('assert');
var async = require('async');
var nconf = require('nconf');
var request = require('request');
+
var cookies = request.jar();
var db = require('./mocks/databasemock');
diff --git a/test/translator.js b/test/translator.js
index bd6d0f0fbb..7f765ac060 100644
--- a/test/translator.js
+++ b/test/translator.js
@@ -3,6 +3,7 @@
var assert = require('assert');
var shim = require('../public/src/modules/translator.js');
+
var Translator = shim.Translator;
var db = require('./mocks/databasemock');