diff --git a/README.md b/README.md index d1df27f..8c8ca85 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ const log = pino( { name: "probot", }, - getTransformStream() + getTransformStream(), ); ``` @@ -46,7 +46,7 @@ const log = pino( { name: "probot", }, - transform + transform, ); ``` diff --git a/bin/cli.js b/bin/cli.js index 6659097..32f4256 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; const pump = require("pump"); const split = require("split2"); diff --git a/index.js b/index.js index 9987cbe..27e1a5f 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; const { Transform } = require("node:stream"); @@ -48,7 +48,7 @@ function getTransformStream(options = {}) { "responseTime", ].join(","), errorProps: ["event", "status", "headers", "request", "sentryEventId"].join( - "," + ",", ), }); @@ -76,19 +76,19 @@ function getTransformStream(options = {}) { } withScope(function (scope) { - scope.setLevel(data.level === 50 ? 'error' : 'fatal'); + scope.setLevel(data.level === 50 ? "error" : "fatal"); if (data.event) { - scope.setExtra('event', data.event); + scope.setExtra("event", data.event); } if (data.headers) { - scope.setExtra('headers', data.headers); + scope.setExtra("headers", data.headers); } if (data.request) { - scope.setExtra('request', data.request); + scope.setExtra("request", data.request); } if (data.status) { - scope.setExtra('status', data.status); + scope.setExtra("status", data.status); } // set user id and username to installation ID and account login @@ -151,4 +151,4 @@ function toSentryError(data) { } module.exports = { getTransformStream }; -module.exports.default = module.exports; \ No newline at end of file +module.exports.default = module.exports; diff --git a/package-lock.json b/package-lock.json index c002e70..501f37b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ }, "devDependencies": { "pino": "^9.3.2", - "prettier": "^2.1.1", + "prettier": "^3.3.3", "tap": "^21.0.1" }, "engines": { @@ -4232,15 +4232,16 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, + "license": "MIT", "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" diff --git a/package.json b/package.json index 152872a..03e484e 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "repository": "github:probot/pino", "devDependencies": { "pino": "^9.3.2", - "prettier": "^2.1.1", + "prettier": "^3.3.3", "tap": "^21.0.1" }, "dependencies": { diff --git a/test/cli.test.js b/test/cli.test.js index 87698f3..787f55f 100644 --- a/test/cli.test.js +++ b/test/cli.test.js @@ -31,12 +31,12 @@ test("cli", (t) => { child.stdout.on("data", (data) => { t.equal( data.toString().replace(stripAnsiColorRE, ""), - `INFO (probot): hello future\n` + `INFO (probot): hello future\n`, ); }); child.stdin.write(logLine); t.teardown(() => child.kill()); - } + }, ); t.test("errors include event, status, headers, and request keys", (t) => { @@ -46,16 +46,16 @@ test("cli", (t) => { child.stdout.on("data", (data) => { t.match( data.toString().replace(stripAnsiColorRE, ""), - /event: "installation_repositories.added"/ + /event: "installation_repositories.added"/, ); t.match(data.toString().replace(stripAnsiColorRE, ""), /status: 500/); t.match( data.toString().replace(stripAnsiColorRE, ""), - /x-github-request-id: "789"/ + /x-github-request-id: "789"/, ); t.match( data.toString(), - /url: "https:\/\/api.github.com\/repos\/octocat\/hello-world\/"/ + /url: "https:\/\/api.github.com\/repos\/octocat\/hello-world\/"/, ); }); child.stdin.write(errorLine); @@ -84,7 +84,7 @@ test("cli", (t) => { child.stdout.on("data", (data) => { t.equal( data.toString().replace(stripAnsiColorRE, ""), - logLine.replace('"level":30', '"level":"info"') + logLine.replace('"level":30', '"level":"info"'), ); }); child.stdin.write(logLine); @@ -166,7 +166,7 @@ test("cli", (t) => { method: "GET" url: "https://api.github.com/repos/octocat/hello-world/" } - sentryEventId: 123` + sentryEventId: 123`, ); }); child.stdin.write(errorLine); @@ -209,7 +209,7 @@ test("cli", (t) => { child.stdout.on("data", (data) => { t.match( data.toString().replace(stripAnsiColorRE, ""), - /^FATAL \(probot\): Oh no!\n/ + /^FATAL \(probot\): Oh no!\n/, ); }); child.stdin.write(fatalErrorLine); diff --git a/test/index.test.js b/test/index.test.js index 44562dd..cf33d7f 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -38,7 +38,7 @@ test("API", (t) => { id: "456", }, }, - payload + payload, ), }; return error; @@ -104,7 +104,7 @@ test("API", (t) => { event({ installation: undefined, repository: { owner: { login: "owner" } }, - }) + }), ); }); }); @@ -152,13 +152,13 @@ test("API", (t) => { t.equal( output.join(""), output.join("").trim() + "\n", - 'No "\\n" is added to end of line' + 'No "\\n" is added to end of line', ); t.equal(JSON.parse(output).level, "info"); t.end(); - } + }, ); t.end();