Skip to content

Commit

Permalink
upgrade prettier and fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak committed Aug 30, 2024
1 parent a5fc21b commit 0162239
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const log = pino(
{
name: "probot",
},
getTransformStream()
getTransformStream(),
);
```

Expand All @@ -46,7 +46,7 @@ const log = pino(
{
name: "probot",
},
transform
transform,
);
```

Expand Down
2 changes: 1 addition & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
"use strict";

const pump = require("pump");
const split = require("split2");
Expand Down
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
"use strict";

const { Transform } = require("node:stream");

Expand Down Expand Up @@ -48,7 +48,7 @@ function getTransformStream(options = {}) {
"responseTime",
].join(","),
errorProps: ["event", "status", "headers", "request", "sentryEventId"].join(
","
",",
),
});

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -151,4 +151,4 @@ function toSentryError(data) {
}

module.exports = { getTransformStream };
module.exports.default = module.exports;
module.exports.default = module.exports;
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
16 changes: 8 additions & 8 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test("API", (t) => {
id: "456",
},
},
payload
payload,
),
};
return error;
Expand Down Expand Up @@ -104,7 +104,7 @@ test("API", (t) => {
event({
installation: undefined,
repository: { owner: { login: "owner" } },
})
}),
);
});
});
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0162239

Please sign in to comment.