Commit Graph
103 Commits
Author SHA1 Message Date
Kriti Sapra ef6988a729 [CSS Migration]: Added ESLint rule to ensure wasShown methods contain call to super.wasShown()
Bug: 1106746
Change-Id: I7c1289f29e8b8c40e25ba37098d8c7d69e781d50
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2988310
Commit-Queue: Kriti Sapra <kritisapra@google.com>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-06-29 09:22:02 +00:00
Kriti Sapra 5c3434c51b [CSS Migration] Added ESLint rule that bans <style> tags being used in LitHtml templates
Bug: 1106746
Change-Id: I0701fdb0c38c2fdb43df60bb80f54075ad58f592
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2988306
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Kriti Sapra <kritisapra@google.com>
2021-06-28 11:35:20 +00:00
Tim van der Lippe 465ceddbdb Update assertNotNull to also check for undefined
The `NonNullable` type in TypeScript already excludes `undefined`
from the possible types, but we weren't properly checking for
it in the if-statement.

R=szuend@chromium.org
CC=pfaffe@chromium.org

Bug: none
Change-Id: I9320f0c7662d46d562d6544f35d45380043d4409
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2960173
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-14 13:56:44 +00:00
Kriti Sapra 3937e6f1f8 Added ESLint rule to ensure all .css.js files that are being
imported exist in the file system.

Initally, we wanted to create a `.d.ts` file for each CSS file to
ensure that the file being imported actually exists. However, when
ninja is building `tsc` uses the generated `tsconfig` file in `gen`.
In the `tsconfig.json` `files` list it will see the original TS file
that's in the source tree. When it goes to see the TS file and sees
the `import styles from 'foo.css.js'`. However, that file does not
exist in the files list of the entrypoint or the source tree, so TS
never finds it.

Instead we went with the approach of adding a `declare module` to type
all `.css.js` files and then use a lint rule to ensure that if you
import `foo.css.js` that there is a `foo.css` file in the tree.

Bug: 1106746
Change-Id: I8a65734bf4a9b359f8210b0011f14800c5d9426b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2953260
Commit-Queue: Kriti Sapra <kritisapra@google.com>
Commit-Queue: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-14 10:49:33 +00:00
Jan Scheffler 9245dae50b [ESLint] Add rule to prevent self closing custom elements
Bug: None
Change-Id: I082b787fb56159ef9465fe8f0b5c3d5623ab9890
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2955365
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-06-11 15:55:55 +00:00
Tim van der Lippe 4de48df446 Add rule to enforce deep equality comparisons for array assertions
Not every chai assertion uses deep comparisons. For arrays, we need
to make sure that not just the array itself, but also its contents
and its members are equal. There are only a subset of assertions
in chai that do that, so allow only these in our test assertions.

R=dsv@chromium.org

Fixed: 1218015
Change-Id: Ib7eb5864cf65a54ef17b9d637cd8e3b94323edb6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2950163
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Danil Somsikov <dsv@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Danil Somsikov <dsv@chromium.org>
2021-06-09 16:13:08 +00:00
Jack Franklin 082afdbe1f Remove components_import eslint rule
Now we've completed the move to LitHtml v2 and the static tags, we can
remove this rule as we don't need to rely on side-effect imports
anymore.

Bug: 1153077
Change-Id: I7967d6b1995fc77460ec7815d7ab08243553e567
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897283
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 13:41:10 +00:00
Jack Franklin e9f62582dd Lint for consistent component tag names in component definitions
This CL lints that for a given component that all the references to
its tag name are the same.

```
class Foo extends HTMLElement {
  // Check that this name
  static litTagName = LitHtml.literal\`devtools-foo\`
}

// And this name
ComponentHelpers.CustomElements.defineComponent('devtools-foo', Foo);

declare global {
  interface HTMLElementTagNameMap {
    // And this one are the same
    'devtools-foo': Foo
  }
}
```

