mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-09 22:45:49 +00:00
Merge pull request #5344 from overleaf/jpa-no-callback-literal
[web] fix eslint violations for node/no-callback-literal GitOrigin-RevId: 8d6bb1398b3db2794bf1b2f97cd6d2886f2b4b0a
This commit is contained in:
parent
cc8faa0535
commit
12890edd14
5 changed files with 14 additions and 11 deletions
|
@ -22,7 +22,6 @@
|
|||
// do not allow importing of implicit dependencies.
|
||||
"import/no-extraneous-dependencies": "error",
|
||||
|
||||
"node/no-callback-literal": "off",
|
||||
"node/no-deprecated-api": "off"
|
||||
},
|
||||
"overrides": [
|
||||
|
|
|
@ -190,7 +190,8 @@ module.exports = ExportsHandler = self = {
|
|||
`v1 export returned failure; forwarding: ${body}`
|
||||
)
|
||||
// pass the v1 error along for the publish modal to handle
|
||||
return callback({ forwardResponse: body })
|
||||
const err = { forwardResponse: body }
|
||||
return callback(err)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -61,10 +61,12 @@ const UserMembershipHandler = {
|
|||
return callback(error)
|
||||
}
|
||||
if (!user) {
|
||||
return callback({ userNotFound: true })
|
||||
const err = { userNotFound: true }
|
||||
return callback(err)
|
||||
}
|
||||
if (entity[attribute].some(managerId => managerId.equals(user._id))) {
|
||||
return callback({ alreadyAdded: true })
|
||||
error = { alreadyAdded: true }
|
||||
return callback(error)
|
||||
}
|
||||
|
||||
return addUserToEntity(entity, attribute, user, error =>
|
||||
|
@ -79,7 +81,8 @@ const UserMembershipHandler = {
|
|||
}
|
||||
const attribute = entityConfig.fields.write
|
||||
if (entity.admin_id != null ? entity.admin_id.equals(userId) : undefined) {
|
||||
return callback({ isAdmin: true })
|
||||
const error = { isAdmin: true }
|
||||
return callback(error)
|
||||
}
|
||||
return removeUserFromEntity(entity, attribute, userId, callback)
|
||||
},
|
||||
|
|
|
@ -59,10 +59,10 @@ export default App.factory('queuedHttp', function ($http, $q) {
|
|||
const doRequest = () =>
|
||||
$http(...Array.from(args || []))
|
||||
.then((...args) =>
|
||||
Array.from(successCallbacks).map(cb => cb(...Array.from(args || [])))
|
||||
Array.from(successCallbacks).map(fn => fn(...Array.from(args || [])))
|
||||
)
|
||||
.catch((...args) =>
|
||||
Array.from(errorCallbacks).map(cb => cb(...Array.from(args || [])))
|
||||
Array.from(errorCallbacks).map(fn => fn(...Array.from(args || [])))
|
||||
)
|
||||
|
||||
pendingRequests.push(doRequest)
|
||||
|
|
|
@ -21,9 +21,9 @@ describe('FileStoreHandler', function () {
|
|||
}
|
||||
this.writeStream = {
|
||||
my: 'writeStream',
|
||||
on(type, cb) {
|
||||
on(type, fn) {
|
||||
if (type === 'response') {
|
||||
cb({ statusCode: 200 })
|
||||
fn({ statusCode: 200 })
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -200,9 +200,9 @@ describe('FileStoreHandler', function () {
|
|||
|
||||
describe('when upload fails', function () {
|
||||
beforeEach(function () {
|
||||
this.writeStream.on = function (type, cb) {
|
||||
this.writeStream.on = function (type, fn) {
|
||||
if (type === 'response') {
|
||||
cb({ statusCode: 500 })
|
||||
fn({ statusCode: 500 })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue