Merge pull request #3942 from overleaf/prettier-trailing-comma

Set Prettier's "trailingComma" setting to "es5"

GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
This commit is contained in:
Alf Eaton
2021-04-28 02:10:01 +00:00
committed by Copybot
parent 15011a9982
commit 1be43911b4
877 changed files with 20093 additions and 20064 deletions
@@ -25,7 +25,7 @@ const DUMMY_TIME = new Date('2021-04-12T00:00:00.000Z')
const LRUCache = require('lru-cache')
const deletedProjectsCache = new LRUCache({
max: CACHE_SIZE
max: CACHE_SIZE,
})
function getSecondsFromObjectId(id) {
@@ -47,12 +47,12 @@ async function main() {
// include edge
$gte: startId,
// exclude edge
$lt: endId
$lt: endId,
},
deleted: true,
name: {
$exists: false
}
$exists: false,
},
}
const docs = await db.docs
.find(query, { readPreference: ReadPreference.SECONDARY })
@@ -86,8 +86,8 @@ async function getDeletedProject(projectId) {
{
projection: {
_id: 1,
'project.deletedDocs': 1
}
'project.deletedDocs': 1,
},
}
)
deletedProjectsCache.set(cacheKey, deletedProject)
@@ -135,7 +135,7 @@ async function letUserDoubleCheckInputs() {
FIRST_PROJECT_ID,
INCREMENT_BY_S,
STOP_AT_S,
LET_USER_DOUBLE_CHECK_INPUTS_FOR
LET_USER_DOUBLE_CHECK_INPUTS_FOR,
},
null,
2
@@ -14,7 +14,7 @@ async function main() {
'projects',
{ archived: false },
{
$set: { archived: [] }
$set: { archived: [] },
}
)
@@ -28,7 +28,7 @@ async function main() {
collaberator_refs: 1,
readOnly_refs: 1,
tokenAccessReadAndWrite_refs: 1,
tokenAccessReadOnly_refs: 1
tokenAccessReadOnly_refs: 1,
})
console.error('Done, with second part')
@@ -56,7 +56,7 @@ async function setArchived(collection, project) {
return collection.updateOne(
{ _id: project._id },
{
$set: { archived: archived }
$set: { archived: archived },
}
)
}
@@ -8,7 +8,7 @@ const Errors = require('../app/src/Features/Errors/Errors')
async function countFiles() {
const rl = readline.createInterface({
input: process.stdin
input: process.stdin,
})
for await (const projectId of rl) {
@@ -19,7 +19,7 @@ async function countFiles() {
}
const {
files,
docs
docs,
} = await ProjectEntityHandler.promises.getAllEntitiesFromProject(project)
console.error(
projectId,
@@ -7,7 +7,7 @@ const readline = require('readline')
const {
db,
ObjectId,
waitForDb
waitForDb,
} = require('../../app/src/infrastructure/mongodb')
const DocstoreManager = require('../../app/src/Features/Docstore/DocstoreManager')
.promises
@@ -25,7 +25,7 @@ const input = fs.createReadStream(argv._[0])
const rl = readline.createInterface({
crlfDelay: Infinity,
input
input,
})
const orphanedDocs = {}
@@ -106,7 +106,7 @@ async function projectIdExists(projectId) {
// check both projects and deletedProjects to see if project id exists
const [project, deletedProject] = await Promise.all([
findProject(projectId),
findDeletedProject(projectId)
findDeletedProject(projectId),
])
return project !== null || deletedProject !== null
+1 -1
View File
@@ -9,7 +9,7 @@ const success = []
console.log('Starting ensure affiliations')
const query = {
'emails.affiliationUnchecked': true
'emails.affiliationUnchecked': true,
}
async function _handleEnsureAffiliation(user) {
@@ -74,5 +74,5 @@ function batchedUpdateWithResultHandling(collection, query, update) {
module.exports = {
getNextBatch,
batchedUpdate,
batchedUpdateWithResultHandling
batchedUpdateWithResultHandling,
}
+4 -4
View File
@@ -19,8 +19,8 @@ waitForDb().then(async () => {
_id: 1,
owner_ref: 1,
tokenAccessReadOnly_refs: 1,
tokenAccessReadAndWrite_refs: 1
}
tokenAccessReadAndWrite_refs: 1,
},
}
)
.toArray()
@@ -39,8 +39,8 @@ waitForDb().then(async () => {
$set: {
publicAccesLevel: 'private', // note the spelling in the db is publicAccesLevel (with one 's')
tokenAccessReadOnly_refs: [],
tokenAccessReadAndWrite_refs: []
}
tokenAccessReadAndWrite_refs: [],
},
}
)
console.log('result', JSON.stringify(result))
@@ -89,7 +89,7 @@ attemptInvoicesCollection(error => {
{
INVOICES_COLLECTED,
INVOICES_COLLECTED_SUCCESS,
USERS_COLLECTED
USERS_COLLECTED,
},
{ maxArrayLength: null }
)
@@ -62,7 +62,7 @@ const printAccountCSV = (account, callback) => {
}-${endAt.getDate()}`,
current_period_ends_at_segment: parseInt(
((endAt - NOW) / 1000 / 3600 / 24 / 365) * 7
)
),
}
callback(null, csvData)
})
@@ -93,7 +93,7 @@ const csvFields = [
'billing_info_url',
'account_management_url',
'current_period_ends_at',
'current_period_ends_at_segment'
'current_period_ends_at_segment',
]
const csvParser = new CSVParser({ csvFields })
@@ -35,7 +35,7 @@ const ScriptLogger = {
)
} else {
ScriptLogger.allMismatchReasons[mismatchReasonsString] = [
subscription._id
subscription._id,
]
}
},
@@ -52,7 +52,7 @@ const ScriptLogger = {
'Mismatch Subscriptions Count',
ScriptLogger.mismatchSubscriptionsCount
)
}
},
}
const slowCallback = callback => setTimeout(callback, 80)
@@ -105,7 +105,7 @@ const syncSubscriptions = (subscriptions, callback) => {
const loopForSubscriptions = (skip, callback) => {
Subscription.find({
recurlySubscription_id: { $exists: true, $ne: '' }
recurlySubscription_id: { $exists: true, $ne: '' },
})
.sort('_id')
.skip(skip)
+1 -1
View File
@@ -50,7 +50,7 @@ const ScriptLogger = {
'Recent Logged In (Last 30 Days):',
_.filter(ScriptLogger.allDaysSinceLastLoggedIn, a => a < 30).length
)
}
},
}
const checkAndUpdateUser = (user, callback) =>
@@ -24,7 +24,7 @@ async function rewriteDuplicates(duplicateReferralIds) {
{ referal_id: referralId },
{
projection: { _id: 1 },
readPreference: ReadPreference.SECONDARY
readPreference: ReadPreference.SECONDARY,
}
)
.toArray()
@@ -44,8 +44,8 @@ async function rewriteDuplicates(duplicateReferralIds) {
{ _id: user._id },
{
$set: {
referal_id: newReferralId
}
referal_id: newReferralId,
},
}
)
}
@@ -11,7 +11,7 @@ const FILE_NAMES_TO_RESTORE = ARGV
async function main() {
const project = await ProjectGetter.promises.getProject(PROJECT_ID, {
deletedDocs: 1
deletedDocs: 1,
})
const docsToRestore = project.deletedDocs.filter(doc =>
FILE_NAMES_TO_RESTORE.includes(doc.name)
@@ -22,7 +22,7 @@ async function main() {
PROJECT_ID,
deletedDoc._id,
{
include_deleted: true
include_deleted: true,
},
(err, lines, rev, version, ranges) => {
if (err) return reject(err)
@@ -135,7 +135,7 @@ async function syncUserEntitlement(userId, email, hasEntitlement) {
function loadUserEntitlements(userEntitlementsFilename) {
const userEntitlementsFile = fs.readFileSync(userEntitlementsFilename, {
encoding: 'utf8'
encoding: 'utf8',
})
const userEntitlements = {}
@@ -156,7 +156,7 @@ function loadUserEntitlements(userEntitlementsFilename) {
function loadCachedEntitlements(cachedEntitlementsFilename) {
const cachedEntitlementsFile = fs.readFileSync(cachedEntitlementsFilename, {
encoding: 'utf8'
encoding: 'utf8',
})
const cachedEntitlements = {}
@@ -167,7 +167,7 @@ function loadCachedEntitlements(cachedEntitlementsFilename) {
userId,
email,
hasEntitlement,
providerId
providerId,
] = cachedEntitlementLine.split(',')
let hasEntitlementBoolean
if (ignoreNulls) {
@@ -180,7 +180,7 @@ function loadCachedEntitlements(cachedEntitlementsFilename) {
email,
hasEntitlement: hasEntitlementBoolean,
providerId,
userId
userId,
}
}
+2 -2
View File
@@ -18,12 +18,12 @@ function withAuth(options) {
{
apiKey: process.env.ONE_SKY_PUBLIC_KEY,
secret: process.env.ONE_SKY_PRIVATE_KEY,
projectId: '25049'
projectId: '25049',
},
userOptions
)
}
module.exports = {
withAuth
withAuth,
}
@@ -13,7 +13,7 @@ async function run() {
// of the translations
const content = await oneSky.getMultilingualFile(
withAuth({
fileName: 'en-US.json'
fileName: 'en-US.json',
})
)
const json = JSON.parse(content)
@@ -62,13 +62,13 @@ function sanitize(input) {
// number of "replacement" tags.
allowedTags: ['b', 'strong', 'a', 'code', ...range(10)],
allowedAttributes: {
a: ['href', 'class']
a: ['href', 'class'],
},
textFilter(text) {
return text
.replace(/\{\{/, '&#123;&#123;')
.replace(/\}\}/, '&#125;&#125;')
}
},
})
}
@@ -34,7 +34,7 @@ const MAPPING = {
project_ownership_transfer_confirmation_1: ['user', 'project'],
you_introed_high_number: ['numberOfPeople'],
you_introed_small_number: ['numberOfPeople'],
click_here_to_view_sl_in_lng: ['lngName']
click_here_to_view_sl_in_lng: ['lngName'],
}
const { transformLocales } = require('./transformLocales')
@@ -15,7 +15,7 @@
*/
const MAPPING = {
also_provides_free_plan: ['registerLinkOpen', 'registerLinkClose'],
faq_pay_by_invoice_answer: ['payByInvoiceLinkOpen', 'payByInvoiceLinkClose']
faq_pay_by_invoice_answer: ['payByInvoiceLinkOpen', 'payByInvoiceLinkClose'],
}
const { transformLocales } = require('./transformLocales')
@@ -18,7 +18,7 @@ const LANGUAGES = [
'ru',
'sv',
'tr',
'zh-CN'
'zh-CN',
]
const LOCALES = {}
LANGUAGES.forEach(loadLocales)
@@ -45,5 +45,5 @@ function transformLocales(mapping, transformLocale) {
}
module.exports = {
transformLocales
transformLocales,
}
+1 -1
View File
@@ -13,7 +13,7 @@ async function uploadLocales() {
language: 'en-GB',
format: 'HIERARCHICAL_JSON',
content: await fs.readFile(`${__dirname}/../../locales/en.json`),
keepStrings: false // deprecate locales that no longer exist in en.json
keepStrings: false, // deprecate locales that no longer exist in en.json
})
)
return JSON.parse(blob).data.import.id
+2 -2
View File
@@ -44,7 +44,7 @@ async function checkCert(ukamfDB, providerId) {
const { body } = await V1Api.request({
json: true,
qs: { university_id: providerId },
uri: '/api/v1/sharelatex/university_saml'
uri: '/api/v1/sharelatex/university_saml',
})
// show notice if sso not currently enabled
if (body.sso_enabled === true) {
@@ -93,6 +93,6 @@ async function checkCert(ukamfDB, providerId) {
async function getActiveProviderIds() {
return db.users.distinct('samlIdentifiers.providerId', {
'samlIdentifiers.externalUserId': { $exists: true }
'samlIdentifiers.externalUserId': { $exists: true },
})
}
+2 -2
View File
@@ -22,7 +22,7 @@ class UKAMFEntity {
'ds:X509Data',
0,
'ds:X509Certificate',
0
0,
])
if (!cert) {
throw new Error('no cert')
@@ -42,7 +42,7 @@ class UKAMFEntity {
return {
cert,
entityId,
entryPoint
entryPoint,
}
}
}