mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
[monorepo] turn throw statements in callback code into callback calls (#33524)
* [eslint-plugin] add rule for throw inside callback code * [monorepo] enable our custom eslint plugins globally * [monorepo] fix running make lint from root * [monorepo] turn throw statements in callback code into callback calls * [monorepo] add eslint-plugin libraries to all the Dockerfiles * [monorepo] install eslint-plugin library at the root level * [linked-url-proxy] add eslint-plugin library into Dockerfile * [latexqc] add our eslint-plugin to eslint config GitOrigin-RevId: b05e3ebbefb62370f2422e83880dd3913815270d
This commit is contained in:
@@ -19,6 +19,7 @@ RUN mkdir /home/node/.config && chown node:node /home/node/.config
|
||||
FROM base AS app
|
||||
|
||||
COPY package.json yarn.lock .yarnrc.yml /overleaf/
|
||||
COPY libraries/eslint-plugin/package.json /overleaf/libraries/eslint-plugin/package.json
|
||||
COPY libraries/fetch-utils/package.json /overleaf/libraries/fetch-utils/package.json
|
||||
COPY libraries/logger/package.json /overleaf/libraries/logger/package.json
|
||||
COPY libraries/metrics/package.json /overleaf/libraries/metrics/package.json
|
||||
@@ -35,6 +36,7 @@ COPY .yarn/patches/ /overleaf/.yarn/patches/
|
||||
COPY tools/migrations/ /overleaf/tools/migrations/
|
||||
|
||||
RUN cd /overleaf && yarn workspaces focus @overleaf/document-updater overleaf
|
||||
COPY libraries/eslint-plugin/ /overleaf/libraries/eslint-plugin/
|
||||
COPY libraries/fetch-utils/ /overleaf/libraries/fetch-utils/
|
||||
COPY libraries/logger/ /overleaf/libraries/logger/
|
||||
COPY libraries/metrics/ /overleaf/libraries/metrics/
|
||||
|
||||
@@ -16,6 +16,7 @@ IMAGE_REPO_FINAL ?= $(IMAGE_REPO):$(BRANCH_NAME_TAG_SAFE)-$(BUILD_NUMBER)
|
||||
IMAGE_CACHE ?= $(IMAGE_REPO):cache-$(shell cat \
|
||||
$(MONOREPO)/package.json \
|
||||
$(MONOREPO)/yarn.lock \
|
||||
$(MONOREPO)/libraries/eslint-plugin/package.json \
|
||||
$(MONOREPO)/libraries/fetch-utils/package.json \
|
||||
$(MONOREPO)/libraries/logger/package.json \
|
||||
$(MONOREPO)/libraries/metrics/package.json \
|
||||
|
||||
@@ -631,14 +631,14 @@ module.exports = Model = function (db, options) {
|
||||
// after.
|
||||
this.getOps = getOps = function (docName, start, end, callback) {
|
||||
// getOps will only use the op cache if its there. It won't fill the op cache in.
|
||||
if (!(start >= 0)) {
|
||||
throw new Error('start must be 0+')
|
||||
}
|
||||
|
||||
if (typeof end === 'function') {
|
||||
;[end, callback] = Array.from([null, end])
|
||||
}
|
||||
|
||||
if (!(start >= 0)) {
|
||||
return callback(new Error('start must be 0+'))
|
||||
}
|
||||
|
||||
const ops = docs[docName] != null ? docs[docName].ops : undefined
|
||||
|
||||
if (ops) {
|
||||
|
||||
@@ -158,7 +158,7 @@ json.api = {
|
||||
op.od = elem[key]
|
||||
}
|
||||
} else {
|
||||
throw new Error('bad path')
|
||||
return cb(new Error('bad path'))
|
||||
}
|
||||
return this.submitOp([op], cb)
|
||||
},
|
||||
@@ -166,7 +166,7 @@ json.api = {
|
||||
removeAt(path, cb) {
|
||||
const { elem, key } = traverse(this.snapshot, path)
|
||||
if (typeof elem[key] === 'undefined') {
|
||||
throw new Error('no element at that path')
|
||||
return cb(new Error('no element at that path'))
|
||||
}
|
||||
const op = { p: path }
|
||||
if (elem.constructor === Array) {
|
||||
@@ -174,7 +174,7 @@ json.api = {
|
||||
} else if (typeof elem === 'object') {
|
||||
op.od = elem[key]
|
||||
} else {
|
||||
throw new Error('bad path')
|
||||
return cb(new Error('bad path'))
|
||||
}
|
||||
return this.submitOp([op], cb)
|
||||
},
|
||||
|
||||
@@ -618,14 +618,14 @@ module.exports = Model = function (db, options) {
|
||||
// after.
|
||||
this.getOps = getOps = function (docName, start, end, callback) {
|
||||
// getOps will only use the op cache if its there. It won't fill the op cache in.
|
||||
if (!(start >= 0)) {
|
||||
throw new Error('start must be 0+')
|
||||
}
|
||||
|
||||
if (typeof end === 'function') {
|
||||
;[end, callback] = Array.from([null, end])
|
||||
}
|
||||
|
||||
if (!(start >= 0)) {
|
||||
return callback(new Error('start must be 0+'))
|
||||
}
|
||||
|
||||
const ops = docs[docName] != null ? docs[docName].ops : undefined
|
||||
|
||||
if (ops) {
|
||||
|
||||
Reference in New Issue
Block a user