Support XLink in the imperative API lint rule [devtools/devtools-frontend : main]

0 views
Skip to first unread message

Nikolay Vitkov (Gerrit)

unread,
4:40 AMĀ (9 hours ago)Ā 4:40 AM
to Danil Somsikov, Devtools-frontend LUCI CQ, AyeAye, devtools-rev...@chromium.org
Attention needed from Danil Somsikov

Nikolay Vitkov voted and added 3 comments

Votes added by Nikolay Vitkov

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Nikolay Vitkov . resolved

LGTM with 2 comments.

File scripts/eslint_rules/lib/no-imperative-dom-api/x-link.ts
Line 38, Patchset 5 (Latest): key: 'jslog',
Nikolay Vitkov . unresolved

Nit: I mimicked that we do for other components and adding the `jslogContext` directly as the `jslogContextString` should work correctly.

File scripts/eslint_rules/tests/no-imperative-dom-api.test.ts
Line 1421, Patchset 5 (Latest): tabindex="0">Google</devtools-link>
Nikolay Vitkov . unresolved

Can we check if the tabindex is 0 and not set it at all. That is handled by the component.

Open in Gerrit

Related details

Attention is currently required from:
  • Danil Somsikov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: devtools/devtools-frontend
Gerrit-Branch: main
Gerrit-Change-Id: Ibef4be3d07e3ed16d9ee6a92e8b99f8379f412c6
Gerrit-Change-Number: 7205976
Gerrit-PatchSet: 5
Gerrit-Owner: Danil Somsikov <d...@chromium.org>
Gerrit-Reviewer: Danil Somsikov <d...@chromium.org>
Gerrit-Reviewer: Nikolay Vitkov <nvi...@chromium.org>
Gerrit-CC: Devtools-frontend LUCI CQ <devtools-fro...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Attention: Danil Somsikov <d...@chromium.org>
Gerrit-Comment-Date: Mon, 01 Dec 2025 09:40:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Danil Somsikov (Gerrit)

unread,
4:52 AMĀ (9 hours ago)Ā 4:52 AM
to Nikolay Vitkov, Devtools-frontend LUCI CQ, AyeAye, devtools-rev...@chromium.org

Danil Somsikov added 2 comments

File scripts/eslint_rules/lib/no-imperative-dom-api/x-link.ts
Line 38, Patchset 5: key: 'jslog',
Nikolay Vitkov . resolved

Nit: I mimicked that we do for other components and adding the `jslogContext` directly as the `jslogContextString` should work correctly.

Danil Somsikov

Done

File scripts/eslint_rules/tests/no-imperative-dom-api.test.ts
Line 1421, Patchset 5: tabindex="0">Google</devtools-link>
Nikolay Vitkov . resolved

Can we check if the tabindex is 0 and not set it at all. That is handled by the component.

Danil Somsikov

