Commit Graph
7 Commits
Author SHA1 Message Date
Sigurd Schneider 17c7445384 Enforce camelCase for variables..
..except for top-level `const` for which we allow
camelCase, PascalCase and UPPER_CASE for the time being
to accomodate the status quo in DevTools FE.

Also allow `UIStrings` and `str_` which are used for localization
all over the place.

Bug: chromium:1057042
Change-Id: Ifa0445ac08c78997499ac5f9f33c9a9dc03d37fb
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692779
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
2021-02-15 13:08:10 +00:00
Sigurd Schneider 91147d8f00 Enforce camelCase for functions
Bug: chromium:1057042
Change-Id: I6a3e3dcf810884129420e0deaf0e6d54874b5449
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692211
Reviewed-by: Mathias Bynens <mathias@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Auto-Submit: Sigurd Schneider <sigurds@chromium.org>
2021-02-15 11:16:45 +00:00
Peter Marshall 7d6cb71a30 [l10n] Add unit tests for serializing UI strings, rm old implementation
Remove the old UIStrings serialize/deserialize implementation which we
are not using anymore and delete its unit tests.

Add unit tests for the new implementation in i18n.

Bug: 1136655
Change-Id: Ia2678cd29769cc26863c5b833968eb3b24b1a9b7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2659026
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-02-01 13:05:24 +00:00
Peter Marshall c26a24faaa [surveys] Make the survey prompt text injectable by the caller
As a drive-by, add a localized empty string constant so that
we can intialize class members with it, and so that we can avoid
having empty strings in multiple translation files as we do right
now.

Also rename the component_docs directory which still referred to
issues.

Bug: 1112738
Change-Id: I68bc11286e3b4c83f0a3bf4dbbcf1fb1932764b0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2643508
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2021-01-22 12:27:13 +00:00
Tim van der Lippe e2ffb37426 Remove Closure-related types in legacy-defs
These were necessary during the migration towards TypeScript, but
can be removed now that Closure is gone.

R=jacktfranklin@chromium.org

Bug: 1011811
Change-Id: Ie5ceb46fae590689762f7a55ebed8d4117b077b5
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2624712
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-12 16:49:41 +00:00
Tim van der Lippe 3b1f7453a7 Make UIString and i18n return tagged localized strings
The LocalizedString type alias in UIString.js is a so-called
"branded type". A branded type alias allows us to construct
special types in type-casts and enforce that these specific
alias are used. The following properties hold:

1. A string can be force-casted into a LocalizedString
2. A LocalizedString can be enforced as argument type
3. A LocalizedString can be downcasted/used as regular string
4. A LocalizedString can normally not be concatenated, unless
force-casts are added (which is strongly discouraged, since
localization can be structure-dependent)

These properties are for example used to enforce that all titles
of the ViewRegistration declarations are localized strings. I have
manually verified that passing in a regular string will correctly
cause TypeScript to error.

The new i18n localization system uses the same force-cast to make
sure that the new localized strings also adhere to the same
structure.

As a result of this change, I discovered several inconsistencies
in how types were used. For example, strings were being passed
in and assumed to be localized, but not enforced. Therefore,
this CL contains several cleanups that require the LocalizedString
itself and hence have to be bundled in this CL.

R=petermarshall@chromium.org

Change-Id: I2faffde47069c900e2e5e7c0ebb460d0792d2935
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2612861
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2021-01-08 12:39:52 +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