Skip to content

Add ESLint and Prettier to the WebXR client - #421

Merged
yanziz-nvidia merged 2 commits into
mainfrom
gmorgan/Lint
Jul 30, 2026
Merged

Add ESLint and Prettier to the WebXR client#421
yanziz-nvidia merged 2 commits into
mainfrom
gmorgan/Lint

Conversation

@gareth-morgan-nv

@gareth-morgan-nv gareth-morgan-nv commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Description

Add ESLint and Prettier configuration to the WebXR client so TypeScript, React, imports, and formatting can be checked and fixed consistently.

This change:

  • adds ESLint flat configuration for TypeScript, React, React Hooks, and import sorting
  • adds Prettier configuration and ignore rules
  • adds npm scripts and development dependencies for linting and formatting
  • formats the existing WebXR client sources with the new configuration
  • adds REUSE metadata for the extensionless Prettier configuration

Related issue: None.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Testing

  • npm run format
  • npm run format:check
  • SKIP=check-copyright-year pre-commit run --all-files
  • Direct REUSE validation of deps/cloudxr/webxr_client/.prettierrc

Checklist

  • I have read and understood the contribution guidelines
  • I have run the linter and formatter with SKIP=check-copyright-year pre-commit run --all-files
  • I have made corresponding changes to the documentation (not applicable; this changes developer tooling only)
  • I have added tests that prove my fix/feature works (not applicable; the formatter and linter checks validate this configuration)
  • I have signed off all my commits (git commit -s) per the DCO

Summary by CodeRabbit

  • Chores

    • Added ESLint and Prettier configuration with TypeScript and React support for improved code quality.
    • Integrated ESLint plugins for TypeScript, React Hooks, and import sorting enforcement.
    • Added development dependencies for code formatting and linting automation.
  • Style

    • Reorganized imports and standardized code formatting throughout components.
    • Normalized HTML markup and CSS structure with enhanced responsive and accessibility styling.

