Skip to content

Commit 67169cb

Browse files
committed
chore: fix code style
1 parent 4056324 commit 67169cb

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

plugins/node/opentelemetry-koa-instrumentation/src/koa.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626
} from './types';
2727
import { VERSION } from './version';
2828
import { getMiddlewareMetadata } from './utils';
29-
import Router = require('@koa/router');
3029

3130
/** Koa instrumentation for OpenTelemetry */
3231
export class KoaInstrumentation extends BasePlugin<typeof koa> {
@@ -101,8 +100,7 @@ export class KoaInstrumentation extends BasePlugin<typeof koa> {
101100
const router = dispatchLayer.router;
102101

103102
const routesStack = router?.stack ?? [];
104-
for (let i = 0; i < routesStack.length; i++) {
105-
const pathLayer: Router.Layer = routesStack[i];
103+
for (const pathLayer of routesStack) {
106104
const path = pathLayer.path;
107105
const pathStack = pathLayer.stack;
108106
for (let j = 0; j < pathStack.length; j++) {

plugins/node/opentelemetry-koa-instrumentation/test/koa-router.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ describe('Koa Instrumentation - Router Tests', () => {
8080

8181
const router = new KoaRouter();
8282
router.get('/post/:id', ctx => {
83-
const id = ctx.params.id;
84-
ctx.body = 'Post id: ' + id;
83+
ctx.body = `Post id: ${ctx.params.id}`;
8584
});
8685

8786
app.use(router.routes());

0 commit comments

Comments
 (0)