Align /src parameter names for consistent language#219
Conversation
Use shared vocabulary across related APIs: text for strings, number for scalars, fn/delay for debounce and throttle, and numbers/symbols for password options (with legacy aliases). Co-authored-by: Jeremy Butler <jrmybtlr@users.noreply.github.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
usemods | 1e1d801 | Commit Preview URL Branch Preview URL |
Jul 25 2026, 12:13 AM |
Prefer unitDisplay for duration labels and monthDisplay for combined dates, matching other formatter display options while keeping labels/format as legacy aliases. Co-authored-by: Jeremy Butler <jrmybtlr@users.noreply.github.com>
Use a single display option across unit, duration, date, file size, length, and temperature formatters. Keep unitDisplay, labels, monthDisplay, and format as legacy aliases. Co-authored-by: Jeremy Butler <jrmybtlr@users.noreply.github.com>
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
Pull request overview
Aligns public API parameter naming across /src utilities to a consistent vocabulary, while preserving backwards compatibility via legacy option aliases and updating documentation/demos/tests accordingly.
Changes:
- Standardizes parameter names across helpers (e.g.,
text,number,fn,delay) for consistency. - Unifies formatter short/long options under
display?: 'short' | 'long'with legacy aliases supported. - Updates docs, nuxt-web demo components, and tests to reflect the new naming (and to cover aliases).
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tasks/todo.md | Updates internal task notes to reflect the parameter-language convention work. |
| src/numbers.ts | Renames margin/markup helper params to number for consistency. |
| src/modifiers.ts | Renames string/number params (text, number) across modifier utilities. |
| src/goodies.ts | Aligns password policy option keys (numbers, symbols) while keeping legacy aliases. |
| src/goodies.test.ts | Updates/expands tests for new password option keys and legacy aliases. |
| src/formatters.ts | Introduces display option and shared resolver to support legacy short/long aliases. |
| src/formatters.test.ts | Adds/updates tests for display and legacy alias compatibility across formatters. |
| src/actions.ts | Renames debounce callback param to fn and throttle interval param to delay. |
| nuxt-web/pages/docs/formatters.vue | Updates docs page parameter strings to show display instead of legacy option names. |
| nuxt-web/components/content/formatters/FormatUnit.vue | Updates demo UI/state to use display instead of unitDisplay. |
| nuxt-web/components/content/formatters/FormatTemperature.vue | Updates demo UI/state to use display instead of unitDisplay. |
| nuxt-web/components/content/formatters/FormatLength.vue | Updates demo UI/state to use display instead of unitDisplay. |
| nuxt-web/components/content/formatters/FormatFileSize.vue | Updates demo UI/state to use display instead of unitDisplay. |
| nuxt-web/components/content/formatters/FormatDurationLabels.vue | Updates demo UI/state to use display instead of labels. |
| nuxt-web/components/content/formatters/FormatCombinedDates.vue | Updates demo UI/state to use display instead of format. |
| docs/pages/numbers.md | Updates docs signatures/param names for number helpers. |
| docs/pages/modifiers.md | Updates docs signatures/param names for modifier utilities. |
| docs/pages/goodies.md | Updates docs for checkPasswordStrength option keys + notes aliases. |
| docs/pages/generators.md | Updates docs for generatePassword option keys + notes aliases. |
| docs/pages/formatters.md | Updates formatter docs to prefer display and document aliases. |
| docs/pages/actions.md | Updates action docs to use fn + delay terminology. |
Comments suppressed due to low confidence (2)
nuxt-web/components/content/formatters/FormatDurationLabels.vue:16
- This
<option>is hard-coded asselectedeven though the selection should be controlled byv-model. With the new "Default: 'long'" guidance, leavingselectedhere can cause the initial UI selection to disagree with the bound model (and can create SSR/hydration mismatches).
This issue also appears on line 43 of the same file.
<option
value="short"
selected>
Short
</option>
nuxt-web/components/content/formatters/FormatDurationLabels.vue:43
- The demo says "Default: 'long'" but initializes
displayto'short', so the example UI/code doesn't match the documented default behavior offormatDurationLabels.
const display = ref<'long' | 'short'>('short')
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (counts.uppercase < uppercase) return { score: 1, label: `Password must contain ${uppercase} uppercase letter` } | ||
| if (counts.numbers < number) return { score: 1, label: `Password must contain ${number} number` } | ||
| if (counts.special < special) return { score: 1, label: `Password must contain ${special} special character` } | ||
| if (counts.numbers < numbers) return { score: 1, label: `Password must contain ${numbers} number` } | ||
| if (counts.symbols < symbols) return { score: 1, label: `Password must contain ${symbols} special character` } |
There was a problem hiding this comment.
Fixed in 6e62f6a — the failure labels now append 's' when the required count is greater than 1, so messages correctly read e.g. "Password must contain 2 uppercase letters" while preserving "1 uppercase letter".
| ### `throttle<T extends (...args: unknown[]) => void>(fn: T, delay: number): ((...args: Parameters<T>) => void) & { cancel: () => void }` | ||
|
|
||
| Throttles a function to ensure it only runs once per threshold. | ||
| Throttles a function to ensure it only runs once per delay interval. | ||
|
|
…rmatCombinedDates - Updated the `combineDates` function to use `display` instead of `format`, maintaining `format` as a legacy alias. - Removed the `FormatCombinedDates.vue` component and its associated documentation. - Adjusted parameter names in various components and tests to align with the new naming conventions (e.g., `threshold` to `delay`, `number` to `numbers`, `special` to `symbols`). - Updated tests to reflect changes in parameter names and ensure compatibility with the new `display` option. - Cleaned up documentation to remove references to deprecated features and ensure consistency across the codebase.
…tion - Updated parameter names in various components to use consistent terminology (e.g., `value` to `text`, `value` to `number`). - Adjusted the `GeneratePassword` component to improve clarity in input labels. - Modified documentation in the `goodies`, `modifiers`, and `numbers` pages to reflect the new parameter names and descriptions. - Ensured all changes align with the recent refactor for improved consistency and readability.
Summary
Reviewed
/srcfunction parameters for inconsistent naming and aligned related APIs to a shared vocabulary, including a single short/longdisplayoption across formatters.Parameter language
text;ordinalizeusesnumberdebounce/throttleboth usefn+delaynumberinstead ofvaluecheckPasswordStrengthprefersnumbers/symbolsto matchgeneratePassword, with legacy aliases keptShort/long display options
All formatter short/long options are now
display?: 'short' | 'long':formatUnit,formatDurationLabels,formatCombinedDates,formatFileSize,formatLength,formatTemperatureLegacy aliases still work:
unitDisplay,labels,monthDisplay,format.Docs + nuxt-web demos/params updated.
Convention
valuetextnumbernumbersfndelaydisplay: 'short' | 'long'Test plan
pnpm test— 331 passedtsc --noEmitclean