Add ESLint and Prettier to the WebXR client - #421
Conversation
📝 WalkthroughWalkthroughThis 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)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (11)
deps/cloudxr/webxr_client/.prettierignoredeps/cloudxr/webxr_client/.prettierrcdeps/cloudxr/webxr_client/eslint.config.jsdeps/cloudxr/webxr_client/helpers/WebGLStateApply.tsdeps/cloudxr/webxr_client/helpers/WebGLStateBinding.tsdeps/cloudxr/webxr_client/helpers/controlChannel.tsdeps/cloudxr/webxr_client/package.jsondeps/cloudxr/webxr_client/src/App.tsxdeps/cloudxr/webxr_client/src/CloudXR2DUI.tsxdeps/cloudxr/webxr_client/src/CloudXRUI.tsxdeps/cloudxr/webxr_client/src/index.html
|
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 |
26aa7d5 to
b67cd2c
Compare
Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>
Signed-off-by: Yanzi Zhu <yanziz@nvidia.com>
b67cd2c to
1b30121
Compare
…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>
Description
Add ESLint and Prettier configuration to the WebXR client so TypeScript, React, imports, and formatting can be checked and fixed consistently.
This change:
Related issue: None.
Type of change
Testing
npm run formatnpm run format:checkSKIP=check-copyright-year pre-commit run --all-filesdeps/cloudxr/webxr_client/.prettierrcChecklist
SKIP=check-copyright-year pre-commit run --all-filesgit commit -s) per the DCOSummary by CodeRabbit
Chores
Style