fix: use node: protocol prefix for built-in module imports#63
fix: use node: protocol prefix for built-in module imports#63sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZzYE2GlPf0LcAuwqQVT for typescript:S7772 rule - AZzYE2GlPf0LcAuwqQVU for typescript:S7772 rule - AZzYE2GlPf0LcAuwqQVV for typescript:S7772 rule Generated by SonarQube Agent (task: 6a38416b-973d-4e2c-85b8-c8c53fd05ece)
|
|
Summary
Three built-in Node.js module imports in What reviewers should knowThis is a minimal, syntax-only change affecting only import statements. No runtime behavior is altered. Reviewers should verify:
|
There was a problem hiding this comment.
LGTM! ✅
Clean, focused change that correctly applies the node: protocol prefix to the three built-in imports in src/credential-setup.ts. The fix is compatible with the project's Node.js 20 + TypeScript 5.7 + ES2022 toolchain, and it aligns this file with the convention already established in src/retry.ts.
Note that src/credential-guard-post.ts still imports fs/promises, os, and path without the node: prefix — a follow-up PR to standardise the remaining files would complete the migration.



Add the
node:protocol prefix to built-in module imports (fs/promises, os, path) in credential-setup.ts to fix SonarQube issues S7772. This improves code clarity, prevents potential naming conflicts with npm packages, and aligns with modern Node.js best practices.View Project in SonarCloud
Fixed Issues
typescript:S7772 - Prefer `node:fs/promises` over `fs/promises`. • MINOR • View issue
Location:
src/credential-setup.ts:2Why is this an issue?
When importing Node.js built-in modules, using the
node:protocol makes it explicitly clear that you’re importing a core Node.js module rather than a third-party package from npm.What changed
This hunk adds the
node:protocol prefix to three Node.js built-in module imports insrc/credential-setup.ts. It changes'fs/promises'to'node:fs/promises','os'to'node:os', and'path'to'node:path'. This directly fixes all three static analysis warnings about preferring thenode:protocol for built-in module imports, which improves clarity (making it obvious these are core Node.js modules), security (preventing potential confusion with similarly-named npm packages), and consistency with modern Node.js best practices.typescript:S7772 - Prefer `node:os` over `os`. • MINOR • View issue
Location:
src/credential-setup.ts:3Why is this an issue?
When importing Node.js built-in modules, using the
node:protocol makes it explicitly clear that you’re importing a core Node.js module rather than a third-party package from npm.What changed
This hunk adds the
node:protocol prefix to three Node.js built-in module imports insrc/credential-setup.ts. It changes'fs/promises'to'node:fs/promises','os'to'node:os', and'path'to'node:path'. This directly fixes all three static analysis warnings about preferring thenode:protocol for built-in module imports, which improves clarity (making it obvious these are core Node.js modules), security (preventing potential confusion with similarly-named npm packages), and consistency with modern Node.js best practices.typescript:S7772 - Prefer `node:path` over `path`. • MINOR • View issue
Location:
src/credential-setup.ts:4Why is this an issue?
When importing Node.js built-in modules, using the
node:protocol makes it explicitly clear that you’re importing a core Node.js module rather than a third-party package from npm.What changed
This hunk adds the
node:protocol prefix to three Node.js built-in module imports insrc/credential-setup.ts. It changes'fs/promises'to'node:fs/promises','os'to'node:os', and'path'to'node:path'. This directly fixes all three static analysis warnings about preferring thenode:protocol for built-in module imports, which improves clarity (making it obvious these are core Node.js modules), security (preventing potential confusion with similarly-named npm packages), and consistency with modern Node.js best practices.SonarQube Remediation Agent uses AI. Check for mistakes.