Skip to content

Commit ccf3153

Browse files
committed
stop using object.assign
1 parent 7977442 commit ccf3153

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

packages/core/src/integration.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {
22
Client,
33
Event,
44
EventHint,
5+
EventProcessor,
56
Integration,
67
IntegrationClass,
78
IntegrationFn,
@@ -148,9 +149,9 @@ export function setupIntegration(client: Client, integration: Integration, integ
148149
if (client.addEventProcessor && typeof integration.processEvent === 'function') {
149150
const callback = integration.processEvent.bind(integration) as typeof integration.processEvent;
150151

151-
const processor = Object.assign((event: Event, hint: EventHint) => callback(event, hint, client), {
152-
id: integration.name,
153-
});
152+
const processor: EventProcessor = (event: Event, hint: EventHint): ReturnType<typeof callback> =>
153+
callback(event, hint, client);
154+
processor.id = integration.name;
154155

155156
client.addEventProcessor(processor);
156157
}
@@ -191,12 +192,11 @@ export function convertIntegrationFnToClass<Fn extends IntegrationFn>(
191192
name: string,
192193
fn: Fn,
193194
): IntegrationClass<Integration> {
194-
return Object.assign(
195-
function ConvertedIntegration(...args: Parameters<Fn>): Integration {
196-
return fn(...args);
197-
},
198-
{ id: name },
199-
) as unknown as IntegrationClass<Integration>;
195+
const ConvertedIntegration = function ConvertedIntegration(...args: Parameters<Fn>): Integration {
196+
return fn(...args);
197+
};
198+
ConvertedIntegration.id = name;
199+
return ConvertedIntegration as unknown as IntegrationClass<Integration>;
200200
}
201201

202202
/**

packages/eslint-plugin-sdk/src/rules/no-unsupported-es6-methods.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ module.exports = {
2020
const functionName = node.callee.property.name;
2121

2222
const es6ArrayFunctions = ['copyWithin', 'values', 'fill'];
23+
const es6ObjectFunctions = ['assign'];
2324
const es6StringFunctions = ['repeat'];
2425

25-
const es6Functions = [].concat(es6ArrayFunctions, es6StringFunctions);
26+
const es6Functions = [].concat(es6ArrayFunctions, es6StringFunctions, es6ObjectFunctions);
2627
if (es6Functions.indexOf(functionName) > -1) {
2728
context.report({
2829
node: node.callee.property,

packages/tracing-internal/src/browser/web-vitals/lib/observe.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,11 @@ export const observe = <K extends keyof PerformanceEntryMap>(
4949
const po = new PerformanceObserver(list => {
5050
callback(list.getEntries() as PerformanceEntryMap[K]);
5151
});
52-
po.observe(
53-
Object.assign(
54-
{
55-
type,
56-
buffered: true,
57-
},
58-
opts || {},
59-
) as PerformanceObserverInit,
60-
);
52+
po.observe({
53+
type,
54+
buffered: true,
55+
...opts,
56+
} as PerformanceObserverInit);
6157
return po;
6258
}
6359
} catch (e) {

0 commit comments

Comments
 (0)