Bug: 1153077
Change-Id: I29694449cb37950d1a5ff5391779e16e462926e2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2897279
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 12:57:20 +00:00
Jack Franklin b620bb41c9 Enforce event names and allow event name references
This CL updates our ESLint rule for custom event names:

* It changes it from wanting kebab-case to allonewordnopunctuation
* It allows references to CustomEvent.eventName for times when it's
  useful to define the event name as a static.

The CL therefore updates a variety of events through the codebase that
were kebab-case. go/building-ui-devtools has also been updated.

Fixed: 1176758
Change-Id: Ifbe9851bc2f6bbe9347ec886cc8c026248cc5c43
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2894389
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-14 10:39:29 +00:00
Jack Franklin dc7c24deae Lint for ${Foo.litTagName} in LitHtml templates
This CL lands the rule; I'll enable in a follow-up.

Bug: 1153077
Change-Id: I28a10fb99bbe7c8c2da7801e4e132653b28b0fc1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2891842
Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-13 08:35:28 +00:00
Jack Franklin 33b3951b92 Fix ESLint import extensions being missed
Bug: none
Change-Id: Ie3341a56224d7887b42c230ba966cc5eeba38fe4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2886932
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-12 14:30:57 +00:00
Jack Franklin 06ee0d9cf6 [Lit2] Lint against manual tag names
This CL adds an ESLint rule that bans the use of:

```
LitHtml.html`<devtools-foo>`
```

Because from now on we want to enforce:

```
LitHtml.html`<${Foo.litTagName}>`
```

I have disabled the rule in all locations where we do not yet do this,
and will be working to fix these problems over a series of CLs.


Bug: 1153077
Change-Id: I8d18243d0243ea1403d5d57dbeb32c8a9682d2dd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2876969
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-05-11 09:37:03 +00:00
Kriti Sapra 2597b415c1 Added linting rule to use helper function to define component
Bug: 1205825
Change-Id: I78ce8199dc599be1f1121e65b72b83a8f73733c4
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2878729
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Kriti Sapra <kritisapra@google.com>
2021-05-07 13:09:29 +00:00
Tim van der Lippe 5386d3bb32 Add ESLint rule to enforce custom element definition locations
This rule ensures that all custom element definitions are either
placed in `ui/components` or in a `components` sub-folder of
a panel. Since `inline_editor` and `ui/legacy` still have custom
element definitions in their respective folders, these are still
allowed for now.

R=jacktfranklin@chromium.org

Bug: 1206211
Change-Id: I137677ab947a8359d9164ddf1c7dfc421b6dfea9
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2874683
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-05-06 14:33:28 +00:00
Tim van der Lippe 6a9d241269 Update ESLint rule to handle nested folders properly
Before, the rule would incorrectly error on importing a sub-folder
from a top-level folder. E.g. if you would import
`elements/components/components.js` from a file in `elements/`.

By simplifying the logic, we change the behavior such that we now
more accurately reflect the behavior that Rollup uses.

R=jacktfranklin@chromium.org

Bug: none
Change-Id: I5a656552835bd3bbd86a8b5aaa65edaaf582f281
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2862787
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-30 14:28:13 +00:00
Tim van der Lippe 9bd3674c17 Reland "Fix acorn-loose entrypoint and remove its exemption"
This reverts commit 508aa46b98.

Reason for revert: Fixed compilation error

Original change's description:
> Revert "Fix acorn-loose entrypoint and remove its exemption"
>
> This reverts commit 1f3df9a2c0.
>
> Reason for revert: https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8848718136613443488/+/u/compile/stdout
>
> Original change's description:
> > Fix acorn-loose entrypoint and remove its exemption
> >
> > Third_party folders are no longer exempted from importing, to prevent
> > recompilation issues. As an example, crbug.com/1203165 showed that
> > upgrading a third_party package can introduce non-determinism.
> >
> > R=​jacktfranklin@chromium.org
> >
> > Bug: 1203165
> > Change-Id: I7bb3eb8b2038647ae0bef35bf21474c440177743
> > Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854674
> > Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
> > Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> > Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
>
> Bug: 1203165
> Change-Id: Ic2a6279bf48df0d79dd63a139b777b2a251322fb
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854682
> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Bug: 1203165
Change-Id: Id7d7427017edbc0228402e087e580133c36f1f46
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854683
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-28 10:43:34 +00:00
Tim van der Lippe 508aa46b98 Revert "Fix acorn-loose entrypoint and remove its exemption"
This reverts commit 1f3df9a2c0.

