chore: explicitly import node process#2685
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis pull request standardises explicit Node.js ChangesNode Process Import Standardisation
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
lunaria/lunaria.ts (1)
100-100: 💤 Low valueRedundant optional chain on a non-nullable
locale.
localeis an element ofappLocales(a filteredArray), so it is neverundefinedornullat this point. The?.onlocale?.diris unnecessary.♻️ Proposed fix
- dir: locale?.dir ?? 'ltr', + dir: locale.dir ?? 'ltr',🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lunaria/lunaria.ts` at line 100, The optional chaining on locale (locale?.dir) is redundant because locale is sourced from appLocales (a filtered Array) and cannot be null/undefined here; replace locale?.dir with locale.dir and keep the fallback 'ltr' intact so the line becomes dir: locale.dir ?? 'ltr', updating the expression in lunaria.ts where locale is used.test/unit/modules/security-headers.spec.ts (1)
51-54: ⚡ Quick winUse
vi.stubEnvinstead ofdelete process.env.TESTto ensure proper env restoration.
delete process.env.TESTmutates the global environment without restoring it. Ifprocess.env.TESTwas set before this suite (e.g., by the test runner or a vitest setup file), the deletion leaks — other test files sharing the same worker process that rely onprocess.env.TEST(e.g.,modules/build-env.tstests) may behave unexpectedly.vi.stubEnvstubs the value per-test and automatically restores the original after each test.🛠️ Proposed fix
beforeEach(() => { - delete process.env.TEST useNuxt.mockReset() + vi.stubEnv('TEST', undefined) })No
afterEachcleanup is needed; Vitest restores stubbed env vars automatically after each test.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/unit/modules/security-headers.spec.ts` around lines 51 - 54, The beforeEach currently mutates the global env by doing delete process.env.TEST; replace that with a per-test stub using vi.stubEnv({ TEST: undefined }) inside the same beforeEach so Vitest will restore the original value automatically, and keep the useNuxt.mockReset() call; remove any manual afterEach cleanup for TEST because vi.stubEnv handles restoration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@lunaria/lunaria.ts`:
- Line 100: The optional chaining on locale (locale?.dir) is redundant because
locale is sourced from appLocales (a filtered Array) and cannot be
null/undefined here; replace locale?.dir with locale.dir and keep the fallback
'ltr' intact so the line becomes dir: locale.dir ?? 'ltr', updating the
expression in lunaria.ts where locale is used.
In `@test/unit/modules/security-headers.spec.ts`:
- Around line 51-54: The beforeEach currently mutates the global env by doing
delete process.env.TEST; replace that with a per-test stub using vi.stubEnv({
TEST: undefined }) inside the same beforeEach so Vitest will restore the
original value automatically, and keep the useNuxt.mockReset() call; remove any
manual afterEach cleanup for TEST because vi.stubEnv handles restoration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: bdca9202-62dc-4c73-a6cb-3261b1838570
📒 Files selected for processing (10)
lunaria/lunaria.tsmodules/build-env.tsmodules/security-headers.tsscripts/find-invalid-translations.tsscripts/generate-file-tree-sprite.tsscripts/next-version.tsscripts/remove-unused-translations.tsscripts/unocss-checker.tstest/unit/modules/security-headers.spec.tsuno.config.ts
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
No description provided.