Skip to content

Commit eec7bfd

Browse files
committed
Linting fixes
1 parent 4363de0 commit eec7bfd

31 files changed

Lines changed: 1270 additions & 1071 deletions

devtools/common/settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export default class Settings {
99
const setting = this._moduleSettings.get(settingName)
1010
if (!setting) {
1111
return {
12-
get: (): null => null
12+
get: (): null => null,
1313
}
1414
}
1515
return setting
1616
}
1717

18-
public get (): boolean {
18+
public get(): boolean {
1919
return true
2020
}
2121
}

devtools/cpuProfileDataModel/cpuProfileNode.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default class CPUProfileNode extends ProfileNode {
66
* @param {!Protocol.Profiler.ProfileNode} node
77
* @param {number} sampleTime
88
*/
9-
public constructor (node: ProfileNode, sampleTime: number) {
9+
public constructor(node: ProfileNode, sampleTime: number) {
1010
/**
1111
* Backward compatibility for old SamplingHeapProfileNode format.
1212
*/
@@ -15,7 +15,7 @@ export default class CPUProfileNode extends ProfileNode {
1515
scriptId: node.scriptId,
1616
url: node.url,
1717
lineNumber: node.lineNumber - 1,
18-
columnNumber: node.columnNumber - 1
18+
columnNumber: node.columnNumber - 1,
1919
}
2020

2121
const callFrame = node.callFrame || nodeCallFrame
@@ -28,6 +28,7 @@ export default class CPUProfileNode extends ProfileNode {
2828
/**
2929
* Compatibility: legacy backends could provide "no reason" for optimized functions.
3030
*/
31-
this.deoptReason = node.deoptReason && node.deoptReason !== 'no reason' ? node.deoptReason : null
31+
this.deoptReason =
32+
node.deoptReason && node.deoptReason !== 'no reason' ? node.deoptReason : null
3233
}
3334
}

devtools/cpuProfileDataModel/index.ts

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
2323
/**
2424
* @param {!Protocol.Profiler.Profile} profile
2525
*/
26-
public constructor (profile: Profile) {
26+
public constructor(profile: Profile) {
2727
super()
2828
const isLegacyFormat = !!profile['head']
2929

@@ -58,18 +58,18 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
5858
/**
5959
* @param {!Protocol.Profiler.Profile} profile
6060
*/
61-
private _compatibilityConversionHeadToNodes (profile: Profile): void {
61+
private _compatibilityConversionHeadToNodes(profile: Profile): void {
6262
/** @type {!Array<!Protocol.Profiler.ProfileNode>} */
6363
const nodes: ProfileNode[] = []
6464

6565
/**
6666
* @param {!Protocol.Profiler.ProfileNode} node
6767
* @return {number}
6868
*/
69-
function convertNodesTree (node: ProfileNode): number {
70-
nodes.push(node);
69+
function convertNodesTree(node: ProfileNode): number {
70+
nodes.push(node)
7171
// TODO(Christian) fix typings
72-
(node.children as unknown as number[]) = node.children.map(convertNodesTree)
72+
;(node.children as unknown as number[]) = node.children.map(convertNodesTree)
7373
return node.id
7474
}
7575

@@ -86,7 +86,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
8686
* @param {!Protocol.Profiler.Profile} profile
8787
* @return {?Array<number>}
8888
*/
89-
private _convertTimeDeltas (profile: Profile): number[] {
89+
private _convertTimeDeltas(profile: Profile): number[] {
9090
if (!profile.timeDeltas) {
9191
return null
9292
}
@@ -106,14 +106,14 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
106106
* @param {!Array<!Protocol.Profiler.ProfileNode>} nodes
107107
* @return {!CPUProfileNode}
108108
*/
109-
private _translateProfileTree (nodes: ProfileNode[]): CPUProfileNode {
109+
private _translateProfileTree(nodes: ProfileNode[]): CPUProfileNode {
110110
/** @type {!Map<number, !Protocol.Profiler.ProfileNode>} */
111111
const nodeByIdMap: Map<number, ProfileNode> = new Map()
112112

113113
/**
114114
* @param {!Array<!Protocol.Profiler.ProfileNode>} nodes
115115
*/
116-
function buildChildrenFromParents (nodes: ProfileNode[]): void {
116+
function buildChildrenFromParents(nodes: ProfileNode[]): void {
117117
if (nodes[0].children) {
118118
return
119119
}
@@ -122,12 +122,12 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
122122
for (let i = 1; i < nodes.length; ++i) {
123123
const node = nodes[i]
124124
// TODO(Christian) fix typings
125-
const parentNode = nodeByIdMap.get((node.parent as unknown as number))
125+
const parentNode = nodeByIdMap.get(node.parent as unknown as number)
126126
// TODO(Christian) fix typings
127127
if (parentNode.children) {
128-
(parentNode.children as unknown as number[]).push(node.id)
128+
;(parentNode.children as unknown as number[]).push(node.id)
129129
} else {
130-
(parentNode.children as unknown as number[]) = [node.id]
130+
;(parentNode.children as unknown as number[]) = [node.id]
131131
}
132132
}
133133
}
@@ -136,15 +136,18 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
136136
* @param {!Array<!Protocol.Profiler.ProfileNode>} nodes
137137
* @param {!Array<number>|undefined} samples
138138
*/
139-
function buildHitCountFromSamples (nodes: ProfileNode[], samples?: number[]): void {
139+
function buildHitCountFromSamples(nodes: ProfileNode[], samples?: number[]): void {
140140
/**
141141
* hitCount not defined in ProfileNode model
142142
*/
143-
if (typeof(nodes[0].hitCount) === 'number') {
143+
if (typeof nodes[0].hitCount === 'number') {
144144
return
145145
}
146146

147-
console.assert(Boolean(samples), 'Error: Neither hitCount nor samples are present in profile.')
147+
console.assert(
148+
Boolean(samples),
149+
'Error: Neither hitCount nor samples are present in profile.'
150+
)
148151
for (let i = 0; i < nodes.length; ++i) {
149152
nodes[i].hitCount = 0
150153
}
@@ -170,7 +173,9 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
170173
const parentNodeStack = root.children.map((): CPUProfileNode => resultRoot)
171174

172175
// TODO(Christian) fix typings
173-
const sourceNodeStack = root.children.map((id): ProfileNode => nodeByIdMap.get(((id as unknown as number))))
176+
const sourceNodeStack = root.children.map(
177+
(id): ProfileNode => nodeByIdMap.get(id as unknown as number)
178+
)
174179
while (sourceNodeStack.length) {
175180
let parentNode = parentNodeStack.pop()
176181
const sourceNode = sourceNodeStack.pop()
@@ -182,7 +187,10 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
182187
parentNode.children.push(targetNode)
183188
parentNode = targetNode
184189
idMap.set(sourceNode.id, parentNode.id)
185-
parentNodeStack.push.apply(parentNodeStack, sourceNode.children.map((): CPUProfileNode => parentNode))
190+
parentNodeStack.push.apply(
191+
parentNodeStack,
192+
sourceNode.children.map((): CPUProfileNode => parentNode)
193+
)
186194
/**
187195
* type defect
188196
*/
@@ -196,7 +204,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
196204
return resultRoot
197205
}
198206

199-
private _sortSamples (): void {
207+
private _sortSamples(): void {
200208
const timestamps = this.timestamps
201209
if (!timestamps) {
202210
return
@@ -228,7 +236,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
228236
}
229237
}
230238

231-
private _normalizeTimestamps (): void {
239+
private _normalizeTimestamps(): void {
232240
let timestamps = this.timestamps
233241
if (!timestamps) {
234242
// Support loading old CPU profiles that are missing timestamps.
@@ -257,15 +265,16 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
257265
* Add an extra timestamp used to calculate the last sample duration.
258266
*/
259267
if (this.samples.length === timestamps.length) {
260-
const averageSample = (timestamps[timestamps.length - 1] - timestamps[0]) / (timestamps.length - 1)
268+
const averageSample =
269+
(timestamps[timestamps.length - 1] - timestamps[0]) / (timestamps.length - 1)
261270
this.timestamps.push(timestamps[timestamps.length - 1] + averageSample)
262271
}
263272

264273
this.profileStartTime = timestamps[0]
265274
this.profileEndTime = timestamps[timestamps.length - 1]
266275
}
267276

268-
private _buildIdToNodeMap (): void {
277+
private _buildIdToNodeMap(): void {
269278
/** @type {!Map<number, !CPUProfileNode>} */
270279
this._idToNode = new Map()
271280
const idToNode = this._idToNode
@@ -278,9 +287,13 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
278287
}
279288
}
280289

281-
private _extractMetaNodes (): void {
290+
private _extractMetaNodes(): void {
282291
const topLevelNodes = this.profileHead.children
283-
for (let i = 0; i < topLevelNodes.length && !(this.gcNode && this.programNode && this.idleNode); i++) {
292+
for (
293+
let i = 0;
294+
i < topLevelNodes.length && !(this.gcNode && this.programNode && this.idleNode);
295+
i++
296+
) {
284297
const node = topLevelNodes[i]
285298
if (node.functionName === '(garbage collector)') {
286299
this.gcNode = node
@@ -300,7 +313,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
300313
* between two call stacks sharing the same bottom node, it is replaced
301314
* with the preceeding sample.
302315
*/
303-
private _fixMissingSamples (): void {
316+
private _fixMissingSamples(): void {
304317
const samples = this.samples
305318
const samplesCount = samples.length
306319
const idToNode = this._idToNode
@@ -315,7 +328,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
315328
* @param {!SDK.ProfileNode} node
316329
* @return {!SDK.ProfileNode}
317330
*/
318-
function bottomNode (node: ProfileNode): ProfileNode {
331+
function bottomNode(node: ProfileNode): ProfileNode {
319332
while (node && node.parent && node.parent.parent) {
320333
node = node.parent
321334
}
@@ -327,7 +340,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
327340
* @param {number} nodeId
328341
* @return {boolean}
329342
*/
330-
function isSystemNode (nodeId: number): boolean {
343+
function isSystemNode(nodeId: number): boolean {
331344
return nodeId === programNodeId || nodeId === gcNodeId || nodeId === idleNodeId
332345
}
333346

@@ -362,9 +375,15 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
362375
* @param {number=} startTime
363376
* @param {number=} stopTime
364377
*/
365-
public forEachFrame (
378+
public forEachFrame(
366379
openFrameCallback: (depth: number, node: CPUProfileNode, startTime: number) => void,
367-
closeFrameCallback: (depth: number, node: CPUProfileNode, startTime: number, duration: number, selfTime: number) => void,
380+
closeFrameCallback: (
381+
depth: number,
382+
node: CPUProfileNode,
383+
startTime: number,
384+
duration: number,
385+
selfTime: number
386+
) => void,
368387
startTime?: number,
369388
stopTime?: number
370389
): void {
@@ -446,6 +465,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
446465
)
447466
--stackTop
448467
prevNode = gcParentNode
468+
// eslint-disable-next-line no-useless-assignment
449469
prevId = prevNode.id
450470
gcParentNode = null
451471
}
@@ -495,7 +515,13 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
495515
const start = stackStartTimes[stackTop]
496516
const duration = sampleTime - start
497517
stackChildrenDuration[stackTop - 1] += duration
498-
closeFrameCallback(gcParentNode.depth + 1, node, start, duration, duration - stackChildrenDuration[stackTop])
518+
closeFrameCallback(
519+
gcParentNode.depth + 1,
520+
node,
521+
start,
522+
duration,
523+
duration - stackChildrenDuration[stackTop]
524+
)
499525
--stackTop
500526
prevId = gcParentNode.id
501527
}
@@ -519,7 +545,7 @@ export default class CPUProfileDataModel extends ProfileTreeModel {
519545
* @param {number} index
520546
* @return {?CPUProfileNode}
521547
*/
522-
public nodeByIndex (index: number): CPUProfileNode {
548+
public nodeByIndex(index: number): CPUProfileNode {
523549
return this._idToNode.get(this.samples[index]) || null
524550
}
525551
}

devtools/profileTreeModel/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class ProfileTreeModel {
1515
this.total = this._calculateTotals(this.root)
1616
}
1717

18-
private _assignDepthsAndParents (): void {
18+
private _assignDepthsAndParents(): void {
1919
const root = this.root
2020
root.depth = -1
2121
root.parent = null
@@ -46,7 +46,7 @@ export default class ProfileTreeModel {
4646
* @param {!SDK.ProfileNode} root
4747
* @return {number}
4848
*/
49-
private _calculateTotals (root: ProfileNode): number {
49+
private _calculateTotals(root: ProfileNode): number {
5050
const nodesToTraverse: ProfileNode[] = [root]
5151
const dfsList: ProfileNode[] = []
5252

devtools/profileTreeModel/profileNode.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default class ProfileNode {
1616
/**
1717
* @param {!Protocol.Runtime.CallFrame} callFrame
1818
*/
19-
public constructor (callFrame: CallFrame) {
19+
public constructor(callFrame: CallFrame) {
2020
this.callFrame = callFrame
2121
this.callUID = `${callFrame.functionName}@${callFrame.scriptId}:${callFrame.lineNumber}:${callFrame.columnNumber}`
2222
this.self = 0
@@ -29,35 +29,35 @@ export default class ProfileNode {
2929
/**
3030
* @return {string}
3131
*/
32-
public get functionName (): string {
32+
public get functionName(): string {
3333
return this.callFrame.functionName
3434
}
3535

3636
/**
3737
* @return {string}
3838
*/
39-
public get scriptId (): string {
39+
public get scriptId(): string {
4040
return this.callFrame.scriptId
4141
}
4242

4343
/**
4444
* @return {string}
4545
*/
46-
public get url (): string {
46+
public get url(): string {
4747
return this.callFrame.url
4848
}
4949

5050
/**
5151
* @return {number}
5252
*/
53-
public get lineNumber (): number {
53+
public get lineNumber(): number {
5454
return this.callFrame.lineNumber
5555
}
5656

5757
/**
5858
* @return {number}
5959
*/
60-
public get columnNumber (): number {
60+
public get columnNumber(): number {
6161
return this.callFrame.columnNumber
6262
}
6363
}

devtools/runtime/experimentsSupport.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ export default class ExperimentsSupport {
33
return !!experimentName
44
}
55
}
6-

0 commit comments

Comments
 (0)