Skip to content

Make the args as optional#307

Merged
5ouma merged 2 commits intomainfrom
refactor-libs-optional-args
Sep 27, 2025
Merged

Make the args as optional#307
5ouma merged 2 commits intomainfrom
refactor-libs-optional-args

Conversation

@5ouma
Copy link
Owner

@5ouma 5ouma commented Sep 27, 2025

⚠️ Issue

close #


✏️ Description

Don't use unions with undefined and insert them.


Don't use union with undefined and insert it.
Copilot AI review requested due to automatic review settings September 27, 2025 11:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors function parameters to use optional parameter syntax instead of union types with undefined default values. The change improves TypeScript code readability and follows better practices for optional parameters.

  • Replaced union types string | undefined with optional parameter syntax using ?:

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions github-actions bot added the 🧹 Refactoring A code change that neither fixes a bug nor adds a feature label Sep 27, 2025
@codecov
Copy link

codecov bot commented Sep 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0203958) to head (4ae27c6).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #307   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          115       115           
  Branches         9         9           
=========================================
  Hits           115       115           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai
Copy link

coderabbitai bot commented Sep 27, 2025

Walkthrough

Updated getContent function signature in src/libs/content.ts to use optional parameters (ref?: string, token?: string) instead of explicit union with defaults. No changes to internal logic, authentication, or error handling.

Changes

Cohort / File(s) Summary of changes
Content library
src/libs/content.ts
Simplified getContent signature: ref?: string, token?: string replacing ref: string | undefined = undefined, token: string | undefined = undefined. No behavioral changes to function body.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly summarizes the main change of the pull request by indicating that the arguments are now optional, accurately reflecting the update to the function signature without extraneous detail or vague language.
Description Check ✅ Passed The description clearly relates to the changes by stating the objective to stop using unions with undefined and make arguments optional, which aligns with the modifications made in the pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor-libs-optional-args

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0203958 and 4ae27c6.

📒 Files selected for processing (1)
  • src/libs/content.ts (1 hunks)

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@5ouma 5ouma merged commit c7ebe39 into main Sep 27, 2025
17 checks passed
@5ouma 5ouma deleted the refactor-libs-optional-args branch September 27, 2025 11:58
@5ouma 5ouma bot mentioned this pull request Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧹 Refactoring A code change that neither fixes a bug nor adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants