Commit Graph
1642 Commits
Author SHA1 Message Date
Nikolay Vitkov f1e3bd8d99 [eslint] Introduce eslint-plugin-eslint-plugin
Bug: none
Change-Id: I733528d699da8aa749d19d249e7752895c5a8195
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6259394
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-02-13 04:23:19 -08:00
Nikolay Vitkov 49d12de8b5 Revert "Remove custom_element_definitions_location lint rule."
This reverts commit dc5df3fd69.

Reason for revert: Actually this is fully inline with the UI eng vision. Not sure what I was thinking.

Original change's description:
> Remove custom_element_definitions_location lint rule.
>
> It is hard to justify this requiement in the light of UI engineering
> approach we are taking.
>
> Bug: 301364727
> Change-Id: I9f8f42255aab5dd41858e5840e048e47719f8520
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5899035
> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
> Auto-Submit: Danil Somsikov <dsv@chromium.org>

Bug: 301364727
Change-Id: I5096f996bb1ca22d8e1a26535dc3aa742fb84c02
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6252746
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-02-12 09:56:48 -08:00
Benedikt Meurer 84b0fcc58c [eslint] Replace prefer-readonly-keyword with @typescript-eslint/array-type.
We had our own homegrown ESLint rule that was trying to enforce some
consistency around `ReadonlyArray<T>` vs. `readonly T[]`, but that was
fairly limited and still allowed for `Array<T>` vs `T[]` with no shared
discipline.

We now use the `@typescript-eslint/array-type` rule instead and enforce
that for simple types the `T[]` (and `readonly T[]`) syntax is used,
while for complex types the `Array<A & B>` (and `ReadonlyArray<A & B>`)
syntax is used.

Bug: none
Change-Id: I8933869f98577d4afc4141c5736fccb2159924a6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6257990
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-02-12 07:40:43 -08:00
Nikolay Vitkov 7951c23a62 Clean up emscripten state when updating
We should clear the old version once we try to update the to a
new one else old files may linger

Bug: none
Change-Id: Ieb15ab58b454bff877431499cefbf5bb6e619a02
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6243826
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Liviu Rau <liviurau@chromium.org>
2025-02-07 06:42:06 -08:00
Alex Rudenko cff61d47bf [AI Assistance] clean up debug utils
Bug: none
Change-Id: I60f1318c85ff9a3c80543c217ce0da20c6464824
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6243821
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
Auto-Submit: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2025-02-07 06:30:56 -08:00
Benedikt Meurer eaa17749a3 [cleanup] Use Gerrit IfThisThenThat Lint.
This replaces the custom presubmit logic from
https://crrev.com/c/5272391 with Gerrit IfThisThenThat linter logic,
which is also what Chromium generally uses specifically for UMA
histogram related code.

Bug: 41496595, 394756426
Change-Id: Ib5b18639de1354e586bb58d6b83ef5c92d2f1146
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6239300
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2025-02-07 04:12:13 -08:00
Nikolay Vitkov aee920d20b [lint] Add debug logging
Bug: none
Change-Id: Ifcca54e5a5330d6e8f745b9a7eb0a30212360d8e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6239894
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-02-06 09:46:26 -08:00
Nikolay Vitkov c406636a87 [eslint] Extract runner into a util file
Also fixes the running of the test locally

Bug: none
Change-Id: Icbed012aeee6bddf5eebcffda9703693191ab4bc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6235032
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
2025-02-06 02:12:05 -08:00
Nikolay Vitkov 0645c18689 Rewrite TypeScript error paths
Trying to rewrite the error output in the terminal so that the link
created does not include the `../..` prefix, that way a person can open
the link directly in VsCode when clicking on it.

