Эх сурвалжийг харах

Merge pull request #66 from overleaf/jpa-bump-dev-env-3-3-2

[misc] bump the dev-env to 3.3.2
Christopher Hoskin 6 жил өмнө
parent
commit
6177cf7e51
30 өөрчлөгдсөн 475 нэмэгдсэн , 440 устгасан
  1. 1 1
      services/spelling/.eslintrc
  2. 17 0
      services/spelling/.github/dependabot.yml
  3. 3 0
      services/spelling/.gitignore
  4. 0 2
      services/spelling/Dockerfile
  5. 0 131
      services/spelling/Jenkinsfile
  6. 3 3
      services/spelling/Makefile
  7. 1 1
      services/spelling/app.js
  8. 3 3
      services/spelling/app/js/ASpell.js
  9. 4 4
      services/spelling/app/js/ASpellWorker.js
  10. 5 3
      services/spelling/app/js/ASpellWorkerPool.js
  11. 1 1
      services/spelling/app/js/HealthCheckController.js
  12. 2 2
      services/spelling/app/js/LearnedWordsManager.js
  13. 5 5
      services/spelling/app/js/SpellingAPIController.js
  14. 1 1
      services/spelling/app/js/SpellingAPIManager.js
  15. 1 3
      services/spelling/buildscript.txt
  16. 3 1
      services/spelling/docker-compose.ci.yml
  17. 5 3
      services/spelling/docker-compose.yml
  18. 0 1
      services/spelling/nodemon.json
  19. 249 109
      services/spelling/package-lock.json
  20. 5 4
      services/spelling/package.json
  21. 27 27
      services/spelling/test/acceptance/js/CheckTest.js
  22. 2 2
      services/spelling/test/acceptance/js/HealthCheckTest.js
  23. 1 1
      services/spelling/test/acceptance/js/Init.js
  24. 12 12
      services/spelling/test/acceptance/js/LearnTest.js
  25. 2 2
      services/spelling/test/acceptance/js/StatusTest.js
  26. 6 6
      services/spelling/test/stress/js/stressTest.js
  27. 22 22
      services/spelling/test/unit/js/ASpellTests.js
  28. 17 17
      services/spelling/test/unit/js/ASpellWorkerTests.js
  29. 21 21
      services/spelling/test/unit/js/LearnedWordsManagerTests.js
  30. 56 52
      services/spelling/test/unit/js/SpellingAPIManagerTests.js

+ 1 - 1
services/spelling/.eslintrc

