Skip to content

Commit 2a9e121

Browse files
trentmPeterEinberger
authored andcommitted
fix: correct dev-deps required for the recent eslint@8 upgrade (elastic#3449)
The upgrade to eslint@8 in elastic#3409 subtly broke peer-dependencies. `npm ls` unhelpfully does not complain, but `npm ls -a` shows some errors, and `./dev-utils/make-distribution.sh` was broken. The upgrade bumped "eslint-config-standard" from ^14.1.1 to ^16. However, v16 has: "peerDependencies": { "eslint": "^7.12.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^4.2.1 || ^5.0.0" }, so is incompatible with eslint@8. We need eslint-config-standard@17, which has: "peerDependencies": { "eslint": "^8.0.1", "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", "eslint-plugin-promise": "^6.0.0" }, Also: - eslint-plugin-node (unmaintained) is replaced by "eslint-plugin-n" - eslint-config-standard@17 added https://eslint.org/docs/latest/rules/object-shorthand as a warning. It'll become "error" in a subsequent major. - eslint@8 means support for top-level await, so there are some files we no longer need to skip
1 parent 21a84bb commit 2a9e121

44 files changed

Lines changed: 273 additions & 181 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
"/test/types/transpile/index.js",
4242
"/test/types/transpile-default/index.js",
4343
"/test_output",
44-
"tmp",
45-
// These files use top-level await, which is *fine* for ESM files but, IIUC,
46-
// not supported by eslint until v8.
47-
"/test/instrumentation/modules/fixtures/use-fastify.mjs",
48-
"/test/instrumentation/modules/http/fixtures/use-dynamic-import.mjs"
44+
"tmp"
4945
]
5046
}

dev-utils/bitrot.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ const options = [
351351
]
352352