Reason for revert: https://logs.chromium.org/logs/devtools-frontend/buildbucket/cr-buildbucket.appspot.com/8848718136613443488/+/u/compile/stdout

Original change's description:
> Fix acorn-loose entrypoint and remove its exemption
>
> Third_party folders are no longer exempted from importing, to prevent
> recompilation issues. As an example, crbug.com/1203165 showed that
> upgrading a third_party package can introduce non-determinism.
>
> R=​jacktfranklin@chromium.org
>
> Bug: 1203165
> Change-Id: I7bb3eb8b2038647ae0bef35bf21474c440177743
> Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854674
> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>

Bug: 1203165
Change-Id: Ic2a6279bf48df0d79dd63a139b777b2a251322fb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854682
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-04-28 09:45:05 +00:00
Tim van der Lippe 1f3df9a2c0 Fix acorn-loose entrypoint and remove its exemption
Third_party folders are no longer exempted from importing, to prevent
recompilation issues. As an example, crbug.com/1203165 showed that
upgrading a third_party package can introduce non-determinism.

R=jacktfranklin@chromium.org

Bug: 1203165
Change-Id: I7bb3eb8b2038647ae0bef35bf21474c440177743
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2854674
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-28 09:08:53 +00:00
Tim van der Lippe 7d4f6c4889 Fix wasmparser integration
Prior to this fix, the wasmparser_worker entrypoint would include
specific files from third_party/wasmparser. However, since the
files were included as part of a separate package, rolling up the
target could cause issues. They should have been part of the
`sources` of the wasmparser_worker entrypoint, but they were instead
included as `deps`. Even better would be to not include specific
files from the wasmparser and instead use an entrypoint.