@@ -8,7 +8,7 @@
     "prettier/standard"
     "prettier/standard"
   ],
   ],
   "parserOptions": {
   "parserOptions": {
-    "ecmaVersion": 2017
+    "ecmaVersion": 2018
   },
   },
   "plugins": [
   "plugins": [
     "mocha",
     "mocha",

+ 17 - 0
services/spelling/.github/dependabot.yml

@@ -0,0 +1,17 @@
+version: 2
+updates:
+  - package-ecosystem: "npm"
+    directory: "/"
+    schedule:
+      interval: "daily"
+
+    pull-request-branch-name:
+      # Separate sections of the branch name with a hyphen
+      # Docker images use the branch name and do not support slashes in tags
+      # https://github.com/overleaf/google-ops/issues/822
+      # https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#pull-request-branch-nameseparator
+      separator: "-"
+
+    # Block informal upgrades -- security upgrades use a separate queue.
+    # https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#open-pull-requests-limit
+    open-pull-requests-limit: 0

+ 3 - 0
services/spelling/.gitignore

@@ -3,3 +3,6 @@
 node_modules/*
 node_modules/*
 cache/spell.cache
 cache/spell.cache
 **/*.map
 **/*.map
+
+# managed by dev-environment$ bin/update_build_scripts
+.npmrc

+ 0 - 2
services/spelling/Dockerfile

@@ -17,8 +17,6 @@ RUN npm ci --quiet
 
 
 COPY . /app
 COPY . /app
 
 
-
-
 FROM base
 FROM base
 
 
 COPY --from=app /app /app
 COPY --from=app /app /app

+ 0 - 131
services/spelling/Jenkinsfile

@@ -1,131 +0,0 @@
-String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
-
-pipeline {
-  agent any
-
-  environment {
-    GIT_PROJECT = "spelling"
-    JENKINS_WORKFLOW = "spelling-sharelatex"
-    TARGET_URL = "${env.JENKINS_URL}blue/organizations/jenkins/${JENKINS_WORKFLOW}/detail/$BRANCH_NAME/$BUILD_NUMBER/pipeline"
-    GIT_API_URL = "https://api.github.com/repos/overleaf/${GIT_PROJECT}/statuses/$GIT_COMMIT"
-  }
-
-  triggers {
-    pollSCM('* * * * *')
-    cron(cron_string)
-  }
-
-  stages {
-
-    stage('Install') {
-      steps {
-        withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
-          sh "curl $GIT_API_URL \
-            --data '{ \
-            \"state\" : \"pending\", \
-            \"target_url\": \"$TARGET_URL\", \
-            \"description\": \"Your build is underway\", \
-            \"context\": \"ci/jenkins\" }' \
-            -u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
-        }
-      }
-    }
-
-    stage('Build') {
-      steps {
-        sh 'make build'
-      }
-    }
-
-    stage('Linting') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make format'
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make lint'
-      }
-    }
-
-    stage('Unit Tests') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
-      }
-    }
-
-    stage('Acceptance Tests') {
-      steps {
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
-      }
-    }
-
-    stage('Package and docker push') {
-      steps {
-        sh 'echo ${BUILD_NUMBER} > build_number.txt'
-        sh 'touch build.tar.gz' // Avoid tar warning about files changing during read
-        sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make tar'
-        
-        withCredentials([file(credentialsId: 'gcr.io_overleaf-ops', variable: 'DOCKER_REPO_KEY_PATH')]) {
-          sh 'docker login -u _json_key --password-stdin https://gcr.io/overleaf-ops < ${DOCKER_REPO_KEY_PATH}'
-        }
-        sh 'DOCKER_REPO=gcr.io/overleaf-ops make publish'
-        sh 'docker logout https://gcr.io/overleaf-ops'
-        
-      }
-    }
-
-    stage('Publish to s3') {
-      steps {
-        sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt'
-        withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
-            s3Upload(file:'build.tar.gz', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/${BUILD_NUMBER}.tar.gz")
-        }
-        withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
-            // The deployment process uses this file to figure out the latest build
-            s3Upload(file:'build_number.txt', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/latest")
-        }
-      }
-    }
-  }
-
-  post {
-    always {
-      sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_clean'
-      sh 'make clean'
-    }
-
-    success {
-      withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
-        sh "curl $GIT_API_URL \
-          --data '{ \
-          \"state\" : \"success\", \
-          \"target_url\": \"$TARGET_URL\", \
-          \"description\": \"Your build succeeded!\", \
-          \"context\": \"ci/jenkins\" }' \
-          -u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
-      }
-    }
-
-    failure {
-      mail(from: "${EMAIL_ALERT_FROM}",
-           to: "${EMAIL_ALERT_TO}",
-           subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
-           body: "Build: ${BUILD_URL}")
-      withCredentials([usernamePassword(credentialsId: 'GITHUB_INTEGRATION', usernameVariable: 'GH_AUTH_USERNAME', passwordVariable: 'GH_AUTH_PASSWORD')]) {
-        sh "curl $GIT_API_URL \
-          --data '{ \
-          \"state\" : \"failure\", \
-          \"target_url\": \"$TARGET_URL\", \
-          \"description\": \"Your build failed\", \
-          \"context\": \"ci/jenkins\" }' \
-          -u $GH_AUTH_USERNAME:$GH_AUTH_PASSWORD"
-      }
-    }
-  }
-
-  // The options directive is for configuration that applies to the whole job.
-  options {
-    // we'd like to make sure remove old builds, so we don't fill up our storage!
-    buildDiscarder(logRotator(numToKeepStr:'50'))
-
-    // And we'd really like to be sure that this build doesn't hang forever, so let's time it out after:
-    timeout(time: 30, unit: 'MINUTES')
-  }
-}

+ 3 - 3
services/spelling/Makefile

@@ -25,13 +25,13 @@ clean:
 	docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
 	docker rmi gcr.io/overleaf-ops/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER)
 
 
 format:
 format:
-	$(DOCKER_COMPOSE) run --rm test_unit npm run format
+	$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format
 
 
 format_fix:
 format_fix:
-	$(DOCKER_COMPOSE) run --rm test_unit npm run format:fix
+	$(DOCKER_COMPOSE) run --rm test_unit npm run --silent format:fix
 
 
 lint:
 lint:
-	$(DOCKER_COMPOSE) run --rm test_unit npm run lint
+	$(DOCKER_COMPOSE) run --rm test_unit npm run --silent lint
 
 
 test: format lint test_unit test_acceptance
 test: format lint test_unit test_acceptance
 
 

+ 1 - 1
services/spelling/app.js

@@ -44,7 +44,7 @@ const port = settings && settings.port ? settings.port : 3005
 
 
 if (!module.parent) {
 if (!module.parent) {
   // application entry point, called directly
   // application entry point, called directly
-  app.listen(port, host, function(error) {
+  app.listen(port, host, function (error) {
     if (error != null) {
     if (error != null) {
       throw error
       throw error
     }
     }

+ 3 - 3
services/spelling/app/js/ASpell.js

@@ -34,14 +34,14 @@ try {
 }
 }
 
 
 // write the cache every 30 minutes
 // write the cache every 30 minutes
-const cacheDump = setInterval(function() {
+const cacheDump = setInterval(function () {
   const dump = JSON.stringify(cache.dump())
   const dump = JSON.stringify(cache.dump())
-  return fs.writeFile(cacheFsPathTmp, dump, function(err) {
+  return fs.writeFile(cacheFsPathTmp, dump, function (err) {
     if (err != null) {
     if (err != null) {
       logger.log(OError.tag(err, 'error writing cache file'))
       logger.log(OError.tag(err, 'error writing cache file'))
       fs.unlink(cacheFsPathTmp, () => {})
       fs.unlink(cacheFsPathTmp, () => {})
     } else {
     } else {
-      fs.rename(cacheFsPathTmp, cacheFsPath, err => {
+      fs.rename(cacheFsPathTmp, cacheFsPath, (err) => {
         if (err) {
         if (err) {
           logger.error(OError.tag(err, 'error renaming cache file'))
           logger.error(OError.tag(err, 'error renaming cache file'))
         } else {
         } else {

+ 4 - 4
services/spelling/app/js/ASpellWorker.js

@@ -65,7 +65,7 @@ class ASpellWorker {
         this.callback = null
         this.callback = null
       }
       }
     })
     })
-    this.pipe.on('error', err => {
+    this.pipe.on('error', (err) => {
       const previousWorkerState = this.state
       const previousWorkerState = this.state
       if (this.state !== 'killed') {
       if (this.state !== 'killed') {
         this.state = 'error'
         this.state = 'error'
@@ -87,7 +87,7 @@ class ASpellWorker {
         logger.warn(err)
         logger.warn(err)
       }
       }
     })
     })
-    this.pipe.stdin.on('error', err => {
+    this.pipe.stdin.on('error', (err) => {
       const previousWorkerState = this.state
       const previousWorkerState = this.state
       if (this.state !== 'killed') {
       if (this.state !== 'killed') {
         this.state = 'error'
         this.state = 'error'
@@ -114,7 +114,7 @@ class ASpellWorker {
     this.pipe.stdout.setEncoding('utf8') // ensure utf8 output is handled correctly
     this.pipe.stdout.setEncoding('utf8') // ensure utf8 output is handled correctly
     var output = ''
     var output = ''
     const endMarkerRegex = new RegExp('^[a-z][a-z]', 'gm')
     const endMarkerRegex = new RegExp('^[a-z][a-z]', 'gm')
-    this.pipe.stdout.on('data', data => {
+    this.pipe.stdout.on('data', (data) => {
       // We receive the language code from Aspell as the end of data marker in
       // We receive the language code from Aspell as the end of data marker in
       // the data.  The input is a utf8 encoded string.
       // the data.  The input is a utf8 encoded string.
       const oldPos = output.length
       const oldPos = output.length
@@ -144,7 +144,7 @@ class ASpellWorker {
     })
     })
 
 
     var error = ''
     var error = ''
-    this.pipe.stderr.on('data', chunk => {
+    this.pipe.stderr.on('data', (chunk) => {
       return (error = error + chunk)
       return (error = error + chunk)
     })
     })
 
 

+ 5 - 3
services/spelling/app/js/ASpellWorkerPool.js

@@ -56,7 +56,9 @@ class ASpellWorkerPool {
   }
   }
 
 
   cleanup() {
   cleanup() {
-    const active = this.PROCESS_POOL.filter(worker => worker.state !== 'killed')
+    const active = this.PROCESS_POOL.filter(
+      (worker) => worker.state !== 'killed'
+    )
     this.PROCESS_POOL = active
     this.PROCESS_POOL = active
     return metrics.gauge('aspellWorkerPool-size', this.PROCESS_POOL.length)
     return metrics.gauge('aspellWorkerPool-size', this.PROCESS_POOL.length)
   }
   }
@@ -66,7 +68,7 @@ class ASpellWorkerPool {
     let worker
     let worker
     const availableWorker = _.find(
     const availableWorker = _.find(
       this.PROCESS_POOL,
       this.PROCESS_POOL,
-      cached => cached.language === language && cached.isReady()
+      (cached) => cached.language === language && cached.isReady()
     )
     )
     if (availableWorker == null) {
     if (availableWorker == null) {
       worker = this.create(language)
       worker = this.create(language)
@@ -103,7 +105,7 @@ class ASpellWorkerPool {
         return worker.shutdown(`reached limit of ${this.MAX_REQUESTS} requests`)
         return worker.shutdown(`reached limit of ${this.MAX_REQUESTS} requests`)
       } else {
       } else {
         // queue a shutdown if worker is idle
         // queue a shutdown if worker is idle
-        return (worker.idleTimer = setTimeout(function() {
+        return (worker.idleTimer = setTimeout(function () {
           worker.shutdown('idle worker')
           worker.shutdown('idle worker')
           return (worker.idleTimer = null)
           return (worker.idleTimer = null)
         }, this.MAX_IDLE_TIME))
         }, this.MAX_IDLE_TIME))

+ 1 - 1
services/spelling/app/js/HealthCheckController.js

@@ -13,7 +13,7 @@ module.exports = {
       },
       },
       timeout: 1000 * 20
       timeout: 1000 * 20
     }
     }
-    return request.post(opts, function(err, response, body) {
+    return request.post(opts, function (err, response, body) {
       if (err != null) {
       if (err != null) {
         return res.sendStatus(500)
         return res.sendStatus(500)
       }
       }

+ 2 - 2
services/spelling/app/js/LearnedWordsManager.js

@@ -54,7 +54,7 @@ const LearnedWordsManager = {
     metrics.inc('mongoCache', 0.1, { status: 'miss' })
     metrics.inc('mongoCache', 0.1, { status: 'miss' })
     logger.info({ userToken }, 'mongoCache miss')
     logger.info({ userToken }, 'mongoCache miss')
 
 
-    db.spellingPreferences.findOne({ token: userToken }, function(
+    db.spellingPreferences.findOne({ token: userToken }, function (
       error,
       error,
       preferences
       preferences
     ) {
     ) {
@@ -94,7 +94,7 @@ const promises = {
 LearnedWordsManager.promises = promises
 LearnedWordsManager.promises = promises
 
 
 module.exports = LearnedWordsManager
 module.exports = LearnedWordsManager
-;['learnWord', 'unlearnWord', 'getLearnedWords'].map(method =>
+;['learnWord', 'unlearnWord', 'getLearnedWords'].map((method) =>
   metrics.timeAsyncMethod(
   metrics.timeAsyncMethod(
     LearnedWordsManager,
     LearnedWordsManager,
     method,
     method,

+ 5 - 5
services/spelling/app/js/SpellingAPIController.js

@@ -21,7 +21,7 @@ module.exports = {
     metrics.inc('spelling-check', 0.1)
     metrics.inc('spelling-check', 0.1)
     const { token, wordCount } = extractCheckRequestData(req)
     const { token, wordCount } = extractCheckRequestData(req)
     logger.info({ token, wordCount }, 'running check')
     logger.info({ token, wordCount }, 'running check')
-    SpellingAPIManager.runRequest(token, req.body, function(error, result) {
+    SpellingAPIManager.runRequest(token, req.body, function (error, result) {
       if (error != null) {
       if (error != null) {
         logger.error(
         logger.error(
           OError.tag(error, 'error processing spelling request', {
           OError.tag(error, 'error processing spelling request', {
@@ -39,7 +39,7 @@ module.exports = {
     metrics.inc('spelling-learn', 0.1)
     metrics.inc('spelling-learn', 0.1)
     const { token, word } = extractLearnRequestData(req)
     const { token, word } = extractLearnRequestData(req)
     logger.info({ token, word }, 'learning word')
     logger.info({ token, word }, 'learning word')
-    SpellingAPIManager.learnWord(token, req.body, function(error) {
+    SpellingAPIManager.learnWord(token, req.body, function (error) {
       if (error != null) {
       if (error != null) {
         return next(OError.tag(error))
         return next(OError.tag(error))
       }
       }
@@ -51,7 +51,7 @@ module.exports = {
     metrics.inc('spelling-unlearn', 0.1)
     metrics.inc('spelling-unlearn', 0.1)
     const { token, word } = extractLearnRequestData(req)
     const { token, word } = extractLearnRequestData(req)
     logger.info({ token, word }, 'unlearning word')
     logger.info({ token, word }, 'unlearning word')
-    SpellingAPIManager.unlearnWord(token, req.body, function(error) {
+    SpellingAPIManager.unlearnWord(token, req.body, function (error) {
       if (error != null) {
       if (error != null) {
         return next(OError.tag(error))
         return next(OError.tag(error))
       }
       }
@@ -62,7 +62,7 @@ module.exports = {
   deleteDic(req, res, next) {
   deleteDic(req, res, next) {
     const { token, word } = extractLearnRequestData(req)
     const { token, word } = extractLearnRequestData(req)
     logger.log({ token, word }, 'deleting user dictionary')
     logger.log({ token, word }, 'deleting user dictionary')
-    SpellingAPIManager.deleteDic(token, function(error) {
+    SpellingAPIManager.deleteDic(token, function (error) {
       if (error != null) {
       if (error != null) {
         return next(OError.tag(error))
         return next(OError.tag(error))
       }
       }
@@ -78,7 +78,7 @@ module.exports = {
       },
       },
       'getting user dictionary'
       'getting user dictionary'
     )
     )
-    SpellingAPIManager.getDic(token, function(error, words) {
+    SpellingAPIManager.getDic(token, function (error, words) {
       if (error != null) {
       if (error != null) {
         return next(OError.tag(error))
         return next(OError.tag(error))
       }
       }

+ 1 - 1
services/spelling/app/js/SpellingAPIManager.js

@@ -70,7 +70,7 @@ const promises = {
       const learnedWords = await LearnedWordsManager.promises.getLearnedWords(
       const learnedWords = await LearnedWordsManager.promises.getLearnedWords(
         token
         token
       )
       )
-      const notLearntMisspellings = misspellings.filter(m => {
+      const notLearntMisspellings = misspellings.filter((m) => {
         const word = wordSlice[m.index]
         const word = wordSlice[m.index]
         return (
         return (
           learnedWords.indexOf(word) === -1 &&
           learnedWords.indexOf(word) === -1 &&

+ 1 - 3
services/spelling/buildscript.txt

@@ -1,11 +1,9 @@
 spelling
 spelling
---acceptance-creds=None
 --data-dirs=cache
 --data-dirs=cache
 --dependencies=mongo
 --dependencies=mongo
 --docker-repos=gcr.io/overleaf-ops
 --docker-repos=gcr.io/overleaf-ops
 --env-add=
 --env-add=
 --env-pass-through=
 --env-pass-through=
---language=es
 --node-version=10.21.0
 --node-version=10.21.0
 --public-repo=False
 --public-repo=False
---script-version=2.2.0
+--script-version=3.3.2

+ 3 - 1
services/spelling/docker-compose.ci.yml

@@ -11,6 +11,7 @@ services:
     command: npm run test:unit:_run
     command: npm run test:unit:_run
     environment:
     environment:
       NODE_ENV: test
       NODE_ENV: test
+      NODE_OPTIONS: "--unhandled-rejections=strict"
 
 
 
 
   test_acceptance:
   test_acceptance:
@@ -23,6 +24,7 @@ services:
       POSTGRES_HOST: postgres
       POSTGRES_HOST: postgres
       MOCHA_GREP: ${MOCHA_GREP}
       MOCHA_GREP: ${MOCHA_GREP}
       NODE_ENV: test
       NODE_ENV: test
+      NODE_OPTIONS: "--unhandled-rejections=strict"
     depends_on:
     depends_on:
       mongo:
       mongo:
         condition: service_healthy
         condition: service_healthy
@@ -38,4 +40,4 @@ services:
     command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
     command: tar -czf /tmp/build/build.tar.gz --exclude=build.tar.gz --exclude-vcs .
     user: root
     user: root
   mongo:
   mongo:
-    image: mongo:3.6
+    image: mongo:4.0

+ 5 - 3
services/spelling/docker-compose.yml

@@ -15,7 +15,8 @@ services:
     environment:
     environment:
       MOCHA_GREP: ${MOCHA_GREP}
       MOCHA_GREP: ${MOCHA_GREP}
       NODE_ENV: test
       NODE_ENV: test
-    command: npm run test:unit
+      NODE_OPTIONS: "--unhandled-rejections=strict"
+    command: npm run --silent test:unit
     user: node
     user: node
 
 
   test_acceptance:
   test_acceptance:
@@ -33,12 +34,13 @@ services:
       MOCHA_GREP: ${MOCHA_GREP}
       MOCHA_GREP: ${MOCHA_GREP}
       LOG_LEVEL: ERROR
       LOG_LEVEL: ERROR
       NODE_ENV: test
       NODE_ENV: test
+      NODE_OPTIONS: "--unhandled-rejections=strict"
     user: node
     user: node
     depends_on:
     depends_on:
       mongo:
       mongo:
         condition: service_healthy
         condition: service_healthy
-    command: npm run test:acceptance
+    command: npm run --silent test:acceptance
 
 
   mongo:
   mongo:
-    image: mongo:3.6
+    image: mongo:4.0
 
 

+ 0 - 1
services/spelling/nodemon.json

@@ -8,7 +8,6 @@
   "execMap": {
   "execMap": {
     "js": "npm run start"
     "js": "npm run start"
   },
   },
-
   "watch": [
   "watch": [
     "app/js/",
     "app/js/",
     "app.js",
     "app.js",

+ 249 - 109
services/spelling/package-lock.json

@@ -181,6 +181,24 @@
         "google-auth-library": "^5.5.0",
         "google-auth-library": "^5.5.0",
         "retry-request": "^4.0.0",
         "retry-request": "^4.0.0",
         "teeny-request": "^6.0.0"
         "teeny-request": "^6.0.0"
+      },
+      "dependencies": {
+        "google-auth-library": {
+          "version": "5.10.1",
+          "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
+          "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+          "requires": {
+            "arrify": "^2.0.0",
+            "base64-js": "^1.3.0",
+            "ecdsa-sig-formatter": "^1.0.11",
+            "fast-text-encoding": "^1.0.0",
+            "gaxios": "^2.1.0",
+            "gcp-metadata": "^3.4.0",
+            "gtoken": "^4.1.0",
+            "jws": "^4.0.0",
+            "lru-cache": "^5.0.0"
+          }
+        }
       }
       }
     },
     },
     "@google-cloud/debug-agent": {
     "@google-cloud/debug-agent": {
@@ -421,6 +439,22 @@
         "type-fest": "^0.12.0"
         "type-fest": "^0.12.0"
       },
       },
       "dependencies": {
       "dependencies": {
+        "google-auth-library": {
+          "version": "5.10.1",
+          "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
+          "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+          "requires": {
+            "arrify": "^2.0.0",
+            "base64-js": "^1.3.0",
+            "ecdsa-sig-formatter": "^1.0.11",
+            "fast-text-encoding": "^1.0.0",
+            "gaxios": "^2.1.0",
+            "gcp-metadata": "^3.4.0",
+            "gtoken": "^4.1.0",
+            "jws": "^4.0.0",
+            "lru-cache": "^5.0.0"
+          }
+        },
         "type-fest": {
         "type-fest": {
           "version": "0.12.0",
           "version": "0.12.0",
           "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.12.0.tgz",
           "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.12.0.tgz",
@@ -429,12 +463,12 @@
       }
       }
     },
     },
     "@google-cloud/logging-bunyan": {
     "@google-cloud/logging-bunyan": {
-      "version": "2.0.3",
-      "resolved": "https://registry.npmjs.org/@google-cloud/logging-bunyan/-/logging-bunyan-2.0.3.tgz",
-      "integrity": "sha512-8n9MwsCRd4v8WZg17+d3m7qInud7lYTm5rpwXHY0/lzWEJYjeiztT09BiCYh56EEhHr+ynymJnzUDZKazkywlg==",
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/@google-cloud/logging-bunyan/-/logging-bunyan-3.0.0.tgz",
+      "integrity": "sha512-ZLVXEejNQ27ktGcA3S/sd7GPefp7kywbn+/KoBajdb1Syqcmtc98jhXpYQBXVtNP2065iyu77s4SBaiYFbTC5A==",
       "requires": {
       "requires": {
         "@google-cloud/logging": "^7.0.0",
         "@google-cloud/logging": "^7.0.0",
-        "google-auth-library": "^5.0.0"
+        "google-auth-library": "^6.0.0"
       }
       }
     },
     },
     "@google-cloud/paginator": {
     "@google-cloud/paginator": {
@@ -890,9 +924,9 @@
       }
       }
     },
     },
     "@grpc/proto-loader": {
     "@grpc/proto-loader": {
-      "version": "0.5.4",
-      "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.4.tgz",
-      "integrity": "sha512-HTM4QpI9B2XFkPz7pjwMyMgZchJ93TVkL3kWPW8GDMDKYxsMnmf4w2TNMJK7+KNiYHS5cJrCEAFlF+AwtXWVPA==",
+      "version": "0.5.5",
+      "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.5.5.tgz",
+      "integrity": "sha512-WwN9jVNdHRQoOBo9FDH7qU+mgfjPc8GygPYms3M+y3fbQLfnCe/Kv/E01t7JRgnrsOHH8euvSbed3mIalXhwqQ==",
       "requires": {
       "requires": {
         "lodash.camelcase": "^4.3.0",
         "lodash.camelcase": "^4.3.0",
         "protobufjs": "^6.8.6"
         "protobufjs": "^6.8.6"
@@ -1203,9 +1237,9 @@
       "dev": true
       "dev": true
     },
     },
     "agent-base": {
     "agent-base": {
-      "version": "6.0.0",
-      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
-      "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==",
+      "version": "6.0.1",
+      "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.1.tgz",
+      "integrity": "sha512-01q25QQDwLSsyfhrKbn8yuur+JNw0H+0Y4JiGIKd3z9aYk/w/2kxD/Upc+t2ZBBSUNff50VjPsSW2YxM8QYKVg==",
       "requires": {
       "requires": {
         "debug": "4"
         "debug": "4"
       },
       },
@@ -1340,7 +1374,8 @@
     "assertion-error": {
     "assertion-error": {
       "version": "1.1.0",
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
       "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz",
-      "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw=="
+      "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
+      "dev": true
     },
     },
     "astral-regex": {
     "astral-regex": {
       "version": "1.0.0",
       "version": "1.0.0",
@@ -1506,6 +1541,7 @@
       "version": "1.8.12",
       "version": "1.8.12",
       "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz",
       "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz",
       "integrity": "sha512-dmDUbGHeGcvCDLRFOscZkwx1ZO/aFz3bJOCi5nCgzdhFGPxwK+y5AcDBnqagNGlJZ7lje/l6JUEz9mQcutttdg==",
       "integrity": "sha512-dmDUbGHeGcvCDLRFOscZkwx1ZO/aFz3bJOCi5nCgzdhFGPxwK+y5AcDBnqagNGlJZ7lje/l6JUEz9mQcutttdg==",
+      "dev": true,
       "requires": {
       "requires": {
         "dtrace-provider": "~0.8",
         "dtrace-provider": "~0.8",
         "moment": "^2.10.6",
         "moment": "^2.10.6",
@@ -1560,6 +1596,7 @@
       "version": "4.2.0",
       "version": "4.2.0",
       "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
       "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz",
       "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
       "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
+      "dev": true,
       "requires": {
       "requires": {
         "assertion-error": "^1.1.0",
         "assertion-error": "^1.1.0",
         "check-error": "^1.0.2",
         "check-error": "^1.0.2",
@@ -1585,10 +1622,16 @@
       "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
       "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
       "dev": true
       "dev": true
     },
     },
+    "charenc": {
+      "version": "0.0.2",
+      "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
+      "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
+    },
     "check-error": {
     "check-error": {
       "version": "1.0.2",
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
       "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
-      "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
+      "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
+      "dev": true
     },
     },
     "chokidar": {
     "chokidar": {
       "version": "3.3.0",
       "version": "3.3.0",
@@ -1789,10 +1832,15 @@
         "which": "^1.2.9"
         "which": "^1.2.9"
       }
       }
     },
     },
+    "crypt": {
+      "version": "0.0.2",
+      "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
+      "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
+    },
     "d64": {
     "d64": {
       "version": "1.0.0",
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/d64/-/d64-1.0.0.tgz",
       "resolved": "https://registry.npmjs.org/d64/-/d64-1.0.0.tgz",
-      "integrity": "sha512-5eNy3WZziVYnrogqgXhcdEmqcDB2IHurTqLcrgssJsfkMVCUoUaZpK6cJjxxvLV2dUm5SuJMNcYfVGoin9UIRw=="
+      "integrity": "sha1-QAKofoUMv8n52XBrYPymE6MzbpA="
     },
     },
     "dashdash": {
     "dashdash": {
       "version": "1.14.1",
       "version": "1.14.1",
@@ -1819,6 +1867,7 @@
       "version": "3.0.1",
       "version": "3.0.1",
       "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
       "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
       "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
       "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
+      "dev": true,
       "requires": {
       "requires": {
         "type-detect": "^4.0.0"
         "type-detect": "^4.0.0"
       }
       }
@@ -3089,7 +3138,8 @@
     "get-func-name": {
     "get-func-name": {
       "version": "2.0.0",
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
       "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz",
-      "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE="
+      "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
+      "dev": true
     },
     },
     "get-stdin": {
     "get-stdin": {
       "version": "6.0.0",
       "version": "6.0.0",
@@ -3141,19 +3191,97 @@
       "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
       "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="
     },
     },
     "google-auth-library": {
     "google-auth-library": {
-      "version": "5.10.1",
-      "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
-      "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+      "version": "6.0.6",
+      "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.6.tgz",
+      "integrity": "sha512-fWYdRdg55HSJoRq9k568jJA1lrhg9i2xgfhVIMJbskUmbDpJGHsbv9l41DGhCDXM21F9Kn4kUwdysgxSYBYJUw==",
       "requires": {
       "requires": {
         "arrify": "^2.0.0",
         "arrify": "^2.0.0",
         "base64-js": "^1.3.0",
         "base64-js": "^1.3.0",
         "ecdsa-sig-formatter": "^1.0.11",
         "ecdsa-sig-formatter": "^1.0.11",
         "fast-text-encoding": "^1.0.0",
         "fast-text-encoding": "^1.0.0",
-        "gaxios": "^2.1.0",
-        "gcp-metadata": "^3.4.0",
-        "gtoken": "^4.1.0",
+        "gaxios": "^3.0.0",
+        "gcp-metadata": "^4.1.0",
+        "gtoken": "^5.0.0",
         "jws": "^4.0.0",
         "jws": "^4.0.0",
-        "lru-cache": "^5.0.0"
+        "lru-cache": "^6.0.0"
+      },
+      "dependencies": {
+        "bignumber.js": {
+          "version": "9.0.0",
+          "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
+          "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
+        },
+        "gaxios": {
+          "version": "3.1.0",
+          "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-3.1.0.tgz",
+          "integrity": "sha512-DDTn3KXVJJigtz+g0J3vhcfbDbKtAroSTxauWsdnP57sM5KZ3d2c/3D9RKFJ86s43hfw6WULg6TXYw/AYiBlpA==",
+          "requires": {
+            "abort-controller": "^3.0.0",
+            "extend": "^3.0.2",
+            "https-proxy-agent": "^5.0.0",
+            "is-stream": "^2.0.0",
+            "node-fetch": "^2.3.0"
+          }
+        },
+        "gcp-metadata": {
+          "version": "4.1.4",
+          "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-4.1.4.tgz",
+          "integrity": "sha512-5J/GIH0yWt/56R3dNaNWPGQ/zXsZOddYECfJaqxFWgrZ9HC2Kvc5vl9upOgUUHKzURjAVf2N+f6tEJiojqXUuA==",
+          "requires": {
+            "gaxios": "^3.0.0",
+            "json-bigint": "^1.0.0"
+          }
+        },
+        "google-p12-pem": {
+          "version": "3.0.2",
+          "resolved": "https://registry.npmjs.org/google-p12-pem/-/google-p12-pem-3.0.2.tgz",
+          "integrity": "sha512-tbjzndQvSIHGBLzHnhDs3cL4RBjLbLXc2pYvGH+imGVu5b4RMAttUTdnmW2UH0t11QeBTXZ7wlXPS7hrypO/tg==",
+          "requires": {
+            "node-forge": "^0.9.0"
+          }
+        },
+        "gtoken": {
+          "version": "5.0.3",
+          "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.3.tgz",
+          "integrity": "sha512-Nyd1wZCMRc2dj/mAD0LlfQLcAO06uKdpKJXvK85SGrF5+5+Bpfil9u/2aw35ltvEHjvl0h5FMKN5knEU+9JrOg==",
+          "requires": {
+            "gaxios": "^3.0.0",
+            "google-p12-pem": "^3.0.0",
+            "jws": "^4.0.0",
+            "mime": "^2.2.0"
+          }
+        },
+        "is-stream": {
+          "version": "2.0.0",
+          "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
+          "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw=="
+        },
+        "json-bigint": {
+          "version": "1.0.0",
+          "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
+          "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
+          "requires": {
+            "bignumber.js": "^9.0.0"
+          }
+        },
+        "lru-cache": {
+          "version": "6.0.0",
+          "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+          "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+          "requires": {
+            "yallist": "^4.0.0"
+          }
+        },
+        "mime": {
+          "version": "2.4.6",
+          "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz",
+          "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA=="
+        },
+        "yallist": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+          "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
+        }
       }
       }
     },
     },
     "google-gax": {
     "google-gax": {
@@ -3178,6 +3306,22 @@
         "walkdir": "^0.4.0"
         "walkdir": "^0.4.0"
       },
       },
       "dependencies": {
       "dependencies": {
+        "google-auth-library": {
+          "version": "5.10.1",
+          "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-5.10.1.tgz",
+          "integrity": "sha512-rOlaok5vlpV9rSiUu5EpR0vVpc+PhN62oF4RyX/6++DG1VsaulAFEMlDYBLjJDDPI6OcNOCGAKy9UVB/3NIDXg==",
+          "requires": {
+            "arrify": "^2.0.0",
+            "base64-js": "^1.3.0",
+            "ecdsa-sig-formatter": "^1.0.11",
+            "fast-text-encoding": "^1.0.0",
+            "gaxios": "^2.1.0",
+            "gcp-metadata": "^3.4.0",
+            "gtoken": "^4.1.0",
+            "jws": "^4.0.0",
+            "lru-cache": "^5.0.0"
+          }
+        },
         "semver": {
         "semver": {
           "version": "6.3.0",
           "version": "6.3.0",
           "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
           "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@@ -3878,12 +4022,12 @@
     "lodash.at": {
     "lodash.at": {
       "version": "4.6.0",
       "version": "4.6.0",
       "resolved": "https://registry.npmjs.org/lodash.at/-/lodash.at-4.6.0.tgz",
       "resolved": "https://registry.npmjs.org/lodash.at/-/lodash.at-4.6.0.tgz",
-      "integrity": "sha512-GOTh0SEp+Yosnlpjic+8cl2WM9MykorogkGA9xyIFkkObQ3H3kNZqZ+ohuq4K3FrSVo7hMcZBMataJemrxC3BA=="
+      "integrity": "sha1-k83OZk8KGZTqM9181A4jr9EbD/g="
     },
     },
     "lodash.camelcase": {
     "lodash.camelcase": {
       "version": "4.3.0",
       "version": "4.3.0",
       "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
       "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
-      "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
+      "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY="
     },
     },
     "lodash.flattendeep": {
     "lodash.flattendeep": {
       "version": "4.4.0",
       "version": "4.4.0",
@@ -3899,7 +4043,7 @@
     "lodash.has": {
     "lodash.has": {
       "version": "4.5.2",
       "version": "4.5.2",
       "resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz",
       "resolved": "https://registry.npmjs.org/lodash.has/-/lodash.has-4.5.2.tgz",
-      "integrity": "sha512-rnYUdIo6xRCJnQmbVFEwcxF144erlD+M3YcJUVesflU9paQaE8p+fJDcIQrlMYbxoANFL+AB9hZrzSBBk5PL+g=="
+      "integrity": "sha1-0Z9NwQlQWMzL4rDN9O4P5Ko3yGI="
     },
     },
     "lodash.memoize": {
     "lodash.memoize": {
       "version": "4.1.2",
       "version": "4.1.2",
@@ -3939,54 +4083,33 @@
       }
       }
     },
     },
     "logger-sharelatex": {
     "logger-sharelatex": {
-      "version": "2.0.0",
-      "resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.0.0.tgz",
-      "integrity": "sha512-oixnfWOqLRjwHoN/cahzP1rSOge/OQ8/oLoapUV4DHdF7znT6Edv+07Y10NhzypYfO071O3CPZbw6NBJqDaFSQ==",
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/logger-sharelatex/-/logger-sharelatex-2.2.0.tgz",
+      "integrity": "sha512-ko+OmE25XHJJCiz1R9EgwlfM7J/5olpunUfR3WcfuqOQrcUqsdBrDA2sOytngT0ViwjCR0Fh4qZVPwEWfmrvwA==",
       "requires": {
       "requires": {
-        "@google-cloud/logging-bunyan": "^2.0.0",
+        "@google-cloud/logging-bunyan": "^3.0.0",
         "@overleaf/o-error": "^3.0.0",
         "@overleaf/o-error": "^3.0.0",
-        "bunyan": "1.8.12",
-        "raven": "1.1.3",
-        "request": "2.88.0",
-        "yn": "^3.1.1"
+        "bunyan": "^1.8.14",
+        "node-fetch": "^2.6.0",
+        "raven": "^2.6.4",
+        "yn": "^4.0.0"
       },
       },
       "dependencies": {
       "dependencies": {
-        "qs": {
-          "version": "6.5.2",
-          "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
-          "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
-        },
-        "request": {
-          "version": "2.88.0",
-          "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
-          "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
-          "requires": {
-            "aws-sign2": "~0.7.0",
-            "aws4": "^1.8.0",
-            "caseless": "~0.12.0",
-            "combined-stream": "~1.0.6",
-            "extend": "~3.0.2",
-            "forever-agent": "~0.6.1",
-            "form-data": "~2.3.2",
-            "har-validator": "~5.1.0",
-            "http-signature": "~1.2.0",
-            "is-typedarray": "~1.0.0",
-            "isstream": "~0.1.2",
-            "json-stringify-safe": "~5.0.1",
-            "mime-types": "~2.1.19",
-            "oauth-sign": "~0.9.0",
-            "performance-now": "^2.1.0",
-            "qs": "~6.5.2",
-            "safe-buffer": "^5.1.2",
-            "tough-cookie": "~2.4.3",
-            "tunnel-agent": "^0.6.0",
-            "uuid": "^3.3.2"
+        "bunyan": {
+          "version": "1.8.14",
+          "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.14.tgz",
+          "integrity": "sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg==",
+          "requires": {
+            "dtrace-provider": "~0.8",
+            "moment": "^2.19.3",
+            "mv": "~2",
+            "safe-json-stringify": "~1"
           }
           }
         },
         },
-        "uuid": {
-          "version": "3.4.0",
-          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
-          "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
+        "yn": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/yn/-/yn-4.0.0.tgz",
+          "integrity": "sha512-huWiiCS4TxKc4SfgmTwW1K7JmXPPAmuXWYy4j9qjQo4+27Kni8mGhAAi1cloRWmBe2EqcLgt3IGqQoRL/MtPgg=="
         }
         }
       }
       }
     },
     },
@@ -4046,11 +4169,6 @@
         "yallist": "^3.0.2"
         "yallist": "^3.0.2"
       }
       }
     },
     },
-    "lsmod": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/lsmod/-/lsmod-1.0.0.tgz",
-      "integrity": "sha512-Y+6V75r+mGWzWEPr9h6PFmStielICu5JBHLUg18jCsD2VFmEfgHbq/EgnY4inElsUD9eKL9id1qp34w46rSIKQ=="
-    },
     "lynx": {
     "lynx": {
       "version": "0.1.1",
       "version": "0.1.1",
       "resolved": "https://registry.npmjs.org/lynx/-/lynx-0.1.1.tgz",
       "resolved": "https://registry.npmjs.org/lynx/-/lynx-0.1.1.tgz",
@@ -4100,6 +4218,23 @@
       "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz",
       "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.1.0.tgz",
       "integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g=="
       "integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g=="
     },
     },
+    "md5": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
+      "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
+      "requires": {
+        "charenc": "0.0.2",
+        "crypt": "0.0.2",
+        "is-buffer": "~1.1.6"
+      },
+      "dependencies": {
+        "is-buffer": {
+          "version": "1.1.6",
+          "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+          "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
+        }
+      }
+    },
     "media-typer": {
     "media-typer": {
       "version": "0.3.0",
       "version": "0.3.0",
       "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
       "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@@ -4958,7 +5093,8 @@
     "pathval": {
     "pathval": {
       "version": "1.1.0",
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
       "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz",
-      "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA="
+      "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
+      "dev": true
     },
     },
     "performance-now": {
     "performance-now": {
       "version": "2.1.0",
       "version": "2.1.0",
@@ -4992,9 +5128,9 @@
       "dev": true
       "dev": true
     },
     },
     "prettier": {
     "prettier": {
-      "version": "1.18.2",
-      "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
-      "integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
+      "version": "2.0.5",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
+      "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
       "dev": true
       "dev": true
     },
     },
     "prettier-eslint": {
     "prettier-eslint": {
@@ -5125,6 +5261,12 @@
           "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
           "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
           "dev": true
           "dev": true
         },
         },
+        "prettier": {
+          "version": "1.19.1",
+          "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
+          "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
+          "dev": true
+        },
         "strip-ansi": {
         "strip-ansi": {
           "version": "4.0.0",
           "version": "4.0.0",
           "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
           "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
@@ -5486,26 +5628,31 @@
       "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
       "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
     },
     },
     "raven": {
     "raven": {
-      "version": "1.1.3",
-      "resolved": "https://registry.npmjs.org/raven/-/raven-1.1.3.tgz",
-      "integrity": "sha512-RYov4wAaflZasWiCrZuizd3jNXxCOkW1WrXgWsGVb8kRpdHNZ+vPY27R6RhVtqzWp+DG9a5l6iP0QUPK4EgzaQ==",
+      "version": "2.6.4",
+      "resolved": "https://registry.npmjs.org/raven/-/raven-2.6.4.tgz",
+      "integrity": "sha512-6PQdfC4+DQSFncowthLf+B6Hr0JpPsFBgTVYTAOq7tCmx/kR4SXbeawtPch20+3QfUcQDoJBLjWW1ybvZ4kXTw==",
       "requires": {
       "requires": {
         "cookie": "0.3.1",
         "cookie": "0.3.1",
-        "json-stringify-safe": "5.0.1",
-        "lsmod": "1.0.0",
-        "stack-trace": "0.0.9",
-        "uuid": "3.0.0"
+        "md5": "^2.2.1",
+        "stack-trace": "0.0.10",
+        "timed-out": "4.0.1",
+        "uuid": "3.3.2"
       },
       },
       "dependencies": {
       "dependencies": {
         "cookie": {
         "cookie": {
           "version": "0.3.1",
           "version": "0.3.1",
           "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
           "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
-          "integrity": "sha512-+IJOX0OqlHCszo2mBUq+SrEbCj6w7Kpffqx60zYbPTFaO4+yYgRjHwcZNpWvaTylDHaV7PPmBHzSecZiMhtPgw=="
+          "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
+        },
+        "stack-trace": {
+          "version": "0.0.10",
+          "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
+          "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
         },
         },
         "uuid": {
         "uuid": {
-          "version": "3.0.0",
-          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz",
-          "integrity": "sha512-rqE1LoOVLv3QrZMjb4NkF5UWlkurCfPyItVnFPNKDDGkHw4dQUdE4zMcLqx28+0Kcf3+bnUk4PisaiRJT4aiaQ=="
+          "version": "3.3.2",
+          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
+          "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
         }
         }
       }
       }
     },
     },
@@ -5682,7 +5829,8 @@
     "require-like": {
     "require-like": {
       "version": "0.1.2",
       "version": "0.1.2",
       "resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz",
       "resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz",
-      "integrity": "sha1-rW8wwTvs15cBDEaK+ndcDAprR/o="
+      "integrity": "sha1-rW8wwTvs15cBDEaK+ndcDAprR/o=",
+      "dev": true
     },
     },
     "require-main-filename": {
     "require-main-filename": {
       "version": "2.0.0",
       "version": "2.0.0",
@@ -5802,6 +5950,7 @@
       "version": "2.0.4",
       "version": "2.0.4",
       "resolved": "https://registry.npmjs.org/sandboxed-module/-/sandboxed-module-2.0.4.tgz",
       "resolved": "https://registry.npmjs.org/sandboxed-module/-/sandboxed-module-2.0.4.tgz",
       "integrity": "sha512-AwEPOdO8mg/wJjr876yCHP2DHqVN0MaggEXhp6IIf3bcI5cYoQl9QrrCHSrvToHjvdEiS5x4TVZRgjD2bEmNTA==",
       "integrity": "sha512-AwEPOdO8mg/wJjr876yCHP2DHqVN0MaggEXhp6IIf3bcI5cYoQl9QrrCHSrvToHjvdEiS5x4TVZRgjD2bEmNTA==",
+      "dev": true,
       "requires": {
       "requires": {
         "require-like": "0.1.2",
         "require-like": "0.1.2",
         "stack-trace": "0.0.9"
         "stack-trace": "0.0.9"
@@ -6060,7 +6209,8 @@
     "stack-trace": {
     "stack-trace": {
       "version": "0.0.9",
       "version": "0.0.9",
       "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
       "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
-      "integrity": "sha512-vjUc6sfgtgY0dxCdnc40mK6Oftjo9+2K8H/NG81TMhgL392FtiPA9tn9RLyTxXmTLPJPjF3VyzFp6bsWFLisMQ=="
+      "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=",
+      "dev": true
     },
     },
     "statsd-parser": {
     "statsd-parser": {
       "version": "0.0.4",
       "version": "0.0.4",
@@ -6204,7 +6354,7 @@
     "stubs": {
     "stubs": {
       "version": "3.0.0",
       "version": "3.0.0",
       "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz",
       "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz",
-      "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw=="
+      "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls="
     },
     },
     "supports-color": {
     "supports-color": {
       "version": "5.5.0",
       "version": "5.5.0",
@@ -6413,6 +6563,11 @@
       "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
       "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz",
       "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
       "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA=="
     },
     },
+    "timed-out": {
+      "version": "4.0.1",
+      "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
+      "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8="
+    },
     "tmp": {
     "tmp": {
       "version": "0.0.33",
       "version": "0.0.33",
       "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
       "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@@ -6435,7 +6590,7 @@
     "to-no-case": {
     "to-no-case": {
       "version": "1.0.2",
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/to-no-case/-/to-no-case-1.0.2.tgz",
       "resolved": "https://registry.npmjs.org/to-no-case/-/to-no-case-1.0.2.tgz",
-      "integrity": "sha512-Z3g735FxuZY8rodxV4gH7LxClE4H0hTIyHNIHdk+vpQxjLm0cwnKXq/OFVZ76SOQmto7txVcwSCwkU5kqp+FKg=="
+      "integrity": "sha1-xyKQcWTvaxeBMsjmmTAhLRtKoWo="
     },
     },
     "to-regex-range": {
     "to-regex-range": {
       "version": "5.0.1",
       "version": "5.0.1",
@@ -6449,7 +6604,7 @@
     "to-snake-case": {
     "to-snake-case": {
       "version": "1.0.0",
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/to-snake-case/-/to-snake-case-1.0.0.tgz",
       "resolved": "https://registry.npmjs.org/to-snake-case/-/to-snake-case-1.0.0.tgz",
-      "integrity": "sha512-joRpzBAk1Bhi2eGEYBjukEWHOe/IvclOkiJl3DtA91jV6NwQ3MwXA4FHYeqk8BNp/D8bmi9tcNbRu/SozP0jbQ==",
+      "integrity": "sha1-znRpE4l5RgGah+Yu366upMYIq4w=",
       "requires": {
       "requires": {
         "to-space-case": "^1.0.0"
         "to-space-case": "^1.0.0"
       }
       }
@@ -6457,7 +6612,7 @@
     "to-space-case": {
     "to-space-case": {
       "version": "1.0.0",
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/to-space-case/-/to-space-case-1.0.0.tgz",
       "resolved": "https://registry.npmjs.org/to-space-case/-/to-space-case-1.0.0.tgz",
-      "integrity": "sha512-rLdvwXZ39VOn1IxGL3V6ZstoTbwLRckQmn/U8ZDLuWwIXNpuZDhQ3AiRUlhTbOXFVE9C+dR51wM0CBDhk31VcA==",
+      "integrity": "sha1-sFLar7Gysp3HcM6gFj5ewOvJ/Bc=",
       "requires": {
       "requires": {
         "to-no-case": "^1.0.0"
         "to-no-case": "^1.0.0"
       }
       }
@@ -6467,22 +6622,6 @@
       "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
       "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
       "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
       "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
     },
     },
-    "tough-cookie": {
-      "version": "2.4.3",
-      "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
-      "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
-      "requires": {
-        "psl": "^1.1.24",
-        "punycode": "^1.4.1"
-      },
-      "dependencies": {
-        "punycode": {
-          "version": "1.4.1",
-          "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
-          "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ=="
-        }
-      }
-    },
     "tslib": {
     "tslib": {
       "version": "1.10.0",
       "version": "1.10.0",
       "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
       "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
@@ -6514,7 +6653,8 @@
     "type-detect": {
     "type-detect": {
       "version": "4.0.8",
       "version": "4.0.8",
       "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
       "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
-      "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
+      "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
+      "dev": true
     },
     },
     "type-fest": {
     "type-fest": {
       "version": "0.8.1",
       "version": "0.8.1",

+ 5 - 4
services/spelling/package.json

@@ -18,7 +18,7 @@
     "compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests && npm run compile:smoke_tests",
     "compile:all": "npm run compile:app && npm run compile:unit_tests && npm run compile:acceptance_tests && npm run compile:smoke_tests",
     "nodemon": "nodemon --config nodemon.json",
     "nodemon": "nodemon --config nodemon.json",
     "compile:smoke_tests": "[ ! -e test/smoke/coffee ] &&  echo 'No smoke tests to compile' || coffee -o test/smoke/js -c test/smoke/coffee",
     "compile:smoke_tests": "[ ! -e test/smoke/coffee ] &&  echo 'No smoke tests to compile' || coffee -o test/smoke/js -c test/smoke/coffee",
-    "lint": "node_modules/.bin/eslint .",
+    "lint": "node_modules/.bin/eslint --max-warnings 0 .",
     "format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
     "format": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --list-different",
     "format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
     "format:fix": "node_modules/.bin/prettier-eslint $PWD'/**/*.js' --write"
   },
   },
