Add Lint and Prettier to CXR.js example#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)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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
| { | ||
| "semi": true, | ||
| "singleQuote": true, | ||
| "tabWidth": 2, | ||
| "trailingComma": "es5", | ||
| "printWidth": 100, | ||
| "arrowParens": "avoid", | ||
| "endOfLine": "auto" | ||
| } |
There was a problem hiding this comment.
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.
|
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 |
Adds ESLint and Prettier formatting to webxr_client, via 'npn run format'. And runs it.
Summary by CodeRabbit
Chores
Style