0
Commit Graph

8 Commits

Author SHA1 Message Date
3191020795 WebUI: Enable @typescript-eslint/require-await in build_webui_tests().
Also fixing a few remaining violations that were not already fixed in
precursor CLs.

Bug: 394634491
Change-Id: Id6d45210a1800653330d0105e1fe3013a27796d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6258153
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1419613}
2025-02-12 16:30:12 -08:00
af3c4fb362 [Reland] WebUI: Enable @typescript-eslint/require-await check in build_webui().
Reland notes: This is the 2nd part of the reland of the reverted CL at
crrev.com/c/6253018. The CL was incorrectly reverted, since the problem
was limited in the local dev environment of the person that was having
the issue, where third_party/node/ for some reason was stuck in v16 (a
very old version) instead of v22.

Enabling `enable_type_aware_eslint_checks` by default in build_webui().

Bug: 394634491
Change-Id: I35f77e4d3aef7af08ad06f1881d079e184c8153d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6254799
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418856}
2025-02-11 12:50:27 -08:00
9832bca736 Revert "WebUI: Enable @typescript-eslint/require-await check in build_webui()."
This reverts commit 32867d045f.

Reason for revert: Breaks the build.

FAILED: gen/ui/webui/resources/cr_components/cr_shortcut_input/eslint.config.mjs 
python3 ../../ui/webui/resources/tools/eslint_ts.py --in_folder gen/ui/webui/resources/cr_components/cr_shortcut_input/preprocessed --out_folder gen/ui/webui/resources/cr_components/cr_shortcut_input --config_base ../../../../../../../../ui/webui/resources/tools/eslint_ts.config_base.mjs --tsconfig tsconfig_build_ts.json --in_files cr_shortcut_input.ts cr_shortcut_input.html.ts cr_shortcut_util.ts
Traceback (most recent call last):
  File "/usr/local/google/home/sesse/chromium/src/out/Default/../../ui/webui/resources/tools/eslint_ts.py", line 78, in <module>
    main(sys.argv[1:])
  File "/usr/local/google/home/sesse/chromium/src/out/Default/../../ui/webui/resources/tools/eslint_ts.py", line 67, in main
    node.RunNode([
  File "/usr/local/google/home/sesse/chromium/src/third_party/node/node.py", line 38, in RunNode
    raise RuntimeError('Command \'%s\' failed\n%s' % (' '.join(cmd), err))
RuntimeError: Command '/usr/local/google/home/sesse/chromium/src/third_party/node/linux/node-linux-x64/bin/node /usr/local/google/home/sesse/chromium/src/third_party/node/node_modules/eslint/bin/eslint --color --quiet --config gen/ui/webui/resources/cr_components/cr_shortcut_input/eslint.config.mjs gen/ui/webui/resources/cr_components/cr_shortcut_input/preprocessed/cr_shortcut_input.ts gen/ui/webui/resources/cr_components/cr_shortcut_input/preprocessed/cr_shortcut_input.html.ts gen/ui/webui/resources/cr_components/cr_shortcut_input/preprocessed/cr_shortcut_util.ts' failed

Oops! Something went wrong! :(

ESLint: 9.10.0

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at Object.join (node:path:1172:7)
    at file:///usr/local/google/home/sesse/chromium/src/out/Default/gen/ui/webui/resources/cr_components/cr_shortcut_input/eslint.config.mjs?mtime=1739278158700:10:26
    at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
    at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
    at async loadFlatConfigFile (/usr/local/google/home/sesse/chromium/src/third_party/node/node_modules/eslint/lib/eslint/eslint.js:390:21)
    at async calculateConfigArray (/usr/local/google/home/sesse/chromium/src/third_party/node/node_modules/eslint/lib/eslint/eslint.js:473:28)

Original change's description:
> WebUI: Enable @typescript-eslint/require-await check in build_webui().
>
>  - Enabling `enable_type_aware_eslint_checks` by default in build_webui().
>  - Fixing a few remaining violations that were not already fixed in
>    precursor CLs.
>  - Fix the dependnecies of the ":lint" target for the case of
>    `use_javascript_coverage=true`
>  - Add a new "ESLint checks" section in styleguide/web/web.md explaining
>    the two different types of ESLint checks.
>  - Update Chromium styleguide additions to include what will be
>    enfroced by @typescript-eslint/require-await as part of this CL,
>    and @typescript-eslint/no-unnecessary-type-assertion in upcoming
>    CLs.
>
> Bug: 394634491
> Change-Id: I59a07d4e76339449c3e5ff79608b57154a3e32cb
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6250398
> Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
> Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1418375}

Bug: 394634491
Change-Id: Iccfa9b2c94f608e193f95a7fe454abbec3c3f3b4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6253018
Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
Auto-Submit: Steinar H Gunderson <sesse@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Owners-Override: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418592}
2025-02-11 05:49:25 -08:00
32867d045f WebUI: Enable @typescript-eslint/require-await check in build_webui().
- Enabling `enable_type_aware_eslint_checks` by default in build_webui().
 - Fixing a few remaining violations that were not already fixed in
   precursor CLs.
 - Fix the dependnecies of the ":lint" target for the case of
   `use_javascript_coverage=true`
 - Add a new "ESLint checks" section in styleguide/web/web.md explaining
   the two different types of ESLint checks.
 - Update Chromium styleguide additions to include what will be
   enfroced by @typescript-eslint/require-await as part of this CL,
   and @typescript-eslint/no-unnecessary-type-assertion in upcoming
   CLs.

Bug: 394634491
Change-Id: I59a07d4e76339449c3e5ff79608b57154a3e32cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6250398
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418375}
2025-02-10 16:44:58 -08:00
916a6d3b8a WebUI: Support ESLint type aware checks in build_webui().
Type-aware ESLint checks (see [1], [2]) can do more sophisticated checks
compared to non type-aware checks which run during presubmit.

- Implement a new `eslint_ts()` GN rule along with corresponding
  tests.
- Hook it up to `build_webui()`.
- Guard it with a new `enable_type_aware_eslint_checks` flag that
  defaults to `false`.

The new flag will be enabled on a target-by-target basis or as a whole
once existing violations are fixed. Initially applying only
@typescript-eslint/require-await when the flag is enabled. More checks
will be added eventually.

[1] https://typescript-eslint.io/rules/?=typeInformation
[2] https://typescript-eslint.io/getting-started/typed-linting/

Bug: 394634491
Change-Id: Id2255656786fc144f95801f399bc34520c910cca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5252273
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417633}
2025-02-07 16:08:55 -08:00
543280cdac WebUI: Add docs about the --load-webui-from-disk mechanism.
Also, add a "Debugging tests" section in docs/webui/testing_webui.md.

Bug: 384636724
Change-Id: I6f8ec591b336c5011605d197a7013b40ba84628e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6194072
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1410751}
2025-01-24 00:03:25 -08:00
0993479170 Move more WebUI docs under docs/webui/ folder, fix broken links.
Bug: None
Change-Id: I5d5589951e383176893e0947fd72201b7a665d6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6192917
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Auto-Submit: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1410389}
2025-01-23 08:59:50 -08:00
32c8dd9d55 Move all WebUI docs under docs/webui/ folder.
As part of the move, deleting the obsolete docs/webui_in_components.md.

Bug: None
Change-Id: I63c70377482468cd9e541a06c45a243b00b0959e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6186711
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1409815}
2025-01-22 11:05:16 -08:00