Bug: none
Change-Id: Iee59406d0f00e1d7bc7058e7e8e52033c21c9940
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6226102
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Nancy Li <nancyly@chromium.org>
2025-02-05 08:27:30 -08:00
Connor Clark 39e54309b8 Export all UIStrings in insight models, for external usage
We should have no i18n strings defined in insight component modules,
since Lighthouse (and any other future external usages) should be able
to utilize the exact same translated strings. This was already the case
for title/description, but now every translated string has been moved.

Bug: 388723721
Change-Id: Ic3e72acb4b697a225b102f64383660b5a0f275af
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6227699
Auto-Submit: Connor Clark <cjamcl@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Adam Raine <asraine@chromium.org>
2025-02-05 01:08:53 -08:00
Danil Somsikov a98dbb7be2 Remove lit-host-this elint rule.
According to the go/chrome-devtools:ui-engineering-proposal view function needs to call event handles on the view input.

Bug: 301364727
Change-Id: I2f13f7bbea9292d8e4a0bbdff2d6e2d326ca623d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6226799
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Danil Somsikov <dsv@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Danil Somsikov <dsv@chromium.org>
2025-02-03 09:37:08 -08:00
Nikolay Vitkov da9a885290 [lint] Add debugging flag
Was messing around with creating rules for Lit formatting,
and discovered that if not disable the second run
does not run the custom rule.

Bug: none
Change-Id: I1cc38d1118560774527dfe52d5d1281e304491ad
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6216936
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2025-02-03 02:31:56 -08:00
Paul Irish 88b4fd685d Fix watch_build invocation of generate_css_js_files.js
Recompile of CSS was broken due to the parameter changes within
crrev.com/c/6219314/3/scripts/build/generate_css_js_files.js

That CL removed the other side of hot-reload CSS (which never worked
with legacy CSS). So I've also cleaned up the remaining hot-reload bits
here as they're now unused.

Bug: 391381439
Change-Id: I2db5070e38d9c460c32a070e8510ea5ebaa18dfd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6221244
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Paul Irish <paulirish@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Andres Olivares <andoli@chromium.org>
2025-02-03 02:29:50 -08:00
Benedikt Meurer 7b31ea2848 [unified-css] Generate sourceURL annotation with relative path.
Prior to this change, the generated CSS files would show up un "no
domain" in DevTools-on-DevTools, rather than in the correct paths
(next to the source code). This is because we inject the CSS via
`<style>` tags (or in some cases still adopt them to the shadow
root), and put a relative path into the `sourceURL` annotation.
DevTools-on-DevTools is not able to reconstruct the proper URL in
these cases, because it doesn't know the contextual base URL.

With this change, we use `import.meta` to construct the proper
URL at the time when importing the `.css.js` file, and stick that
into the `sourceURL` annotation.

Bug: 391381439
Change-Id: Ia965faa19d5119a2f70f840cf20d8d5b914856d7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6221305
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2025-02-02 23:20:57 -08:00
Benedikt Meurer beeb30b6d8 [cleanup] Improve ergonomics for importing Lit functions.
Instead of the cumbersome

```
import * as Lit from '../../ui/lit/lit.js';

// ...

const {render, html} = Lit;
```

you can now simply use

```
import {render, html} from '../../ui/lit/lit.js';
```

directly.

Bug: 301364727
Change-Id: If3441bd120dbce8902caab17bc4bf1703ed77270
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6216537
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2025-01-31 07:58:32 -08:00
Nikolay Vitkov 41c69115b8 [eslint] Enable import/sort rule
This provides consistency of how imports are order,
reducing differences in authored files.

Bug: none
Change-Id: I45ddd71e3e0004aca32f101cb926101544a34157
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6218490
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-01-31 07:48:10 -08:00
Benedikt Meurer d604ae2d17 [unified-css] Rename .css.legacy.js to .css.js.
This also removes the logic to generate the constructed style sheet
`.css.js` files, and with it the solution for CSS hot reloading (which
never worked for the "legacy CSS" approach).