@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request adds code quality and formatting infrastructure to the WebXR client project. It introduces Prettier configuration for code formatting, ESLint flat configuration for linting, and new npm scripts for automated format checking and fixing. Import statements across multiple TypeScript and React source files are reorganized, and various files undergo formatting adjustments (line collapses, spacing normalization). The HTML template and CSS are reformatted with reorganized styling rules for responsiveness and accessibility. No functional behavior or control flow logic is altered.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding ESLint and Prettier support to the WebXR client.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gmorgan/Lint

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@deps/cloudxr/webxr_client/.prettierrc`:
- Around line 1-9: The new JSON config (.prettierrc) lacks REUSE SPDX metadata;
either add a sidecar license file named .prettierrc.license next to .prettierrc
containing the required SPDX-FileCopyrightText and SPDX-License-Identifier
headers in the repo’s HTML-style comment format, or convert .prettierrc to a JS
config (e.g., .prettierrc.js) and prepend the same SPDX header block as a
comment at the top; ensure the headers match the repo’s existing format so the
REUSE hook accepts it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c256dec1-cab1-4c4e-9383-c190f6b4d92d

📥 Commits

Reviewing files that changed from the base of the PR and between 256f76f and 26aa7d5.

📒 Files selected for processing (11)
  • deps/cloudxr/webxr_client/.prettierignore
  • deps/cloudxr/webxr_client/.prettierrc
  • deps/cloudxr/webxr_client/eslint.config.js
  • deps/cloudxr/webxr_client/helpers/WebGLStateApply.ts
  • deps/cloudxr/webxr_client/helpers/WebGLStateBinding.ts
  • deps/cloudxr/webxr_client/helpers/controlChannel.ts
  • deps/cloudxr/webxr_client/package.json
  • deps/cloudxr/webxr_client/src/App.tsx
  • deps/cloudxr/webxr_client/src/CloudXR2DUI.tsx
  • deps/cloudxr/webxr_client/src/CloudXRUI.tsx
  • deps/cloudxr/webxr_client/src/index.html

Comment thread deps/cloudxr/webxr_client/.prettierrc
@yanziz-nvidia

Copy link
Copy Markdown
Collaborator

There's already lint in pre-commit?

@jiwenc-nv

jiwenc-nv commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

There's already lint in pre-commit?

we only have ruff for Python: https://github.com/NVIDIA/IsaacTeleop/blob/main/.pre-commit-config.yaml#L5C40-L5C55

@gareth-morgan-nv can we add the js lint into pre-commit-config as well?

@jiwenc-nv
jiwenc-nv marked this pull request as draft July 24, 2026 20:04
@yanziz-nvidia
yanziz-nvidia marked this pull request as ready for review July 30, 2026 04:34
gareth-morgan-nv and others added 2 commits July 29, 2026 21:36
Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>
Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>
@yanziz-nvidia yanziz-nvidia changed the title Add Lint and Prettier to CXR.js example Add ESLint and Prettier to the WebXR client Jul 30, 2026
@yanziz-nvidia
yanziz-nvidia enabled auto-merge (squash) July 30, 2026 04:42
@yanziz-nvidia
yanziz-nvidia merged commit 745559b into main Jul 30, 2026
42 checks passed
@yanziz-nvidia
yanziz-nvidia deleted the gmorgan/Lint branch July 30, 2026 04:56
yanziz-nvidia added a commit that referenced this pull request Jul 30, 2026
…857)

* feat(web): bump to 6.3.0-rc2 and adopt new metrics, quality score, logs (#841)

* feat(cloudxr): bump to 6.3.0-rc2 and adopt new metrics, quality score, logs

Bumps the CloudXR Web SDK from 6.2.0 to 6.3.0-rc2 and adopts the streaming
diagnostics it adds. The bump itself is API-compatible: everything new is
additive (3 SessionOptions fields, 3 delegates, 1 Session method, 17
MetricsName entries, a PerNetwork cadence), and the client builds against
rc2 unchanged.

Session quality and pose send FPS
- Surface MetricsName.SessionQuality (0-4) as a 4-bar signal-strength indicator
  on the in-XR HUD, so an operator can see a degrading link before acting on it
  rather than inferring it from raw FPS.
- Add a Pose Send FPS card. It measures the uplink command rate, which is what
  distinguishes "the video is choppy" from "the robot isn't getting my commands".
- Clear both on disconnect so a dead stream cannot show a stale green reading.

Body tracking capability detection (bug fix)
- Pump sendTrackingStateToServer() while the session is Connecting. The SDK
  derives body-tracking support from XRSession.enabledFeatures, which it can only
  read from frames delivered before the stream starts. The render loop previously
  returned early on state !== Connected, so the SDK never saw such a frame and
  full-body teleop could silently degrade to hand/controller only despite the
  client requesting bodyTracking.
- Deliberately passes the raw xrFrame rather than trackingFrameAdapter's: during
  replay the adapter returns a Proxy with a substituted session, and capability
  detection must reflect the real XRSession.

Metrics to the OOB teleop hub
- Report all 21 SDK metrics across the render/frame/network cadences, keyed by
  CloudXR.MetricsName, instead of the previous three. New MetricsAccumulator
  merges the SDK's partial callbacks so a metric absent from one tick is not
  reported as zero, and resets between sessions.
- oob_teleop_hub.py needs no change: it already stores metrics as an arbitrary
  {name: value} map per cadence.

SDK logs
- Mirror SDK log entries to the browser console at matching severity. The
  onLog/logLevel API existed in 6.2.0; rc2 adds the log content worth surfacing.

Pre-stream network test
- Wire up the SDK's network test with an in-XR countdown and traffic-light
  result, defaulting to off: the test holds the session in Connecting for its
  whole window, and an operator connecting to a robot should not be gated on it.
  Opt in via the settings panel or ?streamTestMode=warn.
- Clamp the configured duration to the [5, 30] second range the SDK accepts, so
  the on-panel countdown cannot promise a window shorter than the one that runs.
- Gate message-channel setup on isConnected, not just a non-null session.
  Opening a channel sends a control message that requires a connected session,
  which would fail during the test window and break the teleop control channel.

Microphone capture and clientToken/signalingHeaders are available in rc2 but not
adopted: the former is an unnecessary permission prompt for robot teleop, and the
latter targets Stream Manager auth rather than this direct-connect deployment.

Frame-rate negotiation was reviewed and left unchanged: this client already
applies the target rate before session creation and passes the effective rate to
CloudXR.

Also drops the isaac/ requirement from the local-tarball layout check, since that
directory is no longer part of the SDK release bundle.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>

* fix(cloudxr): clear HUD metric cards when the session ends

renderFps, poseSendFps and streamingMetrics are module-scoped signals that were
never cleared, so after a disconnect the in-XR panel kept drawing the previous
session's FPS and latency as if they were live. Same class of staleness the
session-quality reset already guarded against, but for the numeric cards.

Clears them alongside metricsAccumulator.reset() on Disconnected/Error only, so
the 'Testing network' transition into a session is unaffected. The computed
texts already fall back to '-' on null, so the cards read as empty rather than
zero.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>

---------

Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Add ESLint and Prettier to the WebXR client (#421)

* Add lint config files

Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>

* Run format

Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>

---------

Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>
Co-authored-by: Yanzi Zhu <yanziz@nvidia.com>

---------

Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Gareth Morgan <gmorgan@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants