Commit Graph
1632 Commits
Author SHA1 Message Date
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
Benedikt Meurer 8fbdd974ef [eslint] Add no-customized-builtin-elements rule.
Introduce an ESLint rule to disallow customized built-in elements from
being introduced, since these don't work (at all) in Safari and aren't
compatible with the Vision for the Chrome DevTools UI Engineering[^1].

[^1]: http://go/chrome-devtools:ui-engineering-proposal

Fixed: 386453980
Change-Id: I16b61f8209d2d5094bb0d6e81fba9cae7f2d9687
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6113688
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2024-12-30 13:31:48 -08:00
Benedikt Meurer e6282b1769 [eslint] Prefer assert.instanceOf and assert.notInstanceOf.
This is both more readable and generates a more meaningful error message
when the assertion fails.

Bug: 386335487
Change-Id: Ib41beec5951c3e38dfad1503e4f368dcc7aabfbb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6110490
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2024-12-30 06:31:52 -08:00
Benedikt Meurer 7b03afad22 [eslint] Comparisons with object and array literals must be deep.
The previous check was too restricted in that it only checked for
array literals, and didn't bother also checking for object literals.
It was also not restricted to just the `assert.strictEqual` and the
`assert.notStrictEqual` methods, and unnecessarily prevented us from
using for example `assert.hasAnyKeys` or `assert.sameMembers`, which
is clearly beneficial in various cases.

This new check also provides a fix.

Bug: 40185458
Change-Id: I1b151cf8eb594b7255c77380967aea39a46ee2cd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6110248
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Changhao Han <changhaohan@chromium.org>
2024-12-30 03:24:19 -08:00
Benedikt Meurer 6fed9bc827 [eslint] Remove obsolete migrate-* rules.
These were temporarily used to migrate the style sheet approach, and
are no longer required.

Bug: 40140559
Change-Id: If2da715009576897f6f5ed343856138369d17eb6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6113683
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2024-12-30 03:15:34 -08:00
Benedikt Meurer a74dbac647 [eslint] Auto-fix support for prefer-readonly-keyword rule.
Bug: 40158772
Change-Id: I4d28d3c7a324783e96500499d676b9715018cc20
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6110406
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2024-12-30 03:15:34 -08:00
Benedikt Meurer b434f78c13 [cleanup] Remove obsolete lit-no-style-interpolation rule.
This ESLint rule has been ineffective for almost 4 years now, since the
introduction of the no-style-tags-in-lit-html ESLint rule, which
disallows any `<style>` tags within lit-html templates altogether.

Bug: 40140559
Change-Id: If9dc3bdc3d803745ba2a4a1d2f9f977ed065ba80
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6110229
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2024-12-30 02:07:46 -08:00
Benedikt Meurer 3832e30baf [cleanup] Remove obsolete no-repeated-tests ESLint rule.
The custom `repeat()` method was removed in https://crrev.com/c/5804334,
so there's no need to keep this ESLint rule - whose only purpose was to
check that no one accidentally commits an `it.repeat()` call in E2E
tests.

Bug: 40138497
Change-Id: If42e4d2683b81393d143a14f29edab51cd565a85
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6120410
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2024-12-30 02:06:41 -08:00
Benedikt Meurer fb31435bfb Consistently prefer assert.isOk and assert.isNotOk.
`assert.ok` is an alias for `assert.isOk`, and similarly `assert.notOk`
is an alias for `assert.isNotOk`. For consistency with other assertions
such as `assert.isNull` and `assert.isNotNull`, we enforce the use of
the slightly longer form here as well.

Bug: 386335487
Change-Id: If845a5675a78598d01b30532985239f74f701db7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6120409
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Changhao Han <changhaohan@chromium.org>
2024-12-30 00:33:56 -08:00
Benedikt Meurer 5cb9f987f7 Disallow equality assertions with boolean, null, and undefined.
Require the more descriptive `assert.isTrue`, `assert.isFalse`,
`assert.isNull`, `assert.isUndefined`, and friends instead, which also
produce a more meaningful error message than the generic
`assert.strictEqual`, `assert.deepEqual`, and friends.

Bug: 386335487
Change-Id: Ic58a07381196c358a43857b53364d74076e9c7e8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6113833
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2024-12-30 00:32:53 -08:00
Benedikt Meurer e5afea232d Consistently prefer assert.lengthOf to check array-like lengths.
In our tests, we should stick to ideally just one way of asserting
array-like lengths, `assert.lengthOf`, and avoid any kind of
combinations `assert.equal`,`assert.strictEqual`, `assert.deepEqual`,
or `assert.deepStrictEqual`.

Bug: 386335487
Change-Id: I8f88e214acdae0c6e34dbb169c62ebc9a80317af
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6113832
Reviewed-by: Changhao Han <changhaohan@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
2024-12-30 00:31:50 -08:00