lint: Put opening brace on same line as function

Normally I would let `eslint --fix` do this for me, but there's a bug
that causes:

    const x = function ()
    {
      // ...
    };

to become:

    const x = ()
    => {
      // ...
    };

which ESLint thinks is a syntax error. (It probably is; I don't know
enough about the automatic semicolon insertion rules to be confident.)
This commit is contained in:
Richard Hansen 2020-11-21 13:37:57 -05:00 committed by John McLear
parent cc988bd67b
commit 7df3ded66f
66 changed files with 1036 additions and 2072 deletions

View file

@ -158,8 +158,7 @@ exports.version = version;
* @req express request object
* @res express response object
*/
exports.handle = async function(apiVersion, functionName, fields, req, res)
{
exports.handle = async function(apiVersion, functionName, fields, req, res) {
// say goodbye if this is an unknown API version
if (!(apiVersion in version)) {
throw new createHTTPError.NotFound('no such api version');

View file

@ -49,8 +49,7 @@ const tempDirectory = os.tmpdir();
/**
* do a requested export
*/
async function doExport(req, res, padId, readOnlyId, type)
{
async function doExport(req, res, padId, readOnlyId, type) {
// avoid naming the read-only file as the original pad's id
var fileName = readOnlyId ? readOnlyId : padId;
@ -131,8 +130,7 @@ async function doExport(req, res, padId, readOnlyId, type)
}
}
exports.doExport = function(req, res, padId, readOnlyId, type)
{
exports.doExport = function(req, res, padId, readOnlyId, type) {
doExport(req, res, padId, readOnlyId, type).catch(err => {
if (err !== "stop") {
throw err;

View file

@ -57,8 +57,7 @@ const tmpDirectory = os.tmpdir();
/**
* do a requested import
*/
async function doImport(req, res, padId)
{
async function doImport(req, res, padId) {
var apiLogger = log4js.getLogger("ImportHandler");
// pipe to a file
@ -265,8 +264,7 @@ async function doImport(req, res, padId)
}
}
exports.doImport = function (req, res, padId)
{
exports.doImport = function (req, res, padId) {
/**
* NB: abuse the 'req' object by storing an additional
* 'directDatabaseAccess' property on it so that it can

View file

@ -80,8 +80,7 @@ let socketio;
* This Method is called by server.js to tell the message handler on which socket it should send
* @param socket_io The Socket
*/
exports.setSocketIO = function(socket_io)
{
exports.setSocketIO = function(socket_io) {
socketio=socket_io;
}
@ -99,8 +98,7 @@ exports.handleConnect = (socket) => {
/**
* Kicks all sessions from a pad
*/
exports.kickSessionsFromPad = function(padID)
{
exports.kickSessionsFromPad = function(padID) {
if(typeof socketio.sockets['clients'] !== 'function')
return;
@ -355,8 +353,7 @@ async function handleChatMessage(socket, message) {
* @param text the text of the chat message
* @param padId the padId to send the chat message to
*/
exports.sendChatMessageToPadClients = async function(time, userId, text, padId)
{
exports.sendChatMessageToPadClients = async function(time, userId, text, padId) {
// get the pad
let pad = await padManager.getPad(padId);
@ -688,8 +685,7 @@ async function handleUserChanges(socket, message) {
stopWatch.end();
}
exports.updatePadClients = async function(pad)
{
exports.updatePadClients = async function(pad) {
// skip this if no-one is on this pad
const roomSockets = _getRoomSockets(pad.id);
if (roomSockets.length === 0) return;
@ -837,8 +833,7 @@ async function handleSwitchToPad(socket, message, _authorID) {
}
// Creates/replaces the auth object in the given session info.
function createSessionInfoAuth(sessionInfo, message)
{
function createSessionInfoAuth(sessionInfo, message) {
// Remember this information since we won't
// have the cookie in further socket.io messages.
// This information will be used to check if
@ -1250,8 +1245,7 @@ async function handleChangesetRequest(socket, message) {
* Tries to rebuild the getChangestInfo function of the original Etherpad
* https://github.com/ether/pad/blob/master/etherpad/src/etherpad/control/pad/pad_changeset_control.js#L144
*/
async function getChangesetInfo(padId, startNum, endNum, granularity)
{
async function getChangesetInfo(padId, startNum, endNum, granularity) {
let pad = await padManager.getPad(padId);
let head_revision = pad.getHeadRevisionNumber();
@ -1344,8 +1338,7 @@ async function getChangesetInfo(padId, startNum, endNum, granularity)
* Tries to rebuild the getPadLines function of the original Etherpad
* https://github.com/ether/pad/blob/master/etherpad/src/etherpad/control/pad/pad_changeset_control.js#L263
*/
async function getPadLines(padId, revNum)
{
async function getPadLines(padId, revNum) {
let pad = await padManager.getPad(padId);
// get the atext
@ -1367,8 +1360,7 @@ async function getPadLines(padId, revNum)
* Tries to rebuild the composePadChangeset function of the original Etherpad
* https://github.com/ether/pad/blob/master/etherpad/src/etherpad/control/pad/pad_changeset_control.js#L241
*/
async function composePadChangesets (padId, startNum, endNum)
{
async function composePadChangesets (padId, startNum, endNum) {
let pad = await padManager.getPad(padId);
// fetch all changesets we need

View file

@ -37,8 +37,7 @@ var socket;
/**
* adds a component
*/
exports.addComponent = function(moduleName, module)
{
exports.addComponent = function(moduleName, module) {
// save the component
components[moduleName] = module;
@ -53,8 +52,7 @@ exports.setSocketIO = function(_socket) {
// save this socket internaly
socket = _socket;
socket.sockets.on('connection', function(client)
{
socket.sockets.on('connection', function(client) {
// wrap the original send function to log the messages
client._send = client.send;
client.send = function(message) {