In the specific case reported in crbug.com/1203165, the wasmparser
implementation was updated. As such, GN reran
`third_party/wasmparser` and determined that
`entrypoints/wasmparser_worker:wasmparser_worker` required
recompilation (since one if its dependencies were updated. However,
since `entrypoints/wasmparser_worker:wasmparser_worker` wasn't
producing a different output, GN would determine that it wouldn't
have to run rollup. This conclusion is wrong and is an artifact of
the inclusion of specific files of `third_party/wasmparser` by
the entrypoint.

To fix this, we should rollup all relevant sources in
`third_party/wasmparser` instead. That way, whenever the wasmparser
implementation is updated, it will properly roll up its content
into its bundle, ready for consumption by the entrypoint.

R=jacktfranklin@chromium.org

Bug: 1203165
Change-Id: Ic29ddea0d1f8e953e11e71a6a0e4e65c5f0f1ad6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2853559
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-27 14:33:30 +00:00
Jan Scheffler ec7ade6441 [ESLint] Fix ui/components rule
Bug: chromium:1198900
Change-Id: I516051c82ca2388dcc63de02fcf69b68733db32e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2831445
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-16 15:37:35 +00:00
Jan Scheffler 7a9279607b [ESLint] Check ui/component imports
This cl adds an eslint rule to check ui/components imports
for a preceding side-effect import. If the side-effect could not
be found, it automatically adds one.

Bug: chromium:1198900
Change-Id: I66ac7c7a366029ab97455d91950dd2898893e807
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2831444
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-16 14:45:25 +00:00
Tim van der Lippe 7256e5e754 Move formatter_worker to entrypoints/formatter_worker
R=aerotwist@chromium.org

Bug: 1187573
Change-Id: I12afe682c2781651ff7cdc1650843010e2c8cbfd
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2826294
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-15 10:30:32 +00:00
Tim van der Lippe e622f55864 Move component_docs to ui/components/docs
R=jacktfranklin@chromium.org

Bug: 1187573
Change-Id: I2f8225ba1b9fc9848cf497ec0235756ace0f4831
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2826290
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-14 15:08:31 +00:00
Tim van der Lippe d75fee3703 Automatically fix filename in localization ESLint rule
With this change, running the presubmit will automatically update
the wrong paths to the correct value, saving a manual replacement.

R=szuend@chromium.org

Bug: none
Change-Id: Ib98d760d6fd4157aeba0dfed8a8c4496b33f5cc2
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2821816
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-04-13 17:02:06 +00:00
Tim van der Lippe 8499fe2ad0 Move data_grid to ui/legacy/components/data_grid
It also updates the ES Modules ESLint rule to allow for the import
from DataGrid to the legacy UI folder, as they are now nested.

R=aerotwist@chromium.org

Bug: 1187573
Change-Id: I8a6a577b10464216efafed10e62f24ca0c06e194
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2821870
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
2021-04-12 17:21:23 +00:00
Tim van der Lippe 9646971c47 Remove dagre_layout
This code is unused and will not be shipping with DevTools in the
near future. It is also third_party code, so we will need to follow
the third_party procedure if we want to add back this code.

R=aerotwist@chromium.org

Bug: 1187573
Change-Id: I83af5983bf5223dc167ac2d9c824b39a559df717
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2821875
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-04-12 16:42:33 +00:00
Tim van der Lippe aa61faf631 Move ui to ui/legacy
R=jacktfranklin@chromium.org

Bug: 1187573
Change-Id: Ifc536ba79b0a324aa38e76aa294c73cd699c6536
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2810839
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-04-07 16:06:59 +00:00
Jack Franklin 78bd9c00e3 Add lint rule for LitHtml.render calls
This CL adds a rule that ensures that any LitHtml.render call is
nested within a coordinator.write. It uses a fairly simple approach of
looking for a parent coordinator.write() call, but it should pick up most
cases.

Note this CL doesn't enable the rule; I'll do that in a follow-up. There
are 22 violations of the rule, so I will work on fixing those.

Bug: 1188116
Change-Id: Id73eaaa76db4685450086d2f77e7b2de322210d0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2799754
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-04-06 10:52:06 +00:00
Jan Scheffler b4eb22da3a [JSDOC2TS]: Migrate main
Bug: chromium:1158760
Change-Id: Ibe9b0fe480794bb788253a3b9902d4cc42a5ca2e
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2789347
Commit-Queue: Jan Scheffler <janscheffler@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-04-05 21:15:07 +00:00
Tim van der Lippe 68b974a3c3 Fix eslint import rule for nested folders
When source code is in nested folders, the es_modules_import rule
would incorrectly compute the containing folders from `front_end`.
Thus, if you would have two sibling folders in `front_end/panels`,
the rule would incorrectly determine that they are in the same
folder, while technically they are in a different folder.

Therefore, the logic is rewritten to compute the common prefix
of the two paths. If either one path ends up resolving to just
a file, we assume that they were both part of the same folder.
In other words: iff after removing the common prefix you still
are importing both paths across a folder boundary, they are
considered a different folder.

R=jacktfranklin@chromium.org

Bug: 1187573
Change-Id: Ib34583e258e005a124735e17e6a92e829eb37ef3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2773054
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-03-19 08:00:29 +00:00
Philip Pfaffe 92feb60a1a Add an eslint check to prevent crbugs at the beginning of an it()
There are a handful of e2e tests which test regressions, and consequently
have a bug assiciation. This association was part of the test names in
the same way as we reference bugs for skipped tests. If such a test is
then skipped it needs to start with two crbug references. That's
confusing for the reader as well as a the skipped test lint check, for
which the regression bug references can lead to false negatives. This CL
introduces a new lint check that prevents bug references in non-skipped
tests with the same syntax as skipped tests.

Bug: none
Change-Id: Ibdf59091aba942f85424c1f12cc31160d9fe786a
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2761357
Commit-Queue: Philip Pfaffe <pfaffe@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
2021-03-16 14:14:54 +00:00
Jack Franklin d9069b9a54 Allow shebang in ESLint license header check
Noticed when migrating a script to JS; we don't currently support
allowing a shebang at the top of a script, it gets put below the license
comment which is invalid.

This CL updates the rule to allow a shebang at the top of the file.

Bug: 1186163
Change-Id: I64a13b086452f3b7da93fa7c3dcd85521463cda7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2760242
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-03-15 16:11:23 +00:00
Wolfgang Beyer 9b0ae2b193 Remove non-exisiting file from license-header check
Bug: 1159334
Change-Id: Id0b7766aa382d2bedf2958ae73a65f2ac053fc3c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2753148
Auto-Submit: Wolfgang Beyer <wolfi@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2021-03-12 08:12:39 +00:00
Wolfgang Beyer 0878639185 Remove non-existing files from license-check exceptions
These files have been ported to TypeScript, which includes renaming and
adding our license header. Therefore there is no need for these
exceptions anymore.

Bug: none
Change-Id: I32d0109a19ace5b4bcb771d02beb2e23b5960e13
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2744778
Reviewed-by: Wolfgang Beyer <wolfi@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
2021-03-09 11:06:15 +00:00
Simon Zünd 9c1be4e096 [eslint] Add rule to remove unused UIStrings messages
R=petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: Ie4d210bae1bc3fbcf12316a19d28a7b894f3b3c8
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2735036
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2021-03-08 07:42:03 +00:00
Simon Zünd 4a49e2d048 [eslint] Fix bug in rule that looks at every top-level object literal
The rule looks up the 'name' attribute on the 'VariableDeclarator'
node, which does not exist, instead of the 'name' attribute on the
corresponding Identifier node.

This CL fixes that by extracting the Identifier check into a common
helper and adding a regression test.

R=petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: If82b24fb27f12a4ebd665b99daf5dea747bc866b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2734617
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2021-03-04 13:13:44 +00:00
Simon Zünd 333a8a04f0 [eslint] Rename l10n rule for fully locked and placeholder-only phrases
R=petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: I7b489153521770124f0846e530803d5aa26e5c9f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2734614
Auto-Submit: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
2021-03-04 13:07:54 +00:00
Simon Zünd b904628c78 [eslint] Prohibit l10n phrases consisting only of a sinlge placeholder
R=petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: I11726e1d58835a3c1acbba85d137fb2fa1cfc522
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2734474
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2021-03-04 10:19:02 +00:00
Simon Zünd 67789afce7 [eslint] Prohibit fully locked phrases in UIStrings object
Fully locked phrases should not go through translation. This CL adds
a new eslint rule that prevents the usage of phrases to UIStrings
where the whole phrase is locked.

R=petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: I131ee90c902a3a44070e1a57dd554e51eb1278f1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2732187
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2021-03-04 05:49:42 +00:00
Simon Zünd fb3246d320 [eslint] Only allow calls to i18nString under certain conditions
This CL heuristically prevents i18nString calls during module
instantiation time. Translated strings are most likely not available
yet (depending which module is loaded), so usually i18nLazyString
should be used instead.

The check looks at all the AST ancestor nodes of a call expression
and checks that function declaration and similar nodes are somewhere
on the ancestor chain. This DOES NOT guarantee that no calls to
i18nString are made but it is a good heuristic and the lint check
found a couple of wrong use-sites already that have been fixed
before this CL landed.

R=petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: I04199fc54935b88d142a793f407438a718a104d6
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2731567
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
2021-03-03 08:34:58 +00:00
Jack Franklin 02f0dbb824 Lint for commented out console.log calls
Fixed: 1183727
Change-Id: I7bb5a859fdab4c42693623e87a3763fe141a46e0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2729038
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-03-03 07:44:48 +00:00
Simon Zünd e15f3efe0a [eslint] Prevent the export of the UIStrings object
Sharing translations between files is not officially supported yet
and even if we would do so, the path will go most likely over the
module's respective ModuleUIStrings file (already happening in some
cases).

Note that this CL doesn't yet enable the rule, as it would touch
all files using UIStrings objects currently.

R=jacktfranklin@chromium.org, petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: I96aee4e214809d76d65a21962974e9cfb61e4f46
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2718298
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
2021-02-26 15:18:05 +00:00
Simon Zünd 5d16e121f4 [eslint] Check that the current file is passed to i18n.registerUIString
R=jacktfranklin@chromium.org, petermarshall@chromium.org

Bug: chromium:1180760
Change-Id: Ie47a89c003f309b678ef9da65cb860cceaa14e2b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2717763
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-02-24 09:29:16 +00:00
Tim van der Lippe 723456aabb Remove front_end/client-variations
All usages of client-variations now directly import the third_party
content. This was previously not possible with the module.json
infrastructure, but we can now directly import the relevant
files. Therefore, we can remove the module.json file itself and
the references to it in the module.json dependency hierarchy.

R=mathias@chromium.org

Bug: 1127902
Change-Id: I36d987ca3e645407879da0a81f305de5088711e5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2700731
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Mathias Bynens <mathias@chromium.org>
2021-02-22 15:36:34 +00:00
Alex Rudenko 27d120309b Allow skipping e2e tests for a particular platform
Adds it.skipOnPlatforms function to skip an e2e test only on given
platforms. For example,