@@ -29,7 +29,7 @@
     "body-parser": "^1.19.0",
     "body-parser": "^1.19.0",
     "coffee-script": "^1.12.7",
     "coffee-script": "^1.12.7",
     "express": "^4.17.1",
     "express": "^4.17.1",
-    "logger-sharelatex": "^2.0.0",
+    "logger-sharelatex": "^2.2.0",
     "lru-cache": "^5.1.1",
     "lru-cache": "^5.1.1",
     "metrics-sharelatex": "^2.6.2",
     "metrics-sharelatex": "^2.6.2",
     "mongojs": "3.1.0",
     "mongojs": "3.1.0",
@@ -40,7 +40,7 @@
   },
   },
   "devDependencies": {
   "devDependencies": {
     "bunyan": "^1.8.12",
     "bunyan": "^1.8.12",
-    "chai": "",
+    "chai": "4.2.0",
     "eslint": "^6.8.0",
     "eslint": "^6.8.0",
     "eslint-config-prettier": "^6.10.0",
     "eslint-config-prettier": "^6.10.0",
     "eslint-config-standard": "^14.1.0",
     "eslint-config-standard": "^14.1.0",
@@ -53,8 +53,9 @@
     "eslint-plugin-promise": "^4.2.1",
     "eslint-plugin-promise": "^4.2.1",
     "eslint-plugin-standard": "^4.0.1",
     "eslint-plugin-standard": "^4.0.1",
     "mocha": "^7.1.1",
     "mocha": "^7.1.1",
+    "prettier": "^2.0.0",
     "prettier-eslint-cli": "^5.0.0",
     "prettier-eslint-cli": "^5.0.0",
-    "sandboxed-module": "",
+    "sandboxed-module": "2.0.4",
     "sinon": "^9.0.1"
     "sinon": "^9.0.1"
   }
   }
 }
 }

