First pass formatting with Prettier

* Added .prettierrc.json
* Added .prettierignore
* Formatted
This commit is contained in:
Bryan Ashby
2022-06-05 14:04:25 -06:00
parent eecfb33ad5
commit 4881c2123a
172 changed files with 23696 additions and 18029 deletions

View File

@@ -2,23 +2,23 @@
'use strict';
// ENiGMA½
const { MenuModule } = require('./menu_module.js');
const { MenuModule } = require('./menu_module.js');
const { getActiveConnectionList } = require('./client_connections.js');
const { Errors } = require('./enig_error.js');
const { Errors } = require('./enig_error.js');
// deps
const async = require('async');
const _ = require('lodash');
const async = require('async');
const _ = require('lodash');
exports.moduleInfo = {
name : 'Who\'s Online',
desc : 'Who is currently online',
author : 'NuSkooler',
packageName : 'codes.l33t.enigma.whosonline'
name: "Who's Online",
desc: 'Who is currently online',
author: 'NuSkooler',
packageName: 'codes.l33t.enigma.whosonline',
};
const MciViewIds = {
onlineList : 1,
onlineList: 1,
};
exports.getModule = class WhosOnlineModule extends MenuModule {
@@ -28,33 +28,47 @@ exports.getModule = class WhosOnlineModule extends MenuModule {
mciReady(mciData, cb) {
super.mciReady(mciData, err => {
if(err) {
if (err) {
return cb(err);
}
async.series(
[
(next) => {
next => {
return this.prepViewController('online', 0, mciData.menu, next);
},
(next) => {
const onlineListView = this.viewControllers.online.getView(MciViewIds.onlineList);
if(!onlineListView) {
return cb(Errors.MissingMci(`Missing online list MCI ${MciViewIds.onlineList}`));
next => {
const onlineListView = this.viewControllers.online.getView(
MciViewIds.onlineList
);
if (!onlineListView) {
return cb(
Errors.MissingMci(
`Missing online list MCI ${MciViewIds.onlineList}`
)
);
}
const onlineList = getActiveConnectionList(true).slice(0, onlineListView.height).map(
oe => Object.assign(oe, { text : oe.userName, timeOn : _.upperFirst(oe.timeOn.humanize()) })
);
const onlineList = getActiveConnectionList(true)
.slice(0, onlineListView.height)
.map(oe =>
Object.assign(oe, {
text: oe.userName,
timeOn: _.upperFirst(oe.timeOn.humanize()),
})
);
onlineListView.setItems(onlineList);
onlineListView.redraw();
return next(null);
}
},
],
err => {
if(err) {
this.client.log.error( { error : err.message }, 'Error loading who\'s online');
if (err) {
this.client.log.error(
{ error: err.message },
"Error loading who's online"
);
}
return cb(err);
}