From 9f65be577102e11410b4f7029bc075381a21dacb Mon Sep 17 00:00:00 2001 From: Nate Stemen Date: Thu, 20 Dec 2018 14:14:14 -0500 Subject: [PATCH] Prettier: convert individual decaffeinated files to Prettier format --- services/chat/Gruntfile.js | 220 +++++++++++----------- services/chat/app.js | 39 ++-- services/chat/config/settings.defaults.js | 54 +++--- 3 files changed, 164 insertions(+), 149 deletions(-) diff --git a/services/chat/Gruntfile.js b/services/chat/Gruntfile.js index 8e28c2e65e..3459144d54 100644 --- a/services/chat/Gruntfile.js +++ b/services/chat/Gruntfile.js @@ -4,126 +4,126 @@ * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ module.exports = function(grunt) { + // Project configuration. + grunt.initConfig({ + forever: { + app: { + options: { + index: 'app.js' + } + } + }, - // Project configuration. - grunt.initConfig({ - forever: { - app: { - options: { - index: "app.js" - } - } - }, + execute: { + app: { + src: 'app.js' + } + }, - execute: { - app: { - src: "app.js" - } - }, + coffee: { + server: { + expand: true, + flatten: false, + cwd: 'app/coffee', + src: ['**/*.coffee'], + dest: 'app/js/', + ext: '.js' + }, - coffee: { - server: { - expand: true, - flatten: false, - cwd: 'app/coffee', - src: ['**/*.coffee'], - dest: 'app/js/', - ext: '.js' - }, + app_server: { + expand: true, + flatten: false, + src: ['app.coffee'], + dest: './', + ext: '.js' + }, - app_server: { - expand: true, - flatten: false, - src: ['app.coffee'], - dest: './', - ext: '.js' - }, + unit_tests: { + expand: true, + flatten: false, + cwd: 'test/unit/coffee', + src: ['**/*.coffee'], + dest: 'test/unit/js/', + ext: '.js' + }, - unit_tests: { - expand: true, - flatten: false, - cwd: 'test/unit/coffee', - src: ['**/*.coffee'], - dest: 'test/unit/js/', - ext: '.js' - }, + acceptance_tests: { + expand: true, + flatten: false, + cwd: 'test/acceptance/coffee', + src: ['**/*.coffee'], + dest: 'test/acceptance/js/', + ext: '.js' + } + }, - acceptance_tests: { - expand: true, - flatten: false, - cwd: 'test/acceptance/coffee', - src: ['**/*.coffee'], - dest: 'test/acceptance/js/', - ext: '.js' - } - }, + watch: { + server_coffee: { + files: ['app/**/*.coffee', 'test/unit/**/*.coffee'], + tasks: ['compile:server', 'compile:unit_tests', 'mochaTest'] + } + }, - watch: { - server_coffee: { - files: ['app/**/*.coffee', 'test/unit/**/*.coffee'], - tasks: ['compile:server', 'compile:unit_tests', 'mochaTest'] - } - }, + clean: ['app/js', 'test/unit/js'], - clean: ["app/js", "test/unit/js"], + nodemon: { + dev: { + options: { + file: 'app.js' + } + } + }, - nodemon: { - dev: { - options: { - file: 'app.js' - } - } - }, + concurrent: { + dev: { + tasks: ['nodemon', 'watch'], + options: { + logConcurrentOutput: true + } + } + }, - concurrent: { - dev: { - tasks: ['nodemon', 'watch'], - options: { - logConcurrentOutput: true - } - } - }, + mochaTest: { + unit: { + options: { + reporter: process.env.MOCHA_RUNNER || 'spec', + grep: grunt.option('grep') + }, + src: ['test/unit/**/*.js'] + }, + acceptance: { + options: { + reporter: process.env.MOCHA_RUNNER || 'spec', + grep: grunt.option('grep') + }, + src: ['test/acceptance/**/*.js'] + } + }, - mochaTest: { - unit: { - options: { - reporter: process.env.MOCHA_RUNNER || "spec", - grep: grunt.option("grep") - }, - src: ['test/unit/**/*.js'] - }, - acceptance: { - options: { - reporter: process.env.MOCHA_RUNNER || "spec", - grep: grunt.option("grep") - }, - src: ['test/acceptance/**/*.js'] - } - }, + plato: { + your_task: { + files: { plato: ['app/js/**/*.js'] } + } + } + }) - plato: { - your_task: { - files: {'plato': ['app/js/**/*.js']} - } - } - }); - - grunt.loadNpmTasks('grunt-contrib-coffee'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-nodemon'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-concurrent'); - grunt.loadNpmTasks('grunt-mocha-test'); - grunt.loadNpmTasks('grunt-plato'); - grunt.loadNpmTasks('grunt-execute'); - grunt.loadNpmTasks('grunt-bunyan'); - grunt.loadNpmTasks('grunt-forever'); - - - grunt.registerTask('compile', ['clean', 'coffee']); - grunt.registerTask('install', ['compile']); - grunt.registerTask('default', ['compile', 'bunyan', 'execute']); - grunt.registerTask('test:unit', ['compile', 'mochaTest:unit']); - return grunt.registerTask('test:acceptance', ['compile:acceptance_tests', 'mochaTest:acceptance']); -}; + grunt.loadNpmTasks('grunt-contrib-coffee') + grunt.loadNpmTasks('grunt-contrib-watch') + grunt.loadNpmTasks('grunt-nodemon') + grunt.loadNpmTasks('grunt-contrib-clean') + grunt.loadNpmTasks('grunt-concurrent') + grunt.loadNpmTasks('grunt-mocha-test') + grunt.loadNpmTasks('grunt-plato') + grunt.loadNpmTasks('grunt-execute') + grunt.loadNpmTasks('grunt-bunyan') + grunt.loadNpmTasks('grunt-forever') + grunt.registerTask('compile', ['clean', 'coffee']) + grunt.registerTask('install', ['compile']) + grunt.registerTask('default', ['compile', 'bunyan', 'execute']) + grunt.registerTask('test:unit', ['compile', 'mochaTest:unit']) + return grunt.registerTask('test:acceptance', [ + 'compile:acceptance_tests', + 'mochaTest:acceptance' + ]) +} diff --git a/services/chat/app.js b/services/chat/app.js index 1d427bdd98..ceeaa2ce85 100644 --- a/services/chat/app.js +++ b/services/chat/app.js @@ -5,22 +5,35 @@ * DS207: Consider shorter variations of null checks * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ -const logger = require('logger-sharelatex'); -const settings = require('settings-sharelatex'); +const logger = require('logger-sharelatex') +const settings = require('settings-sharelatex') -const Server = require("./app/js/server"); +const Server = require('./app/js/server') -if (!module.parent) { // Called directly - const port = __guard__(settings.internal != null ? settings.internal.chat : undefined, x => x.port) || 3010; - const host = __guard__(settings.internal != null ? settings.internal.chat : undefined, x1 => x1.host) || "localhost"; - Server.server.listen(port, host, function(error) { - if (error != null) { throw error; } - return logger.info(`Chat starting up, listening on ${host}:${port}`); - }); +if (!module.parent) { + // Called directly + const port = + __guard__( + settings.internal != null ? settings.internal.chat : undefined, + x => x.port + ) || 3010 + const host = + __guard__( + settings.internal != null ? settings.internal.chat : undefined, + x1 => x1.host + ) || 'localhost' + Server.server.listen(port, host, function(error) { + if (error != null) { + throw error + } + return logger.info(`Chat starting up, listening on ${host}:${port}`) + }) } -module.exports = Server.server; +module.exports = Server.server function __guard__(value, transform) { - return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined; -} \ No newline at end of file + return typeof value !== 'undefined' && value !== null + ? transform(value) + : undefined +} diff --git a/services/chat/config/settings.defaults.js b/services/chat/config/settings.defaults.js index f0d219fa23..e8f150a85c 100644 --- a/services/chat/config/settings.defaults.js +++ b/services/chat/config/settings.defaults.js @@ -1,28 +1,30 @@ module.exports = { - internal: { - chat: { - host: process.env['LISTEN_ADDRESS'] || "localhost", - port: 3010 - } - }, - - apis: { - web: { - url: `http://${process.env['WEB_HOST'] || "localhost"}:${process.env['WEB_PORT'] || 3000}`, - user: "sharelatex", - pass: "password" - } - }, - - mongo: { - url : `mongodb://${process.env['MONGO_HOST'] || "localhost"}/sharelatex` - }, + internal: { + chat: { + host: process.env['LISTEN_ADDRESS'] || 'localhost', + port: 3010 + } + }, - redis: { - web: { - host: process.env['REDIS_HOST'] || "localhost", - port: "6379", - password: "" - } - } -}; \ No newline at end of file + apis: { + web: { + url: `http://${process.env['WEB_HOST'] || 'localhost'}:${process.env[ + 'WEB_PORT' + ] || 3000}`, + user: 'sharelatex', + pass: 'password' + } + }, + + mongo: { + url: `mongodb://${process.env['MONGO_HOST'] || 'localhost'}/sharelatex` + }, + + redis: { + web: { + host: process.env['REDIS_HOST'] || 'localhost', + port: '6379', + password: '' + } + } +}