From f054d64c52315bd7fea1307815f9322353a7e723 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Wed, 23 Sep 2026 14:39:09 +0200 Subject: [PATCH] chore: remove duplicate edito formatting --- src/formatters/CommentFormatter.ts | 16 ++----- .../CommentFormatter.test.js.snapshot | 44 +++---------------- tests/formatters/CommentFormatter.test.ts | 15 ------- 3 files changed, 10 insertions(+), 65 deletions(-) diff --git a/src/formatters/CommentFormatter.ts b/src/formatters/CommentFormatter.ts index 3d210ee662..3b9e61a9e5 100644 --- a/src/formatters/CommentFormatter.ts +++ b/src/formatters/CommentFormatter.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import type {CD4ACommentThread, CD4AEditorAnchorSignature} from '../types.js'; +import type {CD4ACommentThread} from '../types.js'; export interface CommentFormatterOptions { resolveBackendNodeId?: (backendNodeId: number) => Promise; @@ -16,7 +16,6 @@ export interface StructuredCommentThread { text: string; elementUid?: string; reqid?: number; - editor?: CD4AEditorAnchorSignature; } function formatCommentThread(thread: StructuredCommentThread): string { @@ -25,16 +24,10 @@ function formatCommentThread(thread: StructuredCommentThread): string { `- Comment: ${thread.text}`, ]; if (thread.elementUid) { - lines.push(`- Target element (snapshot UID): ${thread.elementUid}`); + lines.push(`- Related element uid: ${thread.elementUid}`); } if (thread.reqid !== undefined) { - lines.push(`- Network request ID (reqid): ${thread.reqid}`); - } - if (thread.editor) { - const location = thread.editor.filePath - ? `${thread.editor.filePath}:${thread.editor.lineNumber}` - : `line ${thread.editor.lineNumber}`; - lines.push(`- Editor location: ${location}`); + lines.push(`- Related network reqid: ${thread.reqid}`); } return lines.join('\n'); } @@ -87,9 +80,6 @@ export class CommentFormatter { if (reqid !== undefined) { item.reqid = reqid; } - if (thread.editor) { - item.editor = thread.editor; - } structuredThreads.push(item); } return new CommentFormatter(structuredThreads); diff --git a/tests/formatters/CommentFormatter.test.js.snapshot b/tests/formatters/CommentFormatter.test.js.snapshot index fb63475d90..86ef87a581 100644 --- a/tests/formatters/CommentFormatter.test.js.snapshot +++ b/tests/formatters/CommentFormatter.test.js.snapshot @@ -4,11 +4,7 @@ exports[`CommentFormatter > formats comments with targets and editor locations t "id": "comment-1", "text": "Fix the color contrast here", "elementUid": "element-uid-42", - "reqid": 7, - "editor": { - "filePath": "src/style.css", - "lineNumber": 10 - } + "reqid": 7 } ] `; @@ -18,29 +14,8 @@ Found 1 DevTools comment thread(s): ### Thread: comment-1 - Comment: Fix the color contrast here -- Target element (snapshot UID): element-uid-42 -- Network request ID (reqid): 7 -- Editor location: src/style.css:10 -`; - -exports[`CommentFormatter > formats editor location when filePath is missing toJSON 1`] = ` -[ - { - "id": "comment-2", - "text": "Review this script line", - "editor": { - "lineNumber": 25 - } - } -] -`; - -exports[`CommentFormatter > formats editor location when filePath is missing toString 1`] = ` -Found 1 DevTools comment thread(s): - -### Thread: comment-2 -- Comment: Review this script line -- Editor location: line 25 +- Related element uid: element-uid-42 +- Related network reqid: 7 `; exports[`CommentFormatter > formats empty comments list toJSON 1`] = ` @@ -54,7 +29,7 @@ No open DevTools comments found. exports[`CommentFormatter > formats single thread using static formatThread 1`] = ` ### Thread: comment-3 - Comment: Check padding -- Target element (snapshot UID): node-99 +- Related element uid: node-99 `; exports[`CommentFormatter > omits unresolved targets when from() resolves undefined toJSON 1`] = ` @@ -79,11 +54,7 @@ exports[`CommentFormatter > resolves targets using from() method toJSON 1`] = ` "id": "comment-1", "text": "Fix the color contrast here", "elementUid": "element-uid-42", - "reqid": 7, - "editor": { - "filePath": "src/style.css", - "lineNumber": 10 - } + "reqid": 7 } ] `; @@ -93,7 +64,6 @@ Found 1 DevTools comment thread(s): ### Thread: comment-1 - Comment: Fix the color contrast here -- Target element (snapshot UID): element-uid-42 -- Network request ID (reqid): 7 -- Editor location: src/style.css:10 +- Related element uid: element-uid-42 +- Related network reqid: 7 `; diff --git a/tests/formatters/CommentFormatter.test.ts b/tests/formatters/CommentFormatter.test.ts index bcac6a13c1..8035cd2413 100644 --- a/tests/formatters/CommentFormatter.test.ts +++ b/tests/formatters/CommentFormatter.test.ts @@ -43,21 +43,6 @@ describe('CommentFormatter', () => { text: 'Fix the color contrast here', elementUid: 'element-uid-42', reqid: 7, - editor: { - filePath: 'src/style.css', - lineNumber: 10, - }, - }; - return new CommentFormatter([thread]); - }); - - formatterTest('formats editor location when filePath is missing', () => { - const thread: StructuredCommentThread = { - id: 'comment-2', - text: 'Review this script line', - editor: { - lineNumber: 25, - }, }; return new CommentFormatter([thread]); });