Merge pull request #18289 from overleaf/ac-ar-eslint-return-await

Add ESLint rule @typescript-eslint/return-await to backend services

GitOrigin-RevId: 75e3e32597827fcc852e69d479515fc72e8f45e4
This commit is contained in:
Andrew Rumble
2024-05-27 10:22:49 +00:00
committed by Copybot
parent 029cd4abe7
commit 71187a51ba
43 changed files with 1180 additions and 411 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ module.exports = {
async function convert(sourcePath, requestedFormat) {
const width = '600x'
return _convert(sourcePath, requestedFormat, [
return await _convert(sourcePath, requestedFormat, [
'convert',
'-define',
`pdf:fit-page=${width}`,
@@ -35,7 +35,7 @@ async function convert(sourcePath, requestedFormat) {
async function thumbnail(sourcePath) {
const width = '260x'
return convert(sourcePath, 'png', [
return await convert(sourcePath, 'png', [
'convert',
'-flatten',
'-background',
@@ -52,7 +52,7 @@ async function thumbnail(sourcePath) {
async function preview(sourcePath) {
const width = '548x'
return convert(sourcePath, 'png', [
return await convert(sourcePath, 'png', [
'convert',
'-flatten',
'-background',
+6 -6
View File
@@ -72,9 +72,9 @@ async function deleteProject(bucket, key) {
async function getFile(bucket, key, opts) {
opts = opts || {}
if (!opts.format && !opts.style) {
return PersistorManager.getObjectStream(bucket, key, opts)
return await PersistorManager.getObjectStream(bucket, key, opts)
} else {
return _getConvertedFile(bucket, key, opts)
return await _getConvertedFile(bucket, key, opts)
}
}
@@ -114,7 +114,7 @@ async function getRedirectUrl(bucket, key, opts) {
}
async function getFileSize(bucket, key) {
return PersistorManager.getObjectSize(bucket, key)
return await PersistorManager.getObjectSize(bucket, key)
}
async function getDirectorySize(bucket, projectId) {
@@ -128,9 +128,9 @@ async function _getConvertedFile(bucket, key, opts) {
convertedKey
)
if (exists) {
return PersistorManager.getObjectStream(bucket, convertedKey, opts)
return await PersistorManager.getObjectStream(bucket, convertedKey, opts)
} else {
return _getConvertedFileAndCache(bucket, key, convertedKey, opts)
return await _getConvertedFileAndCache(bucket, key, convertedKey, opts)
}
}
@@ -212,5 +212,5 @@ async function _convertFile(bucket, originalKey, opts) {
async function _writeFileToDisk(bucket, key, opts) {
const fileStream = await PersistorManager.getObjectStream(bucket, key, opts)
return LocalFileWriter.promises.writeStream(fileStream, key)
return await LocalFileWriter.promises.writeStream(fileStream, key)
}
@@ -23,7 +23,7 @@ class FilestoreApp {
}
if (this.initing) {
return this.waitForInit()
return await this.waitForInit()
}
this.initing = true
@@ -332,7 +332,7 @@ describe('Filestore', function () {
]
before(async function () {
return Promise.all([
return await Promise.all([
fsWriteFile(localFileReadPaths[0], constantFileContents[0]),
fsWriteFile(localFileReadPaths[1], constantFileContents[1]),
fsWriteFile(localFileReadPaths[2], constantFileContents[2]),
@@ -38,7 +38,7 @@ async function uploadStringToPersistor(persistor, bucket, key, content) {
async function getStringFromPersistor(persistor, bucket, key) {
const stream = await persistor.getObjectStream(bucket, key, {})
return streamToString(stream)
return await streamToString(stream)
}
async function expectPersistorToHaveFile(persistor, bucket, key, content) {
+2 -1
View File
@@ -2,7 +2,8 @@
"extends": "../../tsconfig.backend.json",
"include": [
"app.js",
"app/src/**/*",
"app/js/**/*",
"config/**/*",
"scripts/**/*",
"test/**/*"
]