+ 27 - 27
services/spelling/test/acceptance/js/CheckTest.js

@@ -12,19 +12,19 @@ const checkWord = (words, language) =>
     })
     })
   })
   })
 
 
-describe('checking words', function() {
+describe('checking words', function () {
   let response
   let response
 
 
-  describe('on successful response', function() {
-    beforeEach(async function() {
+  describe('on successful response', function () {
+    beforeEach(async function () {
       response = await checkWord(['anather'])
       response = await checkWord(['anather'])
     })
     })
 
 
-    it('should return status 200', async function() {
+    it('should return status 200', async function () {
       expect(response.statusCode).to.equal(200)
       expect(response.statusCode).to.equal(200)
     })
     })
 
 
-    it('should return the list of misspellings', async function() {
+    it('should return the list of misspellings', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
       expect(body).to.deep.equal({
       expect(body).to.deep.equal({
         misspellings: [{ index: 0, suggestions: ['anther', 'another'] }]
         misspellings: [{ index: 0, suggestions: ['anther', 'another'] }]
@@ -32,23 +32,23 @@ describe('checking words', function() {
     })
     })
   })
   })
 
 
-  describe('when multiple words are submitted', function() {
-    beforeEach(async function() {
+  describe('when multiple words are submitted', function () {
+    beforeEach(async function () {
       response = await checkWord(['anather', 'anather', 'theorie'])
       response = await checkWord(['anather', 'anather', 'theorie'])
     })
     })
 
 
-    it('should return the misspellings for all the words', async function() {
+    it('should return the misspellings for all the words', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
       expect(body.misspellings.length).to.equal(3)
       expect(body.misspellings.length).to.equal(3)
     })
     })
 
 
-    it('should have misspelling suggestions with consecutive indexes', async function() {
+    it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
-      const indexes = body.misspellings.map(mspl => mspl.index)
+      const indexes = body.misspellings.map((mspl) => mspl.index)
       expect(indexes).to.deep.equal([0, 1, 2])
       expect(indexes).to.deep.equal([0, 1, 2])
     })
     })
 
 
-    it('should return identical suggestions for the same entry', async function() {
+    it('should return identical suggestions for the same entry', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
       expect(body.misspellings[0].suggestions).to.deep.equal(
       expect(body.misspellings[0].suggestions).to.deep.equal(
         body.misspellings[1].suggestions
         body.misspellings[1].suggestions
@@ -56,8 +56,8 @@ describe('checking words', function() {
     })
     })
   })
   })
 
 
-  describe('when a very long list of words if submitted', function() {
-    beforeEach(async function() {
+  describe('when a very long list of words if submitted', function () {
+    beforeEach(async function () {
       const words = []
       const words = []
       for (let i = 0; i <= 20000; i++) {
       for (let i = 0; i <= 20000; i++) {
         words.push('anather')
         words.push('anather')
@@ -65,14 +65,14 @@ describe('checking words', function() {
       response = await checkWord(words)
       response = await checkWord(words)
     })
     })
 
 
-    it('should return misspellings for the first 10K results only', async function() {
+    it('should return misspellings for the first 10K results only', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
       expect(body.misspellings.length).to.equal(10000)
       expect(body.misspellings.length).to.equal(10000)
     })
     })
 
 
-    it('should have misspelling suggestions with consecutive indexes', async function() {
+    it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
-      const indexList = body.misspellings.map(mspl => mspl.index)
+      const indexList = body.misspellings.map((mspl) => mspl.index)
       expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
       expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
       for (let i = 0; i < indexList.length - 1; i++) {
       for (let i = 0; i < indexList.length - 1; i++) {
         expect(indexList[i] + 1).to.equal(indexList[i + 1])
         expect(indexList[i] + 1).to.equal(indexList[i + 1])
@@ -80,8 +80,8 @@ describe('checking words', function() {
     })
     })
   })
   })
 
 
-  describe('when a very long list of words with utf8 responses', function() {
-    beforeEach(async function() {
+  describe('when a very long list of words with utf8 responses', function () {
+    beforeEach(async function () {
       const words = []
       const words = []
       for (let i = 0; i <= 20000; i++) {
       for (let i = 0; i <= 20000; i++) {
         words.push('anéther')
         words.push('anéther')
@@ -89,14 +89,14 @@ describe('checking words', function() {
       response = await checkWord(words, 'bg') // use Bulgarian to generate utf8 response
       response = await checkWord(words, 'bg') // use Bulgarian to generate utf8 response
     })
     })
 
 
-    it('should return misspellings for the first 10K results only', async function() {
+    it('should return misspellings for the first 10K results only', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
       expect(body.misspellings.length).to.equal(10000)
       expect(body.misspellings.length).to.equal(10000)
     })
     })
 
 
-    it('should have misspelling suggestions with consecutive indexes', async function() {
+    it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
-      const indexList = body.misspellings.map(mspl => mspl.index)
+      const indexList = body.misspellings.map((mspl) => mspl.index)
       expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
       expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array
       for (let i = 0; i < indexList.length - 1; i++) {
       for (let i = 0; i < indexList.length - 1; i++) {
         expect(indexList[i] + 1).to.equal(indexList[i + 1])
         expect(indexList[i] + 1).to.equal(indexList[i + 1])
@@ -104,23 +104,23 @@ describe('checking words', function() {
     })
     })
   })
   })
 
 
-  describe('when multiple words with utf8 are submitted', function() {
-    beforeEach(async function() {
+  describe('when multiple words with utf8 are submitted', function () {
+    beforeEach(async function () {
       response = await checkWord(['mneá', 'meniésn', 'meônoi', 'mneá'], 'pt_BR')
       response = await checkWord(['mneá', 'meniésn', 'meônoi', 'mneá'], 'pt_BR')
     })
     })
 
 
-    it('should return the misspellings for all the words', async function() {
+    it('should return the misspellings for all the words', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
       expect(body.misspellings.length).to.equal(4)
       expect(body.misspellings.length).to.equal(4)
     })
     })
 
 
-    it('should have misspelling suggestions with consecutive indexes', async function() {
+    it('should have misspelling suggestions with consecutive indexes', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
-      const indexes = body.misspellings.map(mspl => mspl.index)
+      const indexes = body.misspellings.map((mspl) => mspl.index)
       expect(indexes).to.deep.equal([0, 1, 2, 3])
       expect(indexes).to.deep.equal([0, 1, 2, 3])
     })
     })
 
 
-    it('should return identical suggestions for the same entry', async function() {
+    it('should return identical suggestions for the same entry', async function () {
       const body = JSON.parse(response.body)
       const body = JSON.parse(response.body)
       expect(body.misspellings[0].suggestions).to.deep.equal(
       expect(body.misspellings[0].suggestions).to.deep.equal(
         body.misspellings[3].suggestions
         body.misspellings[3].suggestions

+ 2 - 2
services/spelling/test/acceptance/js/HealthCheckTest.js

@@ -1,8 +1,8 @@
 const { expect } = require('chai')
 const { expect } = require('chai')
 const request = require('./helpers/request')
 const request = require('./helpers/request')
 
 
-describe('/health_check', function() {
-  it('should return 200', async function() {
+describe('/health_check', function () {
+  it('should return 200', async function () {
     const response = await request.get('/health_check')
     const response = await request.get('/health_check')
     expect(response.statusCode).to.equal(200)
     expect(response.statusCode).to.equal(200)
   })
   })

+ 1 - 1
services/spelling/test/acceptance/js/Init.js

@@ -1,6 +1,6 @@
 const App = require('../../../app.js')
 const App = require('../../../app.js')
 const { PORT } = require('./helpers/request')
 const { PORT } = require('./helpers/request')
 
 
-before(function(done) {
+before(function (done) {
   return App.listen(PORT, 'localhost', done)
   return App.listen(PORT, 'localhost', done)
 })
 })

+ 12 - 12
services/spelling/test/acceptance/js/LearnTest.js

@@ -3,7 +3,7 @@ const request = require('./helpers/request')
 
 
 const USER_ID = 101
 const USER_ID = 101
 
 
-const checkWord = words =>
+const checkWord = (words) =>
   request.post({
   request.post({
     url: `/user/${USER_ID}/check`,
     url: `/user/${USER_ID}/check`,
     body: JSON.stringify({
     body: JSON.stringify({
@@ -11,7 +11,7 @@ const checkWord = words =>
     })
     })
   })
   })
 
 
-const learnWord = word =>
+const learnWord = (word) =>
   request.post({
   request.post({
     url: `/user/${USER_ID}/learn`,
     url: `/user/${USER_ID}/learn`,
     body: JSON.stringify({
     body: JSON.stringify({
@@ -19,7 +19,7 @@ const learnWord = word =>
     })
     })
   })
   })
 
 
-const unlearnWord = word =>
+const unlearnWord = (word) =>
   request.post({
   request.post({
     url: `/user/${USER_ID}/unlearn`,
     url: `/user/${USER_ID}/unlearn`,
     body: JSON.stringify({
     body: JSON.stringify({
@@ -37,17 +37,17 @@ const deleteDict = () =>
     url: `/user/${USER_ID}`
     url: `/user/${USER_ID}`
   })
   })
 
 
-describe('learning words', function() {
-  afterEach(async function() {
+describe('learning words', function () {
+  afterEach(async function () {
     await deleteDict()
     await deleteDict()
   })
   })
 
 
-  it('should return status 204 when posting a word successfully', async function() {
+  it('should return status 204 when posting a word successfully', async function () {
     const response = await learnWord('abcd')
     const response = await learnWord('abcd')
     expect(response.statusCode).to.equal(204)
     expect(response.statusCode).to.equal(204)
   })
   })
 
 
-  it('should not learn the same word twice', async function() {
+  it('should not learn the same word twice', async function () {
     await learnWord('foobar')
     await learnWord('foobar')
     const learnResponse = await learnWord('foobar')
     const learnResponse = await learnWord('foobar')
     expect(learnResponse.statusCode).to.equal(204)
     expect(learnResponse.statusCode).to.equal(204)
@@ -59,7 +59,7 @@ describe('learning words', function() {
     expect(responseBody.length).to.equals(1)
     expect(responseBody.length).to.equals(1)
   })
   })
 
 
-  it('should return no misspellings after a word is learnt', async function() {
+  it('should return no misspellings after a word is learnt', async function () {
     const response = await checkWord(['abv'])
     const response = await checkWord(['abv'])
     const responseBody = JSON.parse(response.body)
     const responseBody = JSON.parse(response.body)
     expect(responseBody.misspellings.length).to.equals(1)
     expect(responseBody.misspellings.length).to.equals(1)
@@ -71,7 +71,7 @@ describe('learning words', function() {
     expect(responseBody2.misspellings.length).to.equals(0)
     expect(responseBody2.misspellings.length).to.equals(0)
   })
   })
 
 
-  it('should return misspellings again after a personal dictionary is deleted', async function() {
+  it('should return misspellings again after a personal dictionary is deleted', async function () {
     await learnWord('bvc')
     await learnWord('bvc')
     await deleteDict()
     await deleteDict()
 
 
@@ -81,13 +81,13 @@ describe('learning words', function() {
   })
   })
 })
 })
 
 
-describe('unlearning words', function() {
-  it('should return status 204 when posting a word successfully', async function() {
+describe('unlearning words', function () {
+  it('should return status 204 when posting a word successfully', async function () {
     const response = await unlearnWord('anything')
     const response = await unlearnWord('anything')
     expect(response.statusCode).to.equal(204)
     expect(response.statusCode).to.equal(204)
   })
   })
 
 
-  it('should return misspellings after a word is unlearnt', async function() {
+  it('should return misspellings after a word is unlearnt', async function () {
     await learnWord('abv')
     await learnWord('abv')
 
 
     const response = await checkWord(['abv'])
     const response = await checkWord(['abv'])

+ 2 - 2
services/spelling/test/acceptance/js/StatusTest.js

@@ -1,8 +1,8 @@
 const { expect } = require('chai')
 const { expect } = require('chai')
 const request = require('./helpers/request')
 const request = require('./helpers/request')
 
 
-describe('/status', function() {
-  it('should return 200', async function() {
+describe('/status', function () {
+  it('should return 200', async function () {
     const response = await request.get('/health_check')
     const response = await request.get('/health_check')
     expect(response.statusCode).to.equal(200)
     expect(response.statusCode).to.equal(200)
   })
   })

+ 6 - 6
services/spelling/test/stress/js/stressTest.js

@@ -24,9 +24,9 @@ const wordlist = fs
   .readFileSync(WORDS)
   .readFileSync(WORDS)
   .toString()
   .toString()
   .split('\n')
   .split('\n')
-  .filter(w => w.match(/^[a-z]+$/))
+  .filter((w) => w.match(/^[a-z]+$/))
 
 
-const generateCorrectWords = function(n) {
+const generateCorrectWords = function (n) {
   const words = []
   const words = []
   const N = Math.random() > 0.5 ? wordlist.length : 10
   const N = Math.random() > 0.5 ? wordlist.length : 10
   for (
   for (
@@ -40,7 +40,7 @@ const generateCorrectWords = function(n) {
   return words
   return words
 }
 }
 
 
-const generateIncorrectWords = function(n) {
+const generateIncorrectWords = function (n) {
   const words = []
   const words = []
   const N = wordlist.length
   const N = wordlist.length
   for (
   for (
@@ -54,7 +54,7 @@ const generateIncorrectWords = function(n) {
   return words
   return words
 }
 }
 
 
-const make_request = function(correctWords, incorrectWords, callback) {
+const make_request = function (correctWords, incorrectWords, callback) {
   let i, j, w
   let i, j, w
   let i1
   let i1
   let j1
   let j1
@@ -73,7 +73,7 @@ const make_request = function(correctWords, incorrectWords, callback) {
     bad[i + correctSet.length] = true
     bad[i + correctSet.length] = true
   }
   }
   const k = full.length
   const k = full.length
-  full.forEach(function(e, i) {
+  full.forEach(function (e, i) {
     let ref
     let ref
     j = Math.floor(k * Math.random())
     j = Math.floor(k * Math.random())
     ;[full[i], full[j]] = Array.from([full[j], full[i]])
     ;[full[i], full[j]] = Array.from([full[j], full[i]])
@@ -89,7 +89,7 @@ const make_request = function(correctWords, incorrectWords, callback) {
   return request.post(
   return request.post(
     'http://localhost:3005/user/1/check',
     'http://localhost:3005/user/1/check',
     { json: true, body: { words: full } },
     { json: true, body: { words: full } },
-    function(err, req, body) {
+    function (err, req, body) {
       let m
       let m
       const { misspellings } = body
       const { misspellings } = body
       console.log(JSON.stringify({ full, misspellings }))
       console.log(JSON.stringify({ full, misspellings }))

+ 22 - 22
services/spelling/test/unit/js/ASpellTests.js

@@ -14,8 +14,8 @@ const should = chai.should()
 const SandboxedModule = require('sandboxed-module')
 const SandboxedModule = require('sandboxed-module')
 const { assert } = require('chai')
 const { assert } = require('chai')
 
 
-describe('ASpell', function() {
-  beforeEach(function() {
+describe('ASpell', function () {
+  beforeEach(function () {
     return (this.ASpell = SandboxedModule.require('../../../app/js/ASpell', {
     return (this.ASpell = SandboxedModule.require('../../../app/js/ASpell', {
       requires: {
       requires: {
         'logger-sharelatex': {
         'logger-sharelatex': {
@@ -30,39 +30,39 @@ describe('ASpell', function() {
       }
       }
     }))
     }))
   })
   })
-  afterEach(function() {
+  afterEach(function () {
     clearInterval(this.ASpell.cacheDump)
     clearInterval(this.ASpell.cacheDump)
   })
   })
 
 
-  describe('a correctly spelled word', function() {
-    beforeEach(function(done) {
+  describe('a correctly spelled word', function () {
+    beforeEach(function (done) {
       return this.ASpell.checkWords('en', ['word'], (error, result) => {
       return this.ASpell.checkWords('en', ['word'], (error, result) => {
         this.result = result
         this.result = result
         return done()
         return done()
       })
       })
     })
     })
 
 
-    return it('should not correct the word', function() {
+    return it('should not correct the word', function () {
       return this.result.length.should.equal(0)
       return this.result.length.should.equal(0)
     })
     })
   })
   })
 
 
-  describe('a misspelled word', function() {
-    beforeEach(function(done) {
+  describe('a misspelled word', function () {
+    beforeEach(function (done) {
       return this.ASpell.checkWords('en', ['bussines'], (error, result) => {
       return this.ASpell.checkWords('en', ['bussines'], (error, result) => {
         this.result = result
         this.result = result
         return done()
         return done()
       })
       })
     })
     })
 
 
-    return it('should correct the word', function() {
+    return it('should correct the word', function () {
       this.result.length.should.equal(1)
       this.result.length.should.equal(1)
       return this.result[0].suggestions.indexOf('business').should.not.equal(-1)
       return this.result[0].suggestions.indexOf('business').should.not.equal(-1)
     })
     })
   })
   })
 
 
-  describe('multiple words', function() {
-    beforeEach(function(done) {
+  describe('multiple words', function () {
+    beforeEach(function (done) {
       return this.ASpell.checkWords(
       return this.ASpell.checkWords(
         'en',
         'en',
         ['bussines', 'word', 'neccesary'],
         ['bussines', 'word', 'neccesary'],
@@ -73,7 +73,7 @@ describe('ASpell', function() {
       )
       )
     })
     })
 
 
-    return it('should correct the incorrect words', function() {
+    return it('should correct the incorrect words', function () {
       this.result[0].index.should.equal(0)
       this.result[0].index.should.equal(0)
       this.result[0].suggestions.indexOf('business').should.not.equal(-1)
       this.result[0].suggestions.indexOf('business').should.not.equal(-1)
       this.result[1].index.should.equal(2)
       this.result[1].index.should.equal(2)
@@ -83,8 +83,8 @@ describe('ASpell', function() {
     })
     })
   })
   })
 
 
-  describe('without a valid language', function() {
-    beforeEach(function(done) {
+  describe('without a valid language', function () {
+    beforeEach(function (done) {
       return this.ASpell.checkWords('notALang', ['banana'], (error, result) => {
       return this.ASpell.checkWords('notALang', ['banana'], (error, result) => {
         this.error = error
         this.error = error
         this.result = result
         this.result = result
@@ -92,13 +92,13 @@ describe('ASpell', function() {
       })
       })
     })
     })
 
 
-    return it('should return an error', function() {
+    return it('should return an error', function () {
       return should.exist(this.error)
       return should.exist(this.error)
     })
     })
   })
   })
 
 
-  describe('when there are no suggestions', function() {
-    beforeEach(function(done) {
+  describe('when there are no suggestions', function () {
+    beforeEach(function (done) {
       return this.ASpell.checkWords(
       return this.ASpell.checkWords(
         'en',
         'en',
         ['asdkfjalkdjfadhfkajsdhfashdfjhadflkjadhflajsd'],
         ['asdkfjalkdjfadhfkajsdhfashdfjhadflkjadhflajsd'],
@@ -110,15 +110,15 @@ describe('ASpell', function() {
       )
       )
     })
     })
 
 
-    return it('should return a blank array', function() {
+    return it('should return a blank array', function () {
       this.result.length.should.equal(1)
       this.result.length.should.equal(1)
       return assert.deepEqual(this.result[0].suggestions, [])
       return assert.deepEqual(this.result[0].suggestions, [])
     })
     })
   })
   })
 
 
-  return describe('when the request times out', function() {
-    beforeEach(function(done) {
-      const words = __range__(0, 1000, true).map(i => 'abcdefg')
+  return describe('when the request times out', function () {
+    beforeEach(function (done) {
+      const words = __range__(0, 1000, true).map((i) => 'abcdefg')
       this.ASpell.ASPELL_TIMEOUT = 1
       this.ASpell.ASPELL_TIMEOUT = 1
       this.start = Date.now()
       this.start = Date.now()
       return this.ASpell.checkWords('en', words, (error, result) => {
       return this.ASpell.checkWords('en', words, (error, result) => {
@@ -130,7 +130,7 @@ describe('ASpell', function() {
     // Note that this test fails on OS X, due to differing pipe behaviour
     // Note that this test fails on OS X, due to differing pipe behaviour
     // on killing the child process. It can be tested successfully on Travis
     // on killing the child process. It can be tested successfully on Travis
     // or the CI server.
     // or the CI server.
-    return it('should return in reasonable time', function() {
+    return it('should return in reasonable time', function () {
       const delta = Date.now() - this.start
       const delta = Date.now() - this.start
       return delta.should.be.below(this.ASpell.ASPELL_TIMEOUT + 1000)
       return delta.should.be.below(this.ASpell.ASPELL_TIMEOUT + 1000)
     })
     })

+ 17 - 17
services/spelling/test/unit/js/ASpellWorkerTests.js

@@ -8,8 +8,8 @@ const { expect } = chai
 const SandboxedModule = require('sandboxed-module')
 const SandboxedModule = require('sandboxed-module')
 const EventEmitter = require('events')
 const EventEmitter = require('events')
 
 
-describe('ASpellWorker', function() {
-  beforeEach(function() {
+describe('ASpellWorker', function () {
+  beforeEach(function () {
     this.child_process = {}
     this.child_process = {}
     return (this.ASpellWorker = SandboxedModule.require(
     return (this.ASpellWorker = SandboxedModule.require(
       '../../../app/js/ASpellWorker',
       '../../../app/js/ASpellWorker',
@@ -30,8 +30,8 @@ describe('ASpellWorker', function() {
     ))
     ))
   })
   })
 
 
-  describe('creating a worker', function() {
-    beforeEach(function() {
+  describe('creating a worker', function () {
+    beforeEach(function () {
       this.pipe = {
       this.pipe = {
         stdout: new EventEmitter(),
         stdout: new EventEmitter(),
         stderr: { on: sinon.stub() },
         stderr: { on: sinon.stub() },
@@ -44,8 +44,8 @@ describe('ASpellWorker', function() {
       worker = new this.ASpellWorker('en')
       worker = new this.ASpellWorker('en')
     })
     })
 
 
-    describe('with normal aspell output', function() {
-      beforeEach(function() {
+    describe('with normal aspell output', function () {
+      beforeEach(function () {
         this.callback = worker.callback = sinon.stub()
         this.callback = worker.callback = sinon.stub()
         this.pipe.stdout.emit('data', '& hello\n')
         this.pipe.stdout.emit('data', '& hello\n')
         this.pipe.stdout.emit('data', '& world\n')
         this.pipe.stdout.emit('data', '& world\n')
@@ -53,7 +53,7 @@ describe('ASpellWorker', function() {
         this.pipe.stdout.emit('data', '& goodbye')
         this.pipe.stdout.emit('data', '& goodbye')
       })
       })
 
 
-      it('should call the callback', function() {
+      it('should call the callback', function () {
         expect(this.callback.called).to.equal(true)
         expect(this.callback.called).to.equal(true)
         expect(
         expect(
           this.callback.calledWith(null, '& hello\n& world\nen\n')
           this.callback.calledWith(null, '& hello\n& world\nen\n')
@@ -61,8 +61,8 @@ describe('ASpellWorker', function() {
       })
       })
     })
     })
 
 
-    describe('with the aspell end marker split across chunks', function() {
-      beforeEach(function() {
+    describe('with the aspell end marker split across chunks', function () {
+      beforeEach(function () {
         this.callback = worker.callback = sinon.stub()
         this.callback = worker.callback = sinon.stub()
         this.pipe.stdout.emit('data', '& hello\n')
         this.pipe.stdout.emit('data', '& hello\n')
         this.pipe.stdout.emit('data', '& world\ne')
         this.pipe.stdout.emit('data', '& world\ne')
@@ -70,7 +70,7 @@ describe('ASpellWorker', function() {
         this.pipe.stdout.emit('data', '& goodbye')
         this.pipe.stdout.emit('data', '& goodbye')
       })
       })
 
 
-      it('should call the callback', function() {
+      it('should call the callback', function () {
         expect(this.callback.called).to.equal(true)
         expect(this.callback.called).to.equal(true)
         expect(
         expect(
           this.callback.calledWith(null, '& hello\n& world\nen\n')
           this.callback.calledWith(null, '& hello\n& world\nen\n')
@@ -78,8 +78,8 @@ describe('ASpellWorker', function() {
       })
       })
     })
     })
 
 
-    describe('with the aspell end marker newline split across chunks', function() {
-      beforeEach(function() {
+    describe('with the aspell end marker newline split across chunks', function () {
+      beforeEach(function () {
         this.callback = worker.callback = sinon.stub()
         this.callback = worker.callback = sinon.stub()
         this.pipe.stdout.emit('data', '& hello\n')
         this.pipe.stdout.emit('data', '& hello\n')
         this.pipe.stdout.emit('data', '& world\n')
         this.pipe.stdout.emit('data', '& world\n')
@@ -87,7 +87,7 @@ describe('ASpellWorker', function() {
         this.pipe.stdout.emit('data', '\n& goodbye')
         this.pipe.stdout.emit('data', '\n& goodbye')
       })
       })
 
 
-      it('should call the callback', function() {
+      it('should call the callback', function () {
         expect(this.callback.called).to.equal(true)
         expect(this.callback.called).to.equal(true)
         expect(this.callback.calledWith(null, '& hello\n& world\nen')).to.equal(
         expect(this.callback.calledWith(null, '& hello\n& world\nen')).to.equal(
           true
           true
@@ -95,15 +95,15 @@ describe('ASpellWorker', function() {
       })
       })
     })
     })
 
 
-    describe('with everything split across chunks', function() {
-      beforeEach(function() {
+    describe('with everything split across chunks', function () {
+      beforeEach(function () {
         this.callback = worker.callback = sinon.stub()
         this.callback = worker.callback = sinon.stub()
-        '& hello\n& world\nen\n& goodbye'.split('').forEach(x => {
+        '& hello\n& world\nen\n& goodbye'.split('').forEach((x) => {
           this.pipe.stdout.emit('data', x)
           this.pipe.stdout.emit('data', x)
         })
         })
       })
       })
 
 
-      it('should call the callback', function() {
+      it('should call the callback', function () {
         expect(this.callback.called).to.equal(true)
         expect(this.callback.called).to.equal(true)
         expect(this.callback.calledWith(null, '& hello\n& world\nen')).to.equal(
         expect(this.callback.calledWith(null, '& hello\n& world\nen')).to.equal(
           true
           true

+ 21 - 21
services/spelling/test/unit/js/LearnedWordsManagerTests.js

@@ -7,8 +7,8 @@ const modulePath = require('path').join(
   '../../../app/js/LearnedWordsManager'
   '../../../app/js/LearnedWordsManager'
 )
 )
 const { assert } = require('chai')
 const { assert } = require('chai')
-describe('LearnedWordsManager', function() {
-  beforeEach(function() {
+describe('LearnedWordsManager', function () {
+  beforeEach(function () {
     this.token = 'a6b3cd919ge'
     this.token = 'a6b3cd919ge'
     this.callback = sinon.stub()
     this.callback = sinon.stub()
     this.db = {
     this.db = {
@@ -41,13 +41,13 @@ describe('LearnedWordsManager', function() {
     })
     })
   })
   })
 
 
-  describe('learnWord', function() {
-    beforeEach(function() {
+  describe('learnWord', function () {
+    beforeEach(function () {
       this.word = 'instanton'
       this.word = 'instanton'
       this.LearnedWordsManager.learnWord(this.token, this.word, this.callback)
       this.LearnedWordsManager.learnWord(this.token, this.word, this.callback)
     })
     })
 
 
-    it('should insert the word in the word list in the database', function() {
+    it('should insert the word in the word list in the database', function () {
       expect(
       expect(
         this.db.spellingPreferences.update.calledWith(
         this.db.spellingPreferences.update.calledWith(
           {
           {
@@ -63,18 +63,18 @@ describe('LearnedWordsManager', function() {
       ).to.equal(true)
       ).to.equal(true)
     })
     })
 
 
-    it('should call the callback', function() {
+    it('should call the callback', function () {
       expect(this.callback.called).to.equal(true)
       expect(this.callback.called).to.equal(true)
     })
     })
   })
   })
 
 
-  describe('unlearnWord', function() {
-    beforeEach(function() {
+  describe('unlearnWord', function () {
+    beforeEach(function () {
       this.word = 'instanton'
       this.word = 'instanton'
       this.LearnedWordsManager.unlearnWord(this.token, this.word, this.callback)
       this.LearnedWordsManager.unlearnWord(this.token, this.word, this.callback)
     })
     })
 
 
-    it('should remove the word from the word list in the database', function() {
+    it('should remove the word from the word list in the database', function () {
       expect(
       expect(
         this.db.spellingPreferences.update.calledWith(
         this.db.spellingPreferences.update.calledWith(
           {
           {
@@ -87,13 +87,13 @@ describe('LearnedWordsManager', function() {
       ).to.equal(true)
       ).to.equal(true)
     })
     })
 
 
-    it('should call the callback', function() {
+    it('should call the callback', function () {
       expect(this.callback.called).to.equal(true)
       expect(this.callback.called).to.equal(true)
     })
     })
   })
   })
 
 
-  describe('getLearnedWords', function() {
-    beforeEach(function() {
+  describe('getLearnedWords', function () {
+    beforeEach(function () {
       this.wordList = ['apples', 'bananas', 'pears']
       this.wordList = ['apples', 'bananas', 'pears']
       this.wordListWithDuplicates = this.wordList.slice()
       this.wordListWithDuplicates = this.wordList.slice()
       this.wordListWithDuplicates.push('bananas')
       this.wordListWithDuplicates.push('bananas')
@@ -104,19 +104,19 @@ describe('LearnedWordsManager', function() {
       this.LearnedWordsManager.getLearnedWords(this.token, this.callback)
       this.LearnedWordsManager.getLearnedWords(this.token, this.callback)
     })
     })
 
 
-    it('should get the word list for the given user', function() {
+    it('should get the word list for the given user', function () {
       expect(
       expect(
         this.db.spellingPreferences.findOne.calledWith({ token: this.token })
         this.db.spellingPreferences.findOne.calledWith({ token: this.token })
       ).to.equal(true)
       ).to.equal(true)
     })
     })
 
 
-    it('should return the word list in the callback without duplicates', function() {
+    it('should return the word list in the callback without duplicates', function () {
       expect(this.callback.calledWith(null, this.wordList)).to.equal(true)
       expect(this.callback.calledWith(null, this.wordList)).to.equal(true)
     })
     })
   })
   })
 
 
-  describe('caching the result', function() {
-    it('should use the cache first if it is primed', function(done) {
+  describe('caching the result', function () {
+    it('should use the cache first if it is primed', function (done) {
       this.wordList = ['apples', 'bananas', 'pears']
       this.wordList = ['apples', 'bananas', 'pears']
       this.cache.get.returns(this.wordList)
       this.cache.get.returns(this.wordList)
       this.db.spellingPreferences.findOne = sinon.stub()
       this.db.spellingPreferences.findOne = sinon.stub()
@@ -128,7 +128,7 @@ describe('LearnedWordsManager', function() {
       })
       })
     })
     })
 
 
-    it('should set the cache after hitting the db', function(done) {
+    it('should set the cache after hitting the db', function (done) {
       this.wordList = ['apples', 'bananas', 'pears']
       this.wordList = ['apples', 'bananas', 'pears']
       this.db.spellingPreferences.findOne = sinon
       this.db.spellingPreferences.findOne = sinon
         .stub()
         .stub()
@@ -139,7 +139,7 @@ describe('LearnedWordsManager', function() {
       })
       })
     })
     })
 
 
-    it('should break cache when update is called', function(done) {
+    it('should break cache when update is called', function (done) {
       this.word = 'instanton'
       this.word = 'instanton'
       this.LearnedWordsManager.learnWord(this.token, this.word, () => {
       this.LearnedWordsManager.learnWord(this.token, this.word, () => {
         this.cache.del.calledWith(this.token).should.equal(true)
         this.cache.del.calledWith(this.token).should.equal(true)
@@ -148,12 +148,12 @@ describe('LearnedWordsManager', function() {
     })
     })
   })
   })
 
 
-  describe('deleteUsersLearnedWords', function() {
-    beforeEach(function() {
+  describe('deleteUsersLearnedWords', function () {
+    beforeEach(function () {
       this.db.spellingPreferences.remove = sinon.stub().callsArgWith(1)
       this.db.spellingPreferences.remove = sinon.stub().callsArgWith(1)
     })
     })
 
 
-    it('should get the word list for the given user', function(done) {
+    it('should get the word list for the given user', function (done) {
       this.LearnedWordsManager.deleteUsersLearnedWords(this.token, () => {
       this.LearnedWordsManager.deleteUsersLearnedWords(this.token, () => {
         this.db.spellingPreferences.remove
         this.db.spellingPreferences.remove
           .calledWith({ token: this.token })
           .calledWith({ token: this.token })

+ 56 - 52
services/spelling/test/unit/js/SpellingAPIManagerTests.js

@@ -11,10 +11,10 @@ const modulePath = require('path').join(
   '../../../app/js/SpellingAPIManager'
   '../../../app/js/SpellingAPIManager'
 )
 )
 
 
-const promiseStub = val => new Promise(resolve => resolve(val))
+const promiseStub = (val) => new Promise((resolve) => resolve(val))
 
 
-describe('SpellingAPIManager', function() {
-  beforeEach(function() {
+describe('SpellingAPIManager', function () {
+  beforeEach(function () {
     this.token = 'user-id-123'
     this.token = 'user-id-123'
     this.ASpell = {}
     this.ASpell = {}
     this.learnedWords = ['lerned']
     this.learnedWords = ['lerned']
@@ -35,8 +35,8 @@ describe('SpellingAPIManager', function() {
     })
     })
   })
   })
 
 
-  describe('runRequest', function() {
-    beforeEach(function() {
+  describe('runRequest', function () {
+    beforeEach(function () {
       this.nonLearnedWords = [
       this.nonLearnedWords = [
         'some',
         'some',
         'words',
         'words',
@@ -64,8 +64,8 @@ describe('SpellingAPIManager', function() {
       sinon.spy(this.ASpell, 'checkWords')
       sinon.spy(this.ASpell, 'checkWords')
     })
     })
 
 
-    describe('with sensible JSON', function() {
-      beforeEach(function(done) {
+    describe('with sensible JSON', function () {
+      beforeEach(function (done) {
         this.SpellingAPIManager.runRequest(
         this.SpellingAPIManager.runRequest(
           this.token,
           this.token,
           { words: this.allWords },
           { words: this.allWords },
@@ -76,15 +76,15 @@ describe('SpellingAPIManager', function() {
         )
         )
       })
       })
 
 
-      it('should return the words that are spelled incorrectly and not learned', function() {
+      it('should return the words that are spelled incorrectly and not learned', function () {
         expect(this.result.misspellings).to.deep.equal(
         expect(this.result.misspellings).to.deep.equal(
           this.misspellingsWithoutLearnedWords
           this.misspellingsWithoutLearnedWords
         )
         )
       })
       })
     })
     })
 
 
-    describe('with a missing words array', function() {
-      beforeEach(function(done) {
+    describe('with a missing words array', function () {
+      beforeEach(function (done) {
         this.SpellingAPIManager.runRequest(this.token, {}, (error, result) => {
         this.SpellingAPIManager.runRequest(this.token, {}, (error, result) => {
           this.error = error
           this.error = error
           this.result = result
           this.result = result
@@ -92,15 +92,15 @@ describe('SpellingAPIManager', function() {
         })
         })
       })
       })
 
 
-      it('should return an error', function() {
+      it('should return an error', function () {
         expect(this.error).to.exist
         expect(this.error).to.exist
         expect(this.error).to.be.instanceof(Error)
         expect(this.error).to.be.instanceof(Error)
         expect(this.error.message).to.equal('malformed JSON')
         expect(this.error.message).to.equal('malformed JSON')
       })
       })
     })
     })
 
 
-    describe('with a missing token', function() {
-      beforeEach(function(done) {
+    describe('with a missing token', function () {
+      beforeEach(function (done) {
         this.SpellingAPIManager.runRequest(
         this.SpellingAPIManager.runRequest(
           null,
           null,
           { words: this.allWords },
           { words: this.allWords },
@@ -112,13 +112,13 @@ describe('SpellingAPIManager', function() {
         )
         )
       })
       })
 
 
-      it('should spell check without using any learned words', function() {
+      it('should spell check without using any learned words', function () {
         this.LearnedWordsManager.getLearnedWords.called.should.equal(false)
         this.LearnedWordsManager.getLearnedWords.called.should.equal(false)
       })
       })
     })
     })
 
 
-    describe('without a language', function() {
-      beforeEach(function(done) {
+    describe('without a language', function () {
+      beforeEach(function (done) {
         this.SpellingAPIManager.runRequest(
         this.SpellingAPIManager.runRequest(
           this.token,
           this.token,
           { words: this.allWords },
           { words: this.allWords },
@@ -129,13 +129,13 @@ describe('SpellingAPIManager', function() {
         )
         )
       })
       })
 
 
-      it('should use en as the default', function() {
+      it('should use en as the default', function () {
         this.ASpell.promises.checkWords.calledWith('en').should.equal(true)
         this.ASpell.promises.checkWords.calledWith('en').should.equal(true)
       })
       })
     })
     })
 
 
-    describe('with a language', function() {
-      beforeEach(function(done) {
+    describe('with a language', function () {
+      beforeEach(function (done) {
         this.language = 'fr'
         this.language = 'fr'
         this.SpellingAPIManager.runRequest(
         this.SpellingAPIManager.runRequest(
           this.token,
           this.token,
@@ -150,15 +150,15 @@ describe('SpellingAPIManager', function() {
         )
         )
       })
       })
 
 
-      it('should use the language', function() {
+      it('should use the language', function () {
         this.ASpell.promises.checkWords
         this.ASpell.promises.checkWords
           .calledWith(this.language)
           .calledWith(this.language)
           .should.equal(true)
           .should.equal(true)
       })
       })
     })
     })
 
 
-    describe('with words from the whitelist', function() {
-      beforeEach(function(done) {
+    describe('with words from the whitelist', function () {
+      beforeEach(function (done) {
         this.whitelistWord = this.SpellingAPIManager.whitelist[0]
         this.whitelistWord = this.SpellingAPIManager.whitelist[0]
         this.words = ['One', 'Two', this.whitelistWord]
         this.words = ['One', 'Two', this.whitelistWord]
         this.SpellingAPIManager.runRequest(
         this.SpellingAPIManager.runRequest(
@@ -171,7 +171,7 @@ describe('SpellingAPIManager', function() {
         )
         )
       })
       })
 
 
-      it('should ignore the white-listed word', function() {
+      it('should ignore the white-listed word', function () {
         expect(this.result.misspellings.length).to.equal(
         expect(this.result.misspellings.length).to.equal(
           this.misspellings.length - 1
           this.misspellings.length - 1
         )
         )
@@ -179,51 +179,51 @@ describe('SpellingAPIManager', function() {
     })
     })
   })
   })
 
 
-  describe('learnWord', function() {
-    describe('without a token', function() {
-      beforeEach(function(done) {
-        this.SpellingAPIManager.learnWord(null, { word: 'banana' }, error => {
+  describe('learnWord', function () {
+    describe('without a token', function () {
+      beforeEach(function (done) {
+        this.SpellingAPIManager.learnWord(null, { word: 'banana' }, (error) => {
           this.error = error
           this.error = error
           done()
           done()
         })
         })
       })
       })
 
 
-      it('should return an error', function() {
+      it('should return an error', function () {
         expect(this.error).to.exist
         expect(this.error).to.exist
         expect(this.error).to.be.instanceof(Error)
         expect(this.error).to.be.instanceof(Error)
         expect(this.error.message).to.equal('no token provided')
         expect(this.error.message).to.equal('no token provided')
       })
       })
     })
     })
 
 
-    describe('without a word', function() {
-      beforeEach(function(done) {
-        this.SpellingAPIManager.learnWord(this.token, {}, error => {
+    describe('without a word', function () {
+      beforeEach(function (done) {
+        this.SpellingAPIManager.learnWord(this.token, {}, (error) => {
           this.error = error
           this.error = error
           done()
           done()
         })
         })
       })
       })
 
 
-      it('should return an error', function() {
+      it('should return an error', function () {
         expect(this.error).to.exist
         expect(this.error).to.exist
         expect(this.error).to.be.instanceof(Error)
         expect(this.error).to.be.instanceof(Error)
         expect(this.error.message).to.equal('malformed JSON')
         expect(this.error.message).to.equal('malformed JSON')
       })
       })
     })
     })
 
 
-    describe('with a word and a token', function() {
-      beforeEach(function(done) {
+    describe('with a word and a token', function () {
+      beforeEach(function (done) {
         this.word = 'banana'
         this.word = 'banana'
         this.SpellingAPIManager.learnWord(
         this.SpellingAPIManager.learnWord(
           this.token,
           this.token,
           { word: this.word },
           { word: this.word },
-          error => {
+          (error) => {
             this.error = error
             this.error = error
             done()
             done()
           }
           }
         )
         )
       })
       })
 
 
-      it('should call LearnedWordsManager.learnWord', function() {
+      it('should call LearnedWordsManager.learnWord', function () {
         this.LearnedWordsManager.learnWord
         this.LearnedWordsManager.learnWord
           .calledWith(this.token, this.word)
           .calledWith(this.token, this.word)
           .should.equal(true)
           .should.equal(true)
@@ -231,51 +231,55 @@ describe('SpellingAPIManager', function() {
     })
     })
   })
   })
 
 
-  describe('unlearnWord', function() {
-    describe('without a token', function() {
-      beforeEach(function(done) {
-        this.SpellingAPIManager.unlearnWord(null, { word: 'banana' }, error => {
-          this.error = error
-          done()
-        })
+  describe('unlearnWord', function () {
+    describe('without a token', function () {
+      beforeEach(function (done) {
+        this.SpellingAPIManager.unlearnWord(
+          null,
+          { word: 'banana' },
+          (error) => {
+            this.error = error
+            done()
+          }
+        )
       })
       })
 
 
-      it('should return an error', function() {
+      it('should return an error', function () {
         expect(this.error).to.exist
         expect(this.error).to.exist
         expect(this.error).to.be.instanceof(Error)
         expect(this.error).to.be.instanceof(Error)
         expect(this.error.message).to.equal('no token provided')
         expect(this.error.message).to.equal('no token provided')
       })
       })
     })
     })
 
 
-    describe('without a word', function() {
-      beforeEach(function(done) {
-        this.SpellingAPIManager.unlearnWord(this.token, {}, error => {
+    describe('without a word', function () {
+      beforeEach(function (done) {
+        this.SpellingAPIManager.unlearnWord(this.token, {}, (error) => {
           this.error = error
           this.error = error
           done()
           done()
         })
         })
       })
       })
 
 
-      it('should return an error', function() {
+      it('should return an error', function () {
         expect(this.error).to.exist
         expect(this.error).to.exist
         expect(this.error).to.be.instanceof(Error)
         expect(this.error).to.be.instanceof(Error)
         expect(this.error.message).to.equal('malformed JSON')
         expect(this.error.message).to.equal('malformed JSON')
       })
       })
     })
     })
 
 
-    describe('with a word and a token', function() {
-      beforeEach(function(done) {
+    describe('with a word and a token', function () {
+      beforeEach(function (done) {
         this.word = 'banana'
         this.word = 'banana'
         this.SpellingAPIManager.unlearnWord(
         this.SpellingAPIManager.unlearnWord(
           this.token,
           this.token,
           { word: this.word },
           { word: this.word },
-          error => {
+          (error) => {
             this.error = error
             this.error = error
             done()
             done()
           }
           }
         )
         )
       })
       })
 
 
-      it('should call LearnedWordsManager.unlearnWord', function() {
+      it('should call LearnedWordsManager.unlearnWord', function () {
         this.LearnedWordsManager.unlearnWord
         this.LearnedWordsManager.unlearnWord
           .calledWith(this.token, this.word)
           .calledWith(this.token, this.word)
           .should.equal(true)
           .should.equal(true)