Skip to content

Commit

Permalink
perf: enable noAccumulatingSpread lint rule (#9996)
Browse files Browse the repository at this point in the history
Co-authored-by: Abhijeet Prasad <[email protected]>
  • Loading branch information
anonrig and AbhiPrasad committed Jan 3, 2024
1 parent 01116ee commit e23050b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
3 changes: 3 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
},
"nursery": {
"noUnusedImports": "error"
},
"performance": {
"noAccumulatingSpread": "error"
}
},
"ignore": [".vscode/*", "**/*.json"]
Expand Down
5 changes: 4 additions & 1 deletion packages/integrations/scripts/buildBundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ async function buildBundle(integration: string, jsVersion: string): Promise<void
if (runParallel) {
// We're building a bundle for each integration and each JavaScript version.
const tasks = getIntegrations().reduce(
(tasks, integration) => [...tasks, buildBundle(integration, 'es5'), buildBundle(integration, 'es6')],
(tasks, integration) => {
tasks.push(buildBundle(integration, 'es5'), buildBundle(integration, 'es6'));
return tasks;
},
[] as Promise<void>[],
);

Expand Down
8 changes: 4 additions & 4 deletions packages/utils/src/baggage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export function baggageHeaderToDynamicSamplingContext(
// Combine all baggage headers into one object containing the baggage values so we can later read the Sentry-DSC-values from it
baggageObject = baggageHeader.reduce<Record<string, string>>((acc, curr) => {
const currBaggageObject = baggageHeaderToObject(curr);
return {
...acc,
...currBaggageObject,
};
for (const key of Object.keys(currBaggageObject)) {
acc[key] = currBaggageObject[key];
}
return acc;
}, {});
} else {
// Return undefined if baggage header is an empty string (technically an empty baggage header is not spec conform but
Expand Down
15 changes: 8 additions & 7 deletions scripts/prepack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ if (newPkgJson[EXPORT_MAP_ENTRY_POINT]) {

if (newPkgJson[TYPES_VERSIONS_ENTRY_POINT]) {
Object.entries(newPkgJson[TYPES_VERSIONS_ENTRY_POINT]).forEach(([key, val]) => {
newPkgJson[TYPES_VERSIONS_ENTRY_POINT][key] = Object.entries(val).reduce((acc, [key, val]) => {
const newKey = key.replace(`${buildDir}/`, '');
return {
...acc,
[newKey]: val.map(v => v.replace(`${buildDir}/`, '')),
};
}, {});
newPkgJson[TYPES_VERSIONS_ENTRY_POINT][key] = Object.entries(val).reduce(
(acc, [key, val]) => {
const newKey = key.replace(`${buildDir}/`, '');
acc[newKey] = val.map(v => v.replace(`${buildDir}/`, ''));
return acc;
},
{} as Record<string, string[]>,
);
});
}

Expand Down

0 comments on commit e23050b

Please sign in to comment.