Skip to content

Commit dc690d0

Browse files
committed
Fix linter issues.
1 parent 050d8dd commit dc690d0

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

packages/tracing/src/integrations/node/prisma.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ type PrismaAction =
2222
| 'runCommandRaw';
2323

2424
interface PrismaMiddlewareParams {
25-
model?: any;
25+
model?: unknown;
2626
action: PrismaAction;
27-
args: any;
27+
args: unknown;
2828
dataPath: string[];
2929
runInTransaction: boolean;
3030
}
3131

32-
type PrismaMiddleware<T = any> = (
32+
type PrismaMiddleware<T = unknown> = (
3333
params: PrismaMiddlewareParams,
3434
next: (params: PrismaMiddlewareParams) => Promise<T>,
3535
) => Promise<T>;

packages/tracing/test/integrations/node/prisma.test.ts

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/unbound-method */
12
import { Hub, Scope } from '@sentry/hub';
23

34
import { Prisma } from '../../../src/integrations/node/prisma';
@@ -6,30 +7,30 @@ import { Span } from '../../../src/span';
67
type PrismaMiddleware = (params: unknown, next: (params?: unknown) => Promise<unknown>) => Promise<unknown>;
78

89
class PrismaClient {
10+
public user: { create: () => Promise<unknown> } = {
11+
create: () => this._middleware?.({ action: 'create', model: 'user' }, () => Promise.resolve('result')),
12+
};
13+
14+
private _middleware?: PrismaMiddleware;
15+
916
constructor() {
10-
this.middleware = undefined;
17+
this._middleware = undefined;
1118
}
1219

13-
private middleware?: PrismaMiddleware;
14-
1520
public $use(cb: PrismaMiddleware) {
16-
this.middleware = cb;
21+
this._middleware = cb;
1722
}
18-
19-
public user = {
20-
create: () => this.middleware?.({ action: 'create', model: 'user' }, () => Promise.resolve('result')),
21-
};
2223
}
2324

24-
describe('setupOnce', () => {
25+
describe('setupOnce', function () {
2526
const Client: PrismaClient = new PrismaClient();
2627

2728
let scope = new Scope();
2829
let parentSpan: Span;
2930
let childSpan: Span;
3031

3132
beforeAll(() => {
32-
// @ts-ignore
33+
// @ts-ignore, not to export PrismaClient types from integration source
3334
new Prisma({ client: Client }).setupOnce(
3435
() => undefined,
3536
() => new Hub(undefined, scope),
@@ -45,8 +46,8 @@ describe('setupOnce', () => {
4546
jest.spyOn(childSpan, 'finish');
4647
});
4748

48-
it(`should add middleware with $use method correctly`, done => {
49-
Client.user.create()?.then(res => {
49+
it('should add middleware with $use method correctly', done => {
50+
void Client.user.create()?.then(res => {
5051
expect(res).toBe('result');
5152
expect(scope.getSpan).toBeCalled();
5253
expect(parentSpan.startChild).toBeCalledWith({

0 commit comments

Comments
 (0)