Bug: 391381439
Change-Id: I7492f7d1b55dcb4f071a7c55974565a79dbbdb17
Doc: https://goo.gle/devtools-unified-css-design
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6218494
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-31 07:13:57 -08:00
Benedikt Meurer b218462d8b [unified-css] Only generate "legacy CSS" files.
This is the first step in the CSS unification, which adjusts the build
system to only spit out "legacy CSS" files, which we still turn into
constructed style sheets in various places, and which will be migrated
in a follow-up step.

In a follow up step, the `.css.legacy.js` files will also be renamed to
just `.css.js`, but for this change, it was easier to stick to this
naming scheme.

Bug: 391381439
Change-Id: I11e99c9dfcfd6adfca95242cbe152fed5ac3c107
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6219314
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2025-01-31 01:47:27 -08:00
Benedikt Meurer 36cb033ce2 [unified-css] Migrate icon_button component.
Now that we have an agreement on how to proceed with the CSS in the
front-end, migrate the `icon_button` component as the first guinea
pig, and remove the offending ESLint rule.

Bug: 391381439
Change-Id: Ie996db09fcf9dfc329206f62b136fad62583b730
Doc: https://goo.gle/devtools-unified-css-design
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6216261
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2025-01-30 09:24:19 -08:00
Nikolay Vitkov 5b2bcff17f [lint] Improvements and fixes to linting
Rerun all files if `lit-analyzer` rules change. Add support for EsLint
cache - `npm run lint` delta first run vs second of over 2 min. Don't
run EsLint if all files are ignored.

Bug: none
Change-Id: I042ede01cf0fe6de63b066723e1dc61cae3f9dcc
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6213930
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2025-01-29 21:21:13 -08:00
Benedikt Meurer 6e53408a5e [cleanup] Shorten LitHtml to Lit (lit-html to lit).
There's no benefit in the long version and the underlying package is
also just called `lit` these days, and `LitHtml` is really annoying
on the eyes.

Bug: 301364727
Change-Id: I38d90b8332af2c792063e318d3e0b11121501df1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6211898
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
2025-01-29 03:09:15 -08:00
Kim-Anh Tran 91816c4c33 [cleanup] Rename theme_colors.css and application_color_tokens.css
This renames these two files to better reflect the current content:

theme_colors -> design_system_tokens
application_color_tokens -> application_tokens

Bug: 390330089
Change-Id: Iceac9fc91fb774912236715643f831caad035ed2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6205768
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
2025-01-28 05:08:12 -08:00
Kim-Anh Tran d452a53cc3 [cleanup] Merge design_tokens.css into other token css files
This merges the definitions that were in design_tokens into
theme_colors.css and application_color_tokens.css.

In a follow up, we'll rename these two (theme_colors and
application_color_tokens). Keeping the same name here in order to
keep the diff easier to read for review purposes.

Bug: 390330089
Change-Id: Ia8510ca0818d31409250c1d5e6ef67897e6fc193
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6203922
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Kateryna Prokopenko <kprokopenko@chromium.org>
2025-01-28 02:45:40 -08:00
Nikolay Vitkov 99a9104ae9 [test] Add scripts folder to runner
Prototype for run.ts to include all scripts files as well.
This will make it easier to just run a single command.

Bug: none
Change-Id: I0e7e623a777330d320a003a0099518aeeed88821
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6187112
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-23 07:10:53 -08:00
Nikolay Vitkov effa60d93f [eslint][vscode] Fixes issue with EsLint plugin not working
Bug: none
Change-Id: I1be301aeac1ba08708bd03869fa0bf5b2ff6272f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6190538
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-23 03:05:34 -08:00
Kim-Anh Tran 73597f0d70 [cleanup] Merging token.css file into themeColors.css
This is the first part of our goal to merge the token css files
(token.css, theme_colors.css, design_tokens.css and
application_color_tokens.css). In the end, we want to end up
with two css files only.

