Skip to content

Commit aa9e709

Browse files
committed
Fix linter issues
1 parent 3540666 commit aa9e709

File tree

2 files changed

+14
-29
lines changed

2 files changed

+14
-29
lines changed

packages/react-router/src/server/sdk.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ export function init(options: NodeOptions): NodeClient | undefined {
2626
return client;
2727
}
2828

29-
const matchedRegexes = [
30-
/GET \/node_modules\//,
31-
/GET \/favicon\.ico/,
32-
/GET \/@id\//,
33-
];
29+
const matchedRegexes = [/GET \/node_modules\//, /GET \/favicon\.ico/, /GET \/@id\//];
3430

3531
/**
3632
* Filters out noisy transactions such as requests to node_modules, favicon.ico, @id/
@@ -41,14 +37,12 @@ const matchedRegexes = [
4137
export function lowQualityTransactionsFilter(options: NodeOptions): EventProcessor {
4238
return Object.assign(
4339
(event => {
44-
4540
if (event.type !== 'transaction' || !event.transaction) {
4641
return event;
4742
}
4843

4944
if (matchedRegexes.some(regex => event.transaction?.match(regex))) {
50-
options.debug &&
51-
logger.log('[ReactRouter] Filtered node_modules transaction:', event.transaction);
45+
options.debug && logger.log('[ReactRouter] Filtered node_modules transaction:', event.transaction);
5246
return null;
5347
}
5448

packages/react-router/test/server/sdk.test.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -80,34 +80,25 @@ describe('React Router server SDK', () => {
8080
});
8181

8282
describe('filters out low quality transactions', () => {
83-
it.each([
84-
'GET /node_modules/react/index.js',
85-
'GET /favicon.ico',
86-
'GET /@id/package',
87-
])('%s', async (transaction) => {
88-
client.captureEvent({ type: 'transaction', transaction });
83+
it.each(['GET /node_modules/react/index.js', 'GET /favicon.ico', 'GET /@id/package'])(
84+
'%s',
85+
async transaction => {
86+
client.captureEvent({ type: 'transaction', transaction });
8987

90-
await client.flush();
88+
await client.flush();
9189

92-
expect(beforeSendEvent).not.toHaveBeenCalled();
93-
});
90+
expect(beforeSendEvent).not.toHaveBeenCalled();
91+
},
92+
);
9493
});
9594

9695
describe('allows high quality transactions', () => {
97-
it.each([
98-
'GET /',
99-
'GET /users',
100-
'POST /api/data',
101-
'GET /projects/123',
102-
])('%s', async (transaction) => {
96+
it.each(['GET /', 'GET /users', 'POST /api/data', 'GET /projects/123'])('%s', async transaction => {
10397
client.captureEvent({ type: 'transaction', transaction });
10498

10599
await client.flush();
106100

107-
expect(beforeSendEvent).toHaveBeenCalledWith(
108-
expect.objectContaining({ transaction }),
109-
expect.any(Object)
110-
);
101+
expect(beforeSendEvent).toHaveBeenCalledWith(expect.objectContaining({ transaction }), expect.any(Object));
111102
});
112103
});
113104
});
@@ -118,7 +109,7 @@ describe('React Router server SDK', () => {
118109
it.each([
119110
['node_modules request', 'GET /node_modules/react/index.js'],
120111
['favicon.ico request', 'GET /favicon.ico'],
121-
['@id request', 'GET /@id/package']
112+
['@id request', 'GET /@id/package'],
122113
])('%s', (description, transaction) => {
123114
const filter = lowQualityTransactionsFilter({});
124115
const event = {
@@ -134,7 +125,7 @@ describe('React Router server SDK', () => {
134125
it.each([
135126
['normal page request', 'GET /users'],
136127
['API request', 'POST /api/users'],
137-
['app route', 'GET /projects/123']
128+
['app route', 'GET /projects/123'],
138129
])('%s', (description, transaction) => {
139130
const filter = lowQualityTransactionsFilter({});
140131
const event = {

0 commit comments

Comments
 (0)