Skip to content

Add Lint and Prettier to CXR.js example#421

Open
gareth-morgan-nv wants to merge 2 commits intomainfrom
gmorgan/Lint
Open

Add Lint and Prettier to CXR.js example#421
gareth-morgan-nv wants to merge 2 commits intomainfrom
gmorgan/Lint

Conversation

@gareth-morgan-nv
Copy link
Copy Markdown
Contributor

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

Adds ESLint and Prettier formatting to webxr_client, via 'npn run format'. And runs it.

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
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

📝 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
Title check ✅ Passed The title 'Add Lint and Prettier to CXR.js example' accurately summarizes the main objective of the PR, which is to introduce linting and code formatting tooling to the WebXR client project.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 on lines +1 to +9
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"printWidth": 100,
"arrowParens": "avoid",
"endOfLine": "auto"
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add REUSE metadata for .prettierrc.

This new file has no SPDX metadata. For JSON config, add a REUSE sidecar license file (e.g., .prettierrc.license) or switch to a JS-based Prettier config that can carry the SPDX header block.

As per coding guidelines **/*: Files require SPDX-FileCopyrightText and SPDX-License-Identifier headers in the form the repo already uses (e.g., HTML comment block format as in README.md), as enforced by the REUSE hook.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deps/cloudxr/webxr_client/.prettierrc` around lines 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.

@yanziz-nvidia
Copy link
Copy Markdown
Contributor

There's already lint in pre-commit?

@jiwenc-nv
Copy link
Copy Markdown
Collaborator

jiwenc-nv commented Apr 30, 2026

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?

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