This CL makes the following changes:
1. Move the content from `tokens.css` into `theme_colors.css`
2. Remove `tokens.css`

Note that this CL is simply moving the content for simplicity of
reviewing.
More clean ups will follow.

Bug: 390330089
Change-Id: Id06de578b1f5bf5f6dda7674e356a2c9f0463e94
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6189457
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-01-23 01:15:37 -08:00
Benedikt Meurer da8d124d10 Merge inspectorSyntaxHighlight.css and inspectorCommon.css.
Eventually we will need to split up the `inspectorCommon.css` styles
into separate style sheets and be more explicit about their usage,
but that's a bigger undertaking, and not something to start today.

Bug: 391381439
Change-Id: Ib075553b808257d1ef72d1abdb981221b8f19b93
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6189458
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2025-01-22 06:53:00 -08:00
Benedikt Meurer bf0e2b48f4 Move text-button styles to the button component.
This is the next step in unifying the way we inject CSS. While we should
probably have a proper `<devtools-text-button>` component instead of the
`.text-button` styles, I'm leaving that as a refactoring for later, and
for now, move the styles out of the legacy UI bundle and into the button
component.

Bug: 391381439
Change-Id: Id4708319dbfe2d609da0947ef9e3f7692723393b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6189456
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2025-01-22 06:28:56 -08:00
Benedikt Meurer 5a8025d801 Inject :root styles (for CSS tokens) only once.
Instead of injecting our CSS tokens into every document and every shadow
root, which is unnecessary and only makes it more challenging to reason
about the cascade in DevTools, inject these `.css` files exactly once
via the entrypoints.

Bug: 391381439, 390330089
Change-Id: Id3eba5303f636bd47cf893934c8ec625339cd289
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6187530
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2025-01-22 02:25:54 -08:00
dpapad d72093d255 Remove refs to Grit's output_all_resource_defines option.
This option is no longer respected by Grit, as of crrev.com/c/786121 (~7
years ago), but it is still present in a lot of grd files.

Bug: 389466679
Change-Id: I4f9b5873fbfdd6e3548f875c27c1de825837a595
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6187824
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2025-01-22 02:16:43 -08:00
Nikolay Vitkov 2205050d6a [eslint] Add extensions folder to linting
Includes linting of the extensions folder.
Also add .mjs files to the PRESUBMIT which was previously missing.

Bug: none
Change-Id: I6ae5bb8a218461c3b2bf07d95310d79c57f2cdd9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6177277
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-21 04:58:17 -08:00
Jack Franklin 89e7a5f0bb Autofreestyler: support perf examples
This CL updates the auto-run tool to support performance examples that
have an entry label annotation. The tool will now select that entry,
parse the prompt out of the HTML file, and execute the AI Assistance
against it.

The tool can find the metadata from the trace / HTML comments, and it is
able to download and import the trace into DevTools.

Most of the work here was in the downloading & metadata generation; the
actual AI execution is very similar, we just select an event in the Perf
Panel rather than inspect an element.

Bug: 383120286
Change-Id: I7d6ebff3a0577c46cb87c8fa57f1fbad6c475f44
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6172722
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org>
2025-01-21 04:36:17 -08:00
Sandor Major 289e94885a Delete ThirdPartyCookieAccessWarning/Error exemption
The feature reporting these was not launched and got removed in
https://crrev.com/c/6170641

The deprecation configuration for them is deleted in
https://crrev.com/c/6180886

Bug: 355308337
Change-Id: Icda738559fa1dedae5df2106877e46f4a423e7f0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6185607
Reviewed-by: Simon Zünd <szuend@chromium.org>
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2025-01-20 23:21:08 -08:00
Nikolay Vitkov de07efad99 [eslint] Update lint to include .mjs files
EsLint support .mjs file by default now. But we exclude them from
running previously in our script.

Disabled the `es-modules-import` rule for our script folder
as it's not relevant there.

Added types comment to the EsLint rules.
This should make it easier to build and understand the current rules.

Bug: none
Change-Id: I448efdb055c9cc107e3bced9b3febe5eb226bcf6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6177719
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-01-17 06:45:29 -08:00
Kateryna Prokopenko 33546605a9 [GM3Restyling] Update run command menu
Also add a script that given an image name adds required image paths to
devtools_image_files.gni and devtools_grd_files.gni

Screenshot: https://imgur.com/a/MaU8tFD

Bug: 325442580
Change-Id: I13d1af601c5534507f5303608fc28faf612c7d3a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6170727
Auto-Submit: Kateryna Prokopenko <kprokopenko@chromium.org>
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2025-01-15 21:22:50 -08:00
Benedikt Meurer d2325939f7 [cleanup] Remove LitElement dependency from Protocol Monitor.
The `JSONEditor` was previously using `LitElement`, which is not in line
with how we want to build UI in the future. This does the minimal
changes to turn it into a `UI.Widget.Widget` instead and also fixes the
build dependencies accordingly.

Bug: 390071004, 301364727
Change-Id: Ia01fb731e437ffb6fd8c435b905fe5973ad5f48a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6170726
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
2025-01-15 02:09:58 -08:00
Paul Irish 0783a8d746 [Watch] Drop chokidar for fs.watch() to fix missed changes
Bug:388570648
Change-Id: I7813b508624bf23228b00d9fb30da05da6d24e78
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6158783
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Paul Irish <paulirish@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org>
2025-01-14 10:36:08 -08:00
Jack Franklin 7e8d162a0c Autofreestyler: add type checking
This CL adds typechecking to the command line tool; although we had some
type supports there was no erroring if you did something wrong or used a
function that didn't exist.

This does make the code slightly more verbose but I do think it's worth
it. I don't ever expect this to be typechecked on CQ, but it does cause
errors to appear in the editor which will help folks working on it.

Bug: 383120286
Change-Id: If4236c2e20e244be6b0abaaad4b7c90c88cb5124
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6172331
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Ergün Erdoğmuş <ergunsh@chromium.org>
Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org>
2025-01-14 04:25:40 -08:00
Jack Franklin 27065b26c6 AutoFreestyler: support a generic comment syntax
This CL introduces the ability for comments in our examples to have any
key/value pairs, whilst also supporting the existing syntax. This means
we can define comments for examples either as:

```
<!--
  Why is this text not centered?
  # Because it has text-align: left; applied
-->
```

But now also:

```
<!--
  Prompt: Why is this text not centered?
  Explanation: Because it has text-align: left; applied
-->
```

The resulting object will be:

```
{
  prompt: 'Why is this...',
  explanation: 'Because...'
}
```

(In the old syntax, we assume lines with no prefix are prompts, and
lines with a `#` are part of the explanation).

Additionally, this CL also supports any random `A:B` key pairs, and also
ensures that multiple lines are supported. These will be used to provide
more context for other examples.

Bug: 383120286
Change-Id: Ib12c94c74d6045d845aad2edfb38d1dfb5166fec
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6171178
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org>
2025-01-14 02:07:57 -08:00
Jack Franklin e8b619ebb2 AutoAI: create tests for parseComments
Ahead of making some changes to the splitComments function, this CL
moves it into its own file that can easily be tested. The function has
also been renamed to `parseComments` which is a bit more accurate.

I considered just exporting the function from auto-run.js, but
auto-run.js assumes it is invoked on the command line, so rather than
restructure it to support being imported for tests, it was easier to
move the function into a separate helpers file.

Bug: 383120286
Change-Id: Icdd3a730def908fa180152981f2765cbf6e55c6d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6171176
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org>
2025-01-13 04:12:27 -08:00
Jack Franklin 8996ce6060 Lint: add test case for double slash in import path
Accidentally importing something as `foo//bar.js` (rather than
`foo/bar.js`) should not matter, and indeed both the TS build and
ESBuild compile fine. However you get an error when running DevTools at
runtime. What's unfortunate is that the error is very non obvious and it
took me ages to realise that the root of it was an accidental `//`.

This CL adds a check for this to the existing import rule and a test.

Fixed: 346966388
Change-Id: I3922a58b89ce639fc619c0e2b83cd14f3fe993cb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6157259
Commit-Queue: Andres Olivares <andoli@chromium.org>
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Andres Olivares <andoli@chromium.org>
2025-01-08 07:00:08 -08:00
Nikolay Vitkov 1f49d6a42b [tools] Fix test for EsLint and Stylelint
After the latest update to the deps these test started failing.

Bug: none
Change-Id: Ifd4a4099e465aa61087675f2fb564272e277ced0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6148217
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-08 01:56:59 -08:00
Nikolay Vitkov 9554d8f023 Unify code in check_experiment
Use the same setting we use in EsLint for consistency.

Bug: none
Change-Id: Ic56b3bb5bc85fbf37925423130e8dbb3d1ce11df
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6148455
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-08 01:43:11 -08:00
Benedikt Meurer 39e5133b95 [test] Introduce Platform.DevToolsPath.urlString helper.
This adds a helper function to avoid sprinkling casts to
`Platform.DevToolsPath.UrlString` all over our unit test
suite, combined with an ESLint rule to enforce that we
use this helper consistently.

This leads to much more readable test code for unit tests
that are concerned with APIs that take `UrlString`s, and
the code is more consistent.

Bug: 323797639
Change-Id: I6d797c0db9e5bd2fd019b83b9a7a269c7437ebdf
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6148578
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
2025-01-07 05:49:23 -08:00
Nikolay Vitkov b4e8dc7ac2 Update EsLint v9
Bug: none
Change-Id: Iebcc53c0f70a51242f22e4df167cd588b08cefcd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6140633
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-07 05:41:31 -08:00
Nikolay Vitkov 2a1b3b34b1 Update StyleLint to v16
Stylelint v16 deprecated CJS so I moved our lint script to ESM,
and fixed all the deprecation warning.
The only place I needed to silence them were tests,
as we import CJS there.

Bug: none
Change-Id: Iae4d2df76c855a9738b774a2d035f22509770215
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6138610
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-01-03 02:57:06 -08:00
Nikolay Vitkov 924fc2c153 [deps] Update StyleLint to v15.11
Info at https://stylelint.io/migration-guide/to-15
Our custom rule needed to be updated to reflect a small change.
All changes are separated into patches for ease of review.
More work is need for a v16 migration so separating it to reduce
risks of breaking.

Bug: none
Change-Id: I616829fba25b06bf8febe8390074046ad582f531
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6126881
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-01-03 01:57:35 -08:00
Benedikt Meurer 22a077e79e [eslint] Remove unused static-tag-must-be-static-property rule.
Bug: 370734442
Change-Id: I88925be37d6217f01764c02a6119ac6b30acb2a8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6126882
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
2025-01-02 05:39:55 -08:00
Nikolay Vitkov 55adf677d3 [eslint] Migrate to Flat config
A necessary step to adopt EsLint v9.
More can be read at - https://eslint.org/blog/2022/08/new-config-system-part-2/
In short - only a single configuration is used a cross the whole repo.

Bug: none
Change-Id: I74cd613fba25b94cee92e4b7c1b525471bcbe44b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6059264
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
2025-01-02 04:58:36 -08:00
Nikolay Vitkov 04cca9f499 [cleanup] Remove dead code
Reland of https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6070376

Now that devtools-frontend is merged directly into chromium,
we can safely remove this.

Bug: none
Change-Id: I882e3f58a71eab50485eb0ef23b398154d784531
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6110744
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Nikolay Vitkov <nvitkov@chromium.org>
Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2025-01-02 04:29:39 -08:00