Skip to content

Commit b86a0ad

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[cleanup] Fixes for noUnusedParameters
When enabled this places get reported. Either silence with prefixing `_` or remove where possible. Bug: 409278895 Change-Id: I72223f5ba2119ef05adc3c69edb4fbe33eb3a8bf Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6441441 Reviewed-by: Benedikt Meurer <[email protected]> Auto-Submit: Nikolay Vitkov <[email protected]> Commit-Queue: Nikolay Vitkov <[email protected]>
1 parent 836a797 commit b86a0ad

File tree

50 files changed

+273
-317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+273
-317
lines changed

extensions/cxx_debugging/e2e/TestDriver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ async function scrollToLine(lineNumber: number): Promise<void> {
242242
}
243243

244244
async function doActions({actions, reason}: {actions?: Action[], reason: string}) {
245-
const {frontend, target} = getBrowserAndPages();
245+
const {target} = getBrowserAndPages();
246246
let continuation;
247247
if (actions) {
248248
for (const step of actions) {
@@ -258,7 +258,7 @@ async function doActions({actions, reason}: {actions?: Action[], reason: string}
258258
}
259259
await openFileInEditor(file);
260260
await scrollToLine(Number(breakpoint));
261-
await addBreakpointForLine(frontend, breakpoint);
261+
await addBreakpointForLine(breakpoint);
262262
break;
263263
}
264264
case 'remove_breakpoint': {
@@ -267,7 +267,7 @@ async function doActions({actions, reason}: {actions?: Action[], reason: string}
267267
throw new Error('Invalid breakpoint spec: missing `breakpoint`');
268268
}
269269
await scrollToLine(Number(breakpoint));
270-
await removeBreakpointForLine(frontend, breakpoint);
270+
await removeBreakpointForLine(breakpoint);
271271
break;
272272
}
273273
case 'step_over':

extensions/cxx_debugging/e2e/standalone/MemoryInspector_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('LinearMemoryInspector', () => {
3333
const file = 'scope-view-primitives.c';
3434
const breakpoint = 14;
3535
await openFileInEditor(file);
36-
await addBreakpointForLine(frontend, Number(breakpoint));
36+
await addBreakpointForLine(Number(breakpoint));
3737

3838
await target.reload();
3939
await waitForFunction(async () => ((await getPendingEvents(frontend, 'DevTools.DebuggerPaused')) || []).length > 0);

front_end/core/common/Color.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ export function desiredLuminance(luminance: number, contrast: number, lighter: b
512512
* calculated luminance of `candidateHSVA` approximates `desiredLuminance`.
513513
*/
514514
export function approachColorValue(
515-
candidateHSVA: Color4D, bgRGBA: Color4D, index: number, desiredLuminance: number,
515+
candidateHSVA: Color4D, index: number, desiredLuminance: number,
516516
candidateLuminance: (arg0: Color4D) => number): number|null {
517517
const epsilon = 0.0002;
518518

@@ -567,12 +567,12 @@ export function findFgColorForContrast(fgColor: Legacy, bgColor: Legacy, require
567567
const saturationComponentIndex = 1;
568568
const valueComponentIndex = 2;
569569

570-
if (approachColorValue(candidateHSVA, bgRGBA, valueComponentIndex, desired, candidateLuminance)) {
570+
if (approachColorValue(candidateHSVA, valueComponentIndex, desired, candidateLuminance)) {
571571
return Legacy.fromHSVA(candidateHSVA);
572572
}
573573

574574
candidateHSVA[valueComponentIndex] = 1;
575-
if (approachColorValue(candidateHSVA, bgRGBA, saturationComponentIndex, desired, candidateLuminance)) {
575+
if (approachColorValue(candidateHSVA, saturationComponentIndex, desired, candidateLuminance)) {
576576
return Legacy.fromHSVA(candidateHSVA);
577577
}
578578

@@ -581,7 +581,6 @@ export function findFgColorForContrast(fgColor: Legacy, bgColor: Legacy, require
581581

582582
export function findFgColorForContrastAPCA(fgColor: Legacy, bgColor: Legacy, requiredContrast: number): Legacy|null {
583583
const candidateHSVA = fgColor.as(Format.HSL).hsva();
584-
const bgRGBA = bgColor.rgba();
585584

586585
const candidateLuminance = (candidateHSVA: Color4D): number => {
587586
return luminanceAPCA(Legacy.fromHSVA(candidateHSVA).rgba());
@@ -595,15 +594,15 @@ export function findFgColorForContrastAPCA(fgColor: Legacy, bgColor: Legacy, req
595594
const saturationComponentIndex = 1;
596595
const valueComponentIndex = 2;
597596

598-
if (approachColorValue(candidateHSVA, bgRGBA, valueComponentIndex, desiredLuminance, candidateLuminance)) {
597+
if (approachColorValue(candidateHSVA, valueComponentIndex, desiredLuminance, candidateLuminance)) {
599598
const candidate = Legacy.fromHSVA(candidateHSVA);
600599
if (Math.abs(contrastRatioAPCA(bgColor.rgba(), candidate.rgba())) >= requiredContrast) {
601600
return candidate;
602601
}
603602
}
604603

605604
candidateHSVA[valueComponentIndex] = 1;
606-
if (approachColorValue(candidateHSVA, bgRGBA, saturationComponentIndex, desiredLuminance, candidateLuminance)) {
605+
if (approachColorValue(candidateHSVA, saturationComponentIndex, desiredLuminance, candidateLuminance)) {
607606
const candidate = Legacy.fromHSVA(candidateHSVA);
608607
if (Math.abs(contrastRatioAPCA(bgColor.rgba(), candidate.rgba())) >= requiredContrast) {
609608
return candidate;

front_end/core/common/Settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ export class Setting<V> {
519519
try {
520520
this.storage.set(this.name, settingString);
521521
} catch (e) {
522-
this.printSettingsSavingError(e.message, this.name, settingString);
522+
this.printSettingsSavingError(e.message, settingString);
523523
}
524524
} catch (e) {
525525
Console.instance().error('Cannot stringify setting with name: ' + this.name + ', error: ' + e.message);
@@ -606,7 +606,7 @@ export class Setting<V> {
606606
return this.#deprecation;
607607
}
608608

609-
private printSettingsSavingError(message: string, name: string, value: string): void {
609+
private printSettingsSavingError(message: string, value: string): void {
610610
const errorMessage =
611611
'Error saving setting with name: ' + this.name + ', value length: ' + value.length + '. Error: ' + message;
612612
console.error(errorMessage);

front_end/core/host/InspectorFrontendHost.ts

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,22 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
145145
closeWindow(): void {
146146
}
147147

148-
setIsDocked(isDocked: boolean, callback: () => void): void {
148+
setIsDocked(_isDocked: boolean, callback: () => void): void {
149149
window.setTimeout(callback, 0);
150150
}
151151

152-
showSurvey(trigger: string, callback: (arg0: ShowSurveyResult) => void): void {
152+
showSurvey(_trigger: string, callback: (arg0: ShowSurveyResult) => void): void {
153153
window.setTimeout(() => callback({surveyShown: false}), 0);
154154
}
155155

156-
canShowSurvey(trigger: string, callback: (arg0: CanShowSurveyResult) => void): void {
156+
canShowSurvey(_trigger: string, callback: (arg0: CanShowSurveyResult) => void): void {
157157
window.setTimeout(() => callback({canShowSurvey: false}), 0);
158158
}
159159

160160
/**
161161
* Requests inspected page to be placed atop of the inspector frontend with specified bounds.
162162
*/
163-
setInspectedPageBounds(bounds: {
163+
setInspectedPageBounds(_bounds: {
164164
x: number,
165165
y: number,
166166
width: number,
@@ -171,7 +171,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
171171
inspectElementCompleted(): void {
172172
}
173173

174-
setInjectedScriptForOrigin(origin: string, script: string): void {
174+
setInjectedScriptForOrigin(_origin: string, _script: string): void {
175175
}
176176

177177
inspectedURLChanged(url: Platform.DevToolsPath.UrlString): void {
@@ -192,19 +192,19 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
192192
window.open(url, '_blank');
193193
}
194194

195-
openSearchResultsInNewTab(query: string): void {
195+
openSearchResultsInNewTab(_query: string): void {
196196
Common.Console.Console.instance().error(
197197
'Search is not enabled in hosted mode. Please inspect using chrome://inspect');
198198
}
199199

200-
showItemInFolder(fileSystemPath: Platform.DevToolsPath.RawPathString): void {
200+
showItemInFolder(_fileSystemPath: Platform.DevToolsPath.RawPathString): void {
201201
Common.Console.Console.instance().error(
202202
'Show item in folder is not enabled in hosted mode. Please inspect using chrome://inspect');
203203
}
204204

205205
save(
206-
url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, content: string, forceSaveAs: boolean,
207-
isBase64: boolean): void {
206+
url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, content: string, _forceSaveAs: boolean,
207+
_isBase64: boolean): void {
208208
let buffer = this.#urlsBeingSaved.get(url);
209209
if (!buffer) {
210210
buffer = [];
@@ -246,7 +246,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
246246
URL.revokeObjectURL(blobUrl);
247247
}
248248

249-
sendMessageToBackend(message: string): void {
249+
sendMessageToBackend(_message: string): void {
250250
}
251251

252252
recordCountHistogram(histogramName: string, sample: number, min: number, exclusiveMax: number, bucketSize: number):
@@ -257,7 +257,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
257257
this.recordedCountHistograms.push({histogramName, sample, min, exclusiveMax, bucketSize});
258258
}
259259

260-
recordEnumeratedHistogram(actionName: EnumeratedHistogram, actionCode: number, bucketSize: number): void {
260+
recordEnumeratedHistogram(actionName: EnumeratedHistogram, actionCode: number, _bucketSize: number): void {
261261
if (this.recordedEnumeratedHistograms.length >= MAX_RECORDED_HISTOGRAMS_SIZE) {
262262
this.recordedEnumeratedHistograms.shift();
263263
}
@@ -271,7 +271,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
271271
this.recordedPerformanceHistograms.push({histogramName, duration});
272272
}
273273

274-
recordUserMetricsAction(umaName: string): void {
274+
recordUserMetricsAction(_umaName: string): void {
275275
}
276276

277277
connectAutomaticFileSystem(
@@ -283,14 +283,14 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
283283
queueMicrotask(() => callback({success: false}));
284284
}
285285

286-
disconnectAutomaticFileSystem(fileSystemPath: Platform.DevToolsPath.RawPathString): void {
286+
disconnectAutomaticFileSystem(_fileSystemPath: Platform.DevToolsPath.RawPathString): void {
287287
}
288288

289289
requestFileSystems(): void {
290290
this.events.dispatchEventToListeners(Events.FileSystemsLoaded, []);
291291
}
292292

293-
addFileSystem(type?: string): void {
293+
addFileSystem(_type?: string): void {
294294
const onFileSystem = (fs: FileSystem): void => {
295295
this.#fileSystem = fs;
296296
const fileSystem = {
@@ -304,7 +304,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
304304
window.webkitRequestFileSystem(window.TEMPORARY, 1024 * 1024, onFileSystem);
305305
}
306306

307-
removeFileSystem(fileSystemPath: Platform.DevToolsPath.RawPathString): void {
307+
removeFileSystem(_fileSystemPath: Platform.DevToolsPath.RawPathString): void {
308308
const removalCallback = (entries: Entry[]): void => {
309309
entries.forEach(entry => {
310310
if (entry.isDirectory) {
@@ -323,12 +323,12 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
323323
this.events.dispatchEventToListeners(Events.FileSystemRemoved, OVERRIDES_FILE_SYSTEM_PATH);
324324
}
325325

326-
isolatedFileSystem(fileSystemId: string, registeredName: string): FileSystem|null {
326+
isolatedFileSystem(_fileSystemId: string, _registeredName: string): FileSystem|null {
327327
return this.#fileSystem;
328328
}
329329

330330
loadNetworkResource(
331-
url: string, headers: string, streamId: number, callback: (arg0: LoadNetworkResourceResult) => void): void {
331+
url: string, _headers: string, streamId: number, callback: (arg0: LoadNetworkResourceResult) => void): void {
332332
// Read the first 3 bytes looking for the gzip signature in the file header
333333
function isGzip(ab: ArrayBuffer): boolean {
334334
const buf = new Uint8Array(ab);
@@ -376,7 +376,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
376376
});
377377
}
378378

379-
registerPreference(name: string, options: {synced?: boolean}): void {
379+
registerPreference(_name: string, _options: {synced?: boolean}): void {
380380
}
381381

382382
getPreferences(callback: (arg0: {
@@ -452,16 +452,16 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
452452
callback(hostConfigForHostedMode);
453453
}
454454

455-
upgradeDraggedFileSystemPermissions(fileSystem: FileSystem): void {
455+
upgradeDraggedFileSystemPermissions(_fileSystem: FileSystem): void {
456456
}
457457

458-
indexPath(requestId: number, fileSystemPath: Platform.DevToolsPath.RawPathString, excludedFolders: string): void {
458+
indexPath(_requestId: number, _fileSystemPath: Platform.DevToolsPath.RawPathString, _excludedFolders: string): void {
459459
}
460460

461-
stopIndexing(requestId: number): void {
461+
stopIndexing(_requestId: number): void {
462462
}
463463

464-
searchInPath(requestId: number, fileSystemPath: Platform.DevToolsPath.RawPathString, query: string): void {
464+
searchInPath(_requestId: number, _fileSystemPath: Platform.DevToolsPath.RawPathString, _query: string): void {
465465
}
466466

467467
zoomFactor(): number {
@@ -477,16 +477,16 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
477477
resetZoom(): void {
478478
}
479479

480-
setWhitelistedShortcuts(shortcuts: string): void {
480+
setWhitelistedShortcuts(_shortcuts: string): void {
481481
}
482482

483-
setEyeDropperActive(active: boolean): void {
483+
setEyeDropperActive(_active: boolean): void {
484484
}
485485

486-
showCertificateViewer(certChain: string[]): void {
486+
showCertificateViewer(_certChain: string[]): void {
487487
}
488488

489-
reattach(callback: () => void): void {
489+
reattach(_callback: () => void): void {
490490
}
491491

492492
readyForTest(): void {
@@ -495,64 +495,64 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
495495
connectionReady(): void {
496496
}
497497

498-
setOpenNewWindowForPopups(value: boolean): void {
498+
setOpenNewWindowForPopups(_value: boolean): void {
499499
}
500500

501-
setDevicesDiscoveryConfig(config: Adb.Config): void {
501+
setDevicesDiscoveryConfig(_config: Adb.Config): void {
502502
}
503503

504-
setDevicesUpdatesEnabled(enabled: boolean): void {
504+
setDevicesUpdatesEnabled(_enabled: boolean): void {
505505
}
506506

507-
openRemotePage(browserId: string, url: string): void {
507+
openRemotePage(_browserId: string, _url: string): void {
508508
}
509509

510510
openNodeFrontend(): void {
511511
}
512512

513-
showContextMenuAtPoint(x: number, y: number, items: ContextMenuDescriptor[], document: Document): void {
513+
showContextMenuAtPoint(_x: number, _y: number, _items: ContextMenuDescriptor[], _document: Document): void {
514514
throw new Error('Soft context menu should be used');
515515
}
516516

517517
isHostedMode(): boolean {
518518
return true;
519519
}
520520

521-
setAddExtensionCallback(callback: (arg0: ExtensionDescriptor) => void): void {
521+
setAddExtensionCallback(_callback: (arg0: ExtensionDescriptor) => void): void {
522522
// Extensions are not supported in hosted mode.
523523
}
524524

525525
async initialTargetId(): Promise<string|null> {
526526
return null;
527527
}
528528

529-
doAidaConversation(request: string, streamId: number, callback: (result: DoAidaConversationResult) => void): void {
529+
doAidaConversation(_request: string, _streamId: number, callback: (result: DoAidaConversationResult) => void): void {
530530
callback({
531531
error: 'Not implemented',
532532
});
533533
}
534534

535-
registerAidaClientEvent(request: string, callback: (result: AidaClientResult) => void): void {
535+
registerAidaClientEvent(_request: string, callback: (result: AidaClientResult) => void): void {
536536
callback({
537537
error: 'Not implemented',
538538
});
539539
}
540540

541-
recordImpression(event: ImpressionEvent): void {
541+
recordImpression(_event: ImpressionEvent): void {
542542
}
543-
recordResize(event: ResizeEvent): void {
543+
recordResize(_event: ResizeEvent): void {
544544
}
545-
recordClick(event: ClickEvent): void {
545+
recordClick(_event: ClickEvent): void {
546546
}
547-
recordHover(event: HoverEvent): void {
547+
recordHover(_event: HoverEvent): void {
548548
}
549-
recordDrag(event: DragEvent): void {
549+
recordDrag(_event: DragEvent): void {
550550
}
551-
recordChange(event: ChangeEvent): void {
551+
recordChange(_event: ChangeEvent): void {
552552
}
553-
recordKeyDown(event: KeyDownEvent): void {
553+
recordKeyDown(_event: KeyDownEvent): void {
554554
}
555-
recordSettingAccess(event: SettingAccessEvent): void {
555+
recordSettingAccess(_event: SettingAccessEvent): void {
556556
}
557557
}
558558

@@ -568,7 +568,7 @@ class InspectorFrontendAPIImpl {
568568
}
569569
}
570570

571-
private dispatch(name: symbol, signature: string[], runOnceLoaded: boolean, ...params: string[]): void {
571+
private dispatch(name: symbol, signature: string[], _runOnceLoaded: boolean, ...params: string[]): void {
572572
// Single argument methods get dispatched with the param.
573573
if (signature.length < 2) {
574574
try {

front_end/core/platform/TypescriptUtilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function assertNotNullOrUndefined<T>(val: T, message?: string): asserts v
1313
}
1414
}
1515

16-
export function assertNever(type: never, message: string): never {
16+
export function assertNever(_type: never, message: string): never {
1717
throw new Error(message);
1818
}
1919

front_end/core/sdk/CSSMatchedStyles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ function cleanUserAgentPayload(payload: Protocol.CSS.RuleMatch[]): Protocol.CSS.
123123
if (rule.origin !== 'user-agent' || !matchingSelectors.length) {
124124
return;
125125
}
126-
rule.selectorList.selectors = rule.selectorList.selectors.filter((item, i) => matchingSelectors.includes(i));
126+
rule.selectorList.selectors = rule.selectorList.selectors.filter((_, i) => matchingSelectors.includes(i));
127127
rule.selectorList.text = rule.selectorList.selectors.map(item => item.text).join(', ');
128-
ruleMatch.matchingSelectors = matchingSelectors.map((item, i) => i);
128+
ruleMatch.matchingSelectors = matchingSelectors.map((_, i) => i);
129129
}
130130
}
131131

0 commit comments

Comments
 (0)