Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug] `text` validate function for text when value is empty with default value

オープン
#397 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
node.js, typescript
領域
cli

調査の方向性

core/prompts/text から始め、リンク先の StackBlitz の例を使って空入力のケースを再現してください。draft PR #396 と、提案されている2つの修正方針を確認してください。完了条件は、設定済みのデフォルト値がある状態で Enter を押すと、そのデフォルト値を使ってバリデーションが行われ、文書に記載されたテキストプロンプトの動作が維持されることです。

索引モデルが issue の本文から書いたものです。

説明

bug

Environment

  • OS: macOS
  • Node Version: 22.5.1
  • Package: @clack/promts
  • Package Version: 0.11.0

Describe the bug
When calling the text's validate function without user input but with a default value defined, it should use the default value instead of relying solely on user input.

To Reproduce

Steps to reproduce the behavior:

  1. Open repro link
  2. Run node index.js
  3. Don't type anything, just press [Enter]
  4. See behavior described on terminal

Expected behavior
Clear use case example:
Image

CLI dev creates a text step for user to enter a path as input. There's some predefined value that CLI dev established to be the default use case for most users, but still allowing for that value to be changed.
Currently, the user would have to type/copy that entire path, causing a terrible user experience.

Fix Recommendation (starting a convo)
I see 2 possible ways to fix this:

  1. Keep validate as is and add a check to the value on core/prompts/text - link to draft PR
  2. Add a second optional argument, which would be the default value to validate. That way, Devs would have another quick option when using the validate function, without adding extra checks to the core library.

My goal with this section is to start a conversation and introduce my ideas about this issue, not a way for me to impose how I think things should be.
This would be my first contribution, so I'm pretty new here. Let me know what you think and hopefully let's get this fixed!

主要言語
TypeScript
スター
8.1k
フォーク
217
平均マージ
1日 11時間
マージ済み PR(30日)
5

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bombshell-dev/clack のほかの issue

bombshell-dev/clack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。