Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(props): remove unnecessary withDefaults() #209

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

nexoscreator
Copy link

@nexoscreator nexoscreator commented Jan 28, 2025

Replaced withDefaults() in Adsbygoogle.vue with destructured default values for props to align with Vue's best practices and suppress compiler warnings.

πŸ”— Linked issue

Resolves #207
also #205

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This pull request replaces the use of withDefaults() in Adsbygoogle.vue with destructured default values for props.

Why this change?

  • Aligns with Vue 3's best practices for handling props.
  • Resolves the compiler warning:
    WARN  [@vue/compiler-sfc] withDefaults() is unnecessary when using destructure with defineProps().
    Reactive destructure will be disabled when using withDefaults().
    Prefer using destructure default values, e.g., const { foo = 1 } = defineProps(...).
    

What problem does this solve?

It improves maintainability and readability of the code by eliminating unnecessary usage of withDefaults(), ensuring adherence to modern Vue conventions.

eplaced withDefaults() in Adsbygoogle.vue with destructured default values for props to align with Vue's best practices and suppress compiler warnings.
- Added `fluid` and `autorelaxed` to `AdFormats`.
- Introduced `AdLayouts` type with `in-article`, `in-feed`, and `fixed`.
- Updated `adLayout` type in `ModuleOptions` and `adsbygoogle.vue`.
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.

Warning: withDefaults() is unnecessary when using defineProps() with destructuring
2 participants