it.skipOnPlatforms(['mac'], '[crbug.com/xxxx] test name', ..);

Bug: none
Change-Id: Ia73382628c92195adfae9eebbb426250a5a55973
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2703964
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
2021-02-19 08:27:25 +00:00
Jack Franklin 5bb7528e13 Update check_license_header rule with new year
It was inserting comments with 2020 in. I've updated it to figure out
the current year. This theoretically could cause problems if people are
either side of a year on New Years eve, but I'm hoping people are busy
not working then :D

Bug: none
Change-Id: I9f6cc9329189d89e6994cc0963fa70617cb446c3
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2696660
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
2021-02-16 12:53:28 +00:00
Jack Franklin 9e71e6a50f ESLint rule to ban interpolation within <style> tags
LitHtml strongly discourages this approach and it's one that often can
be avoided using CSS custom properties that are set from JavaScript, so
we're going to try to avoid its usage creeping into our codebase. We can
revisit if we hit upon a case where it's really needed.

Bug: chromium:1166108
Change-Id: Ib8c60d8670707b8f0e239d911ec569c64a3b1846
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2626294
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
2021-01-14 09:34:54 +00:00
Tim van der Lippe 28a79aace9 Move assertNotNull into platform
R=jacktfranklin@chromium.org

Fixed: 1154208
Change-Id: I3729d0f06577a3bb065ea362dec9e83d096965b1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2618318
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-01-11 17:14:27 +00:00
Tim van der Lippe f78841938e Fix lit_html_data_as_type to handle multiple data setters
R=jacktfranklin@chromium.org

Fixed: 1164372
Change-Id: Idcf5419de6a7d3fa9ae816c9b9e73b6a853cbf0d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2617793
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-01-08 14:46:57 +00:00
Tim van der Lippe 9264487850 Convert UIString.js to TypeScript-authored
This allows us to make follow-up changes to use TypeScript-specific
features.

R=jacktfranklin@chromium.org

Change-Id: Ie17a8e1101ca6e9800fab49bc560cce8001b58ca
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2612859
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
2021-01-07 16:33:36 +00:00