Skip to content

Commit 02bc102

Browse files
authored
chore: run linter (#168)
1 parent 43c3f0b commit 02bc102

File tree

4 files changed

+42
-48
lines changed

4 files changed

+42
-48
lines changed

system-test/busybench/src/busybench.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import {writeFile} from 'fs';
1818
// eslint-disable-next-line node/no-extraneous-import
1919
import * as pify from 'pify';
20-
// eslint-disable-next-line node/no-missing-import
20+
// eslint-disable-next-line node/no-extraneous-import
2121
import {encode, heap, SourceMapper, time} from 'pprof';
2222

2323
const writeFilePromise = pify(writeFile);

ts/src/profile-serializer.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -326,21 +326,22 @@ export function serializeHeapProfile(
326326
ignoreSamplesPath?: string,
327327
sourceMapper?: SourceMapper
328328
): perftools.profiles.IProfile {
329-
const appendHeapEntryToSamples: AppendEntryToSamples<AllocationProfileNode> = (
330-
entry: Entry<AllocationProfileNode>,
331-
samples: perftools.profiles.Sample[]
332-
) => {
333-
if (entry.node.allocations.length > 0) {
334-
for (const alloc of entry.node.allocations) {
335-
const sample = new perftools.profiles.Sample({
336-
locationId: entry.stack,
337-
value: [alloc.count, alloc.sizeBytes * alloc.count],
338-
// TODO: add tag for allocation size
339-
});
340-
samples.push(sample);
329+
const appendHeapEntryToSamples: AppendEntryToSamples<AllocationProfileNode> =
330+
(
331+
entry: Entry<AllocationProfileNode>,
332+
samples: perftools.profiles.Sample[]
333+
) => {
334+
if (entry.node.allocations.length > 0) {
335+
for (const alloc of entry.node.allocations) {
336+
const sample = new perftools.profiles.Sample({
337+
locationId: entry.stack,
338+
value: [alloc.count, alloc.sizeBytes * alloc.count],
339+
// TODO: add tag for allocation size
340+
});
341+
samples.push(sample);
342+
}
341343
}
342-
}
343-
};
344+
};
344345

345346
const stringTable = new StringTable();
346347
const sampleValueType = createObjectCountValueType(stringTable);

ts/src/sourcemapper/sourcemapper.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ async function processSourceMap(
8484
// TODO: Resolve the cast of `contents as any` (This is needed because the
8585
// type is expected to be of `RawSourceMap` but the existing
8686
// working code uses a string.)
87-
consumer = ((await new sourceMap.SourceMapConsumer(
88-
(contents as {}) as sourceMap.RawSourceMap
89-
)) as {}) as sourceMap.RawSourceMap;
87+
consumer = (await new sourceMap.SourceMapConsumer(
88+
contents as {} as sourceMap.RawSourceMap
89+
)) as {} as sourceMap.RawSourceMap;
9090
} catch (e) {
9191
throw new Error(
9292
'An error occurred while reading the ' +
@@ -206,7 +206,8 @@ export class SourceMapper {
206206
const generatedPos = {line: location.line, column: location.column};
207207

208208
// TODO: Determine how to remove the explicit cast here.
209-
const consumer: sourceMap.SourceMapConsumer = (entry.mapConsumer as {}) as sourceMap.SourceMapConsumer;
209+
const consumer: sourceMap.SourceMapConsumer =
210+
entry.mapConsumer as {} as sourceMap.SourceMapConsumer;
210211

211212
const pos = consumer.originalPositionFor(generatedPos);
212213
if (pos.source === null) {

ts/test/profiles-for-tests.ts

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ export const timeProfile: perftools.profiles.IProfile = Object.freeze({
183183

184184
// timeProfile is encoded then decoded to convert numbers to longs, in
185185
// decodedTimeProfile
186-
const encodedTimeProfile = perftools.profiles.Profile.encode(
187-
timeProfile
188-
).finish();
186+
const encodedTimeProfile =
187+
perftools.profiles.Profile.encode(timeProfile).finish();
189188
export const decodedTimeProfile = Object.freeze(
190189
perftools.profiles.Profile.decode(encodedTimeProfile)
191190
);
@@ -340,9 +339,8 @@ export const heapProfile: perftools.profiles.IProfile = Object.freeze({
340339

341340
// heapProfile is encoded then decoded to convert numbers to longs, in
342341
// decodedHeapProfile
343-
const encodedHeapProfile = perftools.profiles.Profile.encode(
344-
heapProfile
345-
).finish();
342+
const encodedHeapProfile =
343+
perftools.profiles.Profile.encode(heapProfile).finish();
346344
export const decodedHeapProfile = Object.freeze(
347345
perftools.profiles.Profile.decode(encodedHeapProfile)
348346
);
@@ -396,8 +394,8 @@ const heapLocationsWithExternal = [
396394
new perftools.profiles.Location({line: [heapLinesWithExternal[4]], id: 5}),
397395
];
398396

399-
export const heapProfileWithExternal: perftools.profiles.IProfile = Object.freeze(
400-
{
397+
export const heapProfileWithExternal: perftools.profiles.IProfile =
398+
Object.freeze({
401399
sampleType: [
402400
new perftools.profiles.ValueType({type: 1, unit: 2}),
403401
new perftools.profiles.ValueType({type: 3, unit: 4}),
@@ -452,14 +450,12 @@ export const heapProfileWithExternal: perftools.profiles.IProfile = Object.freez
452450
timeNanos: 0,
453451
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
454452
period: 524288,
455-
}
456-
);
453+
});
457454

458455
// heapProfile is encoded then decoded to convert numbers to longs, in
459456
// decodedHeapProfile
460-
const encodedHeapProfileWithExternal = perftools.profiles.Profile.encode(
461-
heapProfile
462-
).finish();
457+
const encodedHeapProfileWithExternal =
458+
perftools.profiles.Profile.encode(heapProfile).finish();
463459
export const decodedHeapProfileWithExternal = Object.freeze(
464460
perftools.profiles.Profile.decode(encodedHeapProfileWithExternal)
465461
);
@@ -501,8 +497,8 @@ const anonymousFunctionHeapLocations = [
501497
}),
502498
];
503499

504-
export const anonymousFunctionHeapProfile: perftools.profiles.IProfile = Object.freeze(
505-
{
500+
export const anonymousFunctionHeapProfile: perftools.profiles.IProfile =
501+
Object.freeze({
506502
sampleType: [
507503
new perftools.profiles.ValueType({type: 1, unit: 2}),
508504
new perftools.profiles.ValueType({type: 3, unit: 4}),
@@ -528,8 +524,7 @@ export const anonymousFunctionHeapProfile: perftools.profiles.IProfile = Object.
528524
timeNanos: 0,
529525
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
530526
period: 524288,
531-
}
532-
);
527+
});
533528

534529
const anonymousFunctionTimeNode = {
535530
scriptName: 'main',
@@ -574,8 +569,8 @@ const anonymousFunctionTimeLocations = [
574569
}),
575570
];
576571

577-
export const anonymousFunctionTimeProfile: perftools.profiles.IProfile = Object.freeze(
578-
{
572+
export const anonymousFunctionTimeProfile: perftools.profiles.IProfile =
573+
Object.freeze({
579574
sampleType: [
580575
new perftools.profiles.ValueType({type: 1, unit: 2}),
581576
new perftools.profiles.ValueType({type: 3, unit: 4}),
@@ -602,8 +597,7 @@ export const anonymousFunctionTimeProfile: perftools.profiles.IProfile = Object.
602597
durationNanos: 10 * 1000 * 1000 * 1000,
603598
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
604599
period: 1000,
605-
}
606-
);
600+
});
607601

608602
const heapWithPathLeaf1 = {
609603
name: 'foo2',
@@ -721,8 +715,8 @@ const heapIncludePathLocations = [
721715
}),
722716
];
723717

724-
export const heapProfileIncludePath: perftools.profiles.IProfile = Object.freeze(
725-
{
718+
export const heapProfileIncludePath: perftools.profiles.IProfile =
719+
Object.freeze({
726720
sampleType: [
727721
new perftools.profiles.ValueType({type: 1, unit: 2}),
728722
new perftools.profiles.ValueType({type: 3, unit: 4}),
@@ -764,8 +758,7 @@ export const heapProfileIncludePath: perftools.profiles.IProfile = Object.freeze
764758
timeNanos: 0,
765759
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
766760
period: 524288,
767-
}
768-
);
761+
});
769762

770763
// heapProfile is encoded then decoded to convert numbers to longs, in
771764
// decodedHeapProfile
@@ -802,8 +795,8 @@ const heapExcludePathLocations = [
802795
}),
803796
];
804797

805-
export const heapProfileExcludePath: perftools.profiles.IProfile = Object.freeze(
806-
{
798+
export const heapProfileExcludePath: perftools.profiles.IProfile =
799+
Object.freeze({
807800
sampleType: [
808801
new perftools.profiles.ValueType({type: 1, unit: 2}),
809802
new perftools.profiles.ValueType({type: 3, unit: 4}),
@@ -830,8 +823,7 @@ export const heapProfileExcludePath: perftools.profiles.IProfile = Object.freeze
830823
timeNanos: 0,
831824
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
832825
period: 524288,
833-
}
834-
);
826+
});
835827

836828
// heapProfile is encoded then decoded to convert numbers to longs, in
837829
// decodedHeapProfile

0 commit comments

Comments
 (0)