353353
function main (argv) {
354-
var parser = dashdash.createParser({ options: options })
354+
var parser = dashdash.createParser({ options })
355355
try {
356356
var opts = parser.parse(argv)
357357
} catch (e) {

lib/agent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ Agent.prototype.captureError = function (err, opts, cb) {
610610

611611
errors.createAPMError({
612612
log: agent.logger,
613-
id: id,
613+
id,
614614
exception: errIsError ? err : null,
615615
logMessage: errIsError ? null : err,
616616
shouldCaptureAttributes,

lib/http-request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ function main (argv) {
207207
const timeout = Number(argv[4])
208208

209209
var req = httpRequest(url, {
210-
timeout: timeout,
211-
connectTimeout: connectTimeout
210+
timeout,
211+
connectTimeout
212212
// TODO: log support
213213
}, function onRes (res) {
214214
res.pipe(process.stdout)

lib/instrumentation/dropped-spans-stats.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DroppedSpansStats {
6060
}
6161
},
6262
destination_service_resource: resource,
63-
outcome: outcome
63+
outcome
6464
}
6565
if (serviceTargetType) {
6666
stats.service_target_type = serviceTargetType

lib/instrumentation/http-shared.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ exports.instrumentRequest = function (agent, moduleName) {
9999
const tracestate = req.headers.tracestate
100100
const trans = agent.startTransaction(null, null, {
101101
childOf: traceparent,
102-
tracestate: tracestate
102+
tracestate
103103
})
104104
trans.type = 'request'
105105
trans.req = req
@@ -186,7 +186,7 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {
186186
const parentRunContext = ins.currRunContext()
187187
var span = ins.createSpan(null, 'external', 'http', { exitSpan: true })
188188
var id = span && span.transaction.id
189-
agent.logger.debug('intercepted call to %s.%s %o', moduleName, method, { id: id })
189+
agent.logger.debug('intercepted call to %s.%s %o', moduleName, method, { id })
190190

191191
// Reproduce the argument handling from node/lib/_http_client.js#ClientRequest().
192192
//
@@ -261,7 +261,7 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {
261261
var req = ins.withRunContext(spanRunContext, orig, this, ...newArgs)
262262

263263
var protocol = req.agent && req.agent.protocol
264-
agent.logger.debug('request details: %o', { protocol: protocol, host: getSafeHost(req), id: id })
264+
agent.logger.debug('request details: %o', { protocol, host: getSafeHost(req), id })
265265

266266
ins.bindEmitter(req)
267267

@@ -280,15 +280,15 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {
280280

281281
const url = getUrlFromRequestAndOptions(req, options, moduleName + ':')
282282
if (!url) {
283-
agent.logger.warn('unable to identify http.ClientRequest url %o', { id: id })
283+
agent.logger.warn('unable to identify http.ClientRequest url %o', { id })
284284
}
285285
let statusCode
286286
return req
287287

288288
// In case the request is ended prematurely
289289
function onAbort (type) {
290290
if (span.ended) return
291-
agent.logger.debug('intercepted http.ClientRequest abort event %o', { id: id })
291+
agent.logger.debug('intercepted http.ClientRequest abort event %o', { id })
292292

293293
onEnd()
294294
}
@@ -319,11 +319,11 @@ exports.traceOutgoingRequest = function (agent, moduleName, method) {
319319
}
320320

321321
function onResponse (res) {
322-
agent.logger.debug('intercepted http.ClientRequest response event %o', { id: id })
322+
agent.logger.debug('intercepted http.ClientRequest response event %o', { id })
323323
ins.bindEmitterToRunContext(parentRunContext, res)
324324
statusCode = res.statusCode
325325
res.prependListener('end', function () {
326-
agent.logger.debug('intercepted http.IncomingMessage end event %o', { id: id })
326+
agent.logger.debug('intercepted http.IncomingMessage end event %o', { id })
327327
onEnd()
328328
})
329329
}

lib/instrumentation/modules/@aws-sdk/client-s3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function s3MiddlewareFactory (client, agent) {
192192
context[elasticAPMStash] = {
193193
protocol: req.protocol,
194194
hostname: req.hostname,
195-
port: port
195+
port
196196
}
197197
return next(args)
198198
},

lib/instrumentation/modules/elasticsearch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = function (elasticsearch, agent, { enabled }) {
8181
var method = params && params.method
8282
var path = params && params.path
8383

84-
agent.logger.debug('intercepted call to elasticsearch.Transport.prototype.request %o', { id: id, method: method, path: path })
84+
agent.logger.debug('intercepted call to elasticsearch.Transport.prototype.request %o', { id, method, path })
8585

8686
if (span && method && path) {
8787
span.name = `Elasticsearch: ${method} ${path}`
@@ -145,7 +145,7 @@ module.exports = function (elasticsearch, agent, { enabled }) {
145145
shimmer.wrap(inspectedPromise, 'abort', function wrapAbort (originalAbort) {
146146
return function wrappedAbort () {
147147
if (span.ended) return
148-
agent.logger.debug('intercepted call to elasticsearch.Transport.request.abort %o', { id: id, method: method, path: path })
148+
agent.logger.debug('intercepted call to elasticsearch.Transport.request.abort %o', { id, method, path })
149149
const originalReturn = originalAbort.apply(this, args)
150150
span.end()
151151
return originalReturn
@@ -155,7 +155,7 @@ module.exports = function (elasticsearch, agent, { enabled }) {
155155
return inspectedPromise
156156
}
157157
} else {
158-
agent.logger.debug('could not instrument elasticsearch request %o', { id: id })
158+
agent.logger.debug('could not instrument elasticsearch request %o', { id })
159159
return original.apply(this, arguments)
160160
}
161161
}

lib/instrumentation/modules/generic-pool.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = function (generic, agent, { version }) {
1717
return function wrappedPool () {
1818
var trans = agent._instrumentation.currTransaction()
1919
var id = trans && trans.id
20-
agent.logger.debug('intercepted call to generic-pool.Pool %o', { id: id })
20+
agent.logger.debug('intercepted call to generic-pool.Pool %o', { id })
2121

2222
var pool
2323
if (this instanceof generic.Pool) {
@@ -32,7 +32,7 @@ module.exports = function (generic, agent, { version }) {
3232
return function wrappedAcquire () {
3333
var trans = agent._instrumentation.currTransaction()
3434
var id = trans && trans.id
35-
agent.logger.debug('intercepted call to pool.acquire %o', { id: id })
35+
agent.logger.debug('intercepted call to pool.acquire %o', { id })
3636

3737
var cb = arguments[0]
3838
if (typeof cb === 'function') {
@@ -59,7 +59,7 @@ module.exports = function (generic, agent, { version }) {
5959
return function wrappedEnqueue () {
6060
var trans = agent._instrumentation.currTransaction()
6161
var id = trans && trans.id
62-
agent.logger.debug('intercepted call to generic-pool.PriorityQueue.prototype.enqueue %o', { id: id })
62+
agent.logger.debug('intercepted call to generic-pool.PriorityQueue.prototype.enqueue %o', { id })
6363

6464
var obj = arguments[0]
6565
// Expect obj to of type Deferred

lib/instrumentation/modules/graphql.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,6 @@ module.exports = function (graphql, agent, { version, enabled }) {
202202
agent.logger.debug('unexpected document format - skipping graphql query extraction')
203203
}
204204

205-
return { queries: queries, operation: operation }
205+
return { queries, operation }
206206
}
207207
}

0 commit comments

Comments
 (0)