Done

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: devtools/devtools-frontend
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibef4be3d07e3ed16d9ee6a92e8b99f8379f412c6
    Gerrit-Change-Number: 7205976
    Gerrit-PatchSet: 6
    Gerrit-Owner: Danil Somsikov <d...@chromium.org>
    Gerrit-Reviewer: Danil Somsikov <d...@chromium.org>
    Gerrit-Reviewer: Nikolay Vitkov <nvi...@chromium.org>
    Gerrit-CC: Devtools-frontend LUCI CQ <devtools-fro...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Comment-Date: Mon, 01 Dec 2025 09:52:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nikolay Vitkov <nvi...@chromium.org>
    satisfied_requirement
    open
    diffy

    Danil Somsikov (Gerrit)

    unread,
    4:52 AMĀ (9 hours ago)Ā 4:52 AM
    to Nikolay Vitkov, Devtools-frontend LUCI CQ, AyeAye, devtools-rev...@chromium.org

    Danil Somsikov voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: devtools/devtools-frontend
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibef4be3d07e3ed16d9ee6a92e8b99f8379f412c6
    Gerrit-Change-Number: 7205976
    Gerrit-PatchSet: 6
    Gerrit-Owner: Danil Somsikov <d...@chromium.org>
    Gerrit-Reviewer: Danil Somsikov <d...@chromium.org>
    Gerrit-Reviewer: Nikolay Vitkov <nvi...@chromium.org>
    Gerrit-CC: Devtools-frontend LUCI CQ <devtools-fro...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Comment-Date: Mon, 01 Dec 2025 09:52:20 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Devtools-frontend LUCI CQ (Gerrit)

    unread,
    5:29 AMĀ (8 hours ago)Ā 5:29 AM
    to Danil Somsikov, Nikolay Vitkov, AyeAye, devtools-rev...@chromium.org

    Devtools-frontend LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

    5 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: scripts/eslint_rules/lib/no-imperative-dom-api/x-link.ts
    Insertions: 7, Deletions: 6.

    @@ -33,13 +33,14 @@
    domFragment.classList.push(className);
    }
    const jslogContext = node.arguments[4];
    - const jslogContextString = jslogContext ? sourceCode.getText(jslogContext) : '';
    - domFragment.attributes.push({
    - key: 'jslog',
    - value: `\${VisualLogging.link(${jslogContextString}).track({click: true, keydown: 'Enter|Space'})}`
    - });
    + if (jslogContext && !isIdentifier(jslogContext, 'undefined')) {
    + domFragment.bindings.push({
    + key: 'jslogContext',
    + value: jslogContext,
    + });
    + }
    const tabIndex = node.arguments[5];
    - if (tabIndex) {
    + if (tabIndex && (tabIndex.type !== 'Literal' || tabIndex.value !== 0)) {
    domFragment.attributes.push({
    key: 'tabindex',
    value: tabIndex,
    ```
    ```
    The name of the file: scripts/eslint_rules/tests/no-imperative-dom-api.test.ts
    Insertions: 3, Deletions: 6.

    @@ -1408,7 +1408,7 @@
    this.contentElement.appendChild(
    UI.XLink.XLink.create('https://google.com', 'Google', 'some-class', undefined, 'some-context', 0));
    this.contentElement.appendChild(
    - UI.XLink.XLink.create('https://chromium.org', 'Chromium'));
    + UI.XLink.XLink.create('https://chromium.org', 'Chromium', undefined, undefined, undefined, 1));
    }
    }`,
    output: `
    @@ -1416,11 +1416,8 @@
    export const DEFAULT_VIEW = (input, _output, target) => {
    render(html\`
    <div>
    - <devtools-link class="some-class" href="https://google.com"
    - jslog=\${VisualLogging.link('some-context').track({click: true, keydown: 'Enter|Space'})}
    - tabindex="0">Google</devtools-link>
    - <devtools-link href="https://chromium.org"
    - jslog=\${VisualLogging.link().track({click: true, keydown: 'Enter|Space'})}>Chromium</devtools-link>
    + <devtools-link class="some-class" href="https://google.com" .jslogContext=\${'some-context'}>Google</devtools-link>
    + <devtools-link href="https://chromium.org" tabindex="1">Chromium</devtools-link>
    </div>\`,
    target, {host: input});
    };
    ```

    Change information

    Commit message:
    Support XLink in the imperative API lint rule 
    Bug: 407749531
    Change-Id: Ibef4be3d07e3ed16d9ee6a92e8b99f8379f412c6
    Reviewed-by: Nikolay Vitkov <nvi...@chromium.org>
    Commit-Queue: Danil Somsikov <d...@chromium.org>
    Auto-Submit: Danil Somsikov <d...@chromium.org>
    Files:
    • M scripts/eslint_rules/lib/no-imperative-dom-api.ts
    • A scripts/eslint_rules/lib/no-imperative-dom-api/x-link.ts
    • M scripts/eslint_rules/tests/no-imperative-dom-api.test.ts
    Change size: M
    Delta: 3 files changed, 85 insertions(+), 0 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Nikolay Vitkov
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: devtools/devtools-frontend
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibef4be3d07e3ed16d9ee6a92e8b99f8379f412c6
    Gerrit-Change-Number: 7205976
    Gerrit-PatchSet: 7
    Gerrit-Owner: Danil Somsikov <d...@chromium.org>
    Gerrit-Reviewer: Danil Somsikov <d...@chromium.org>
    Gerrit-Reviewer: Devtools-frontend LUCI CQ <devtools-fro...@luci-project-accounts.iam.gserviceaccount.com>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages