Skip to content

Commit 1e6e5c7

Browse files
committed
mods/telemetry: a Choice member may carry a hyphen, as the built-in panel's merge-base does
1 parent 8dfc5aa commit 1e6e5c7

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎mods/telemetry/hooks/entries/checked-value/checked-value.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function checkedValue(
6060

6161
if (!isTokenList) {
6262
throw refusal(
63-
`props.${key}.of: a list of 1 to ${CHOICES_LIMIT} ` + `snake_case tokens`,
63+
`props.${key}.of: a list of 1 to ${CHOICES_LIMIT} ` + `lowercase tokens`,
6464
method,
6565
)
6666
}
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
2-
* The shape of a Choice member: a snake_case token of at most 64 characters,
3-
* which may start with a digit (a bucket such as `110_to_143`), unlike a name
4-
* or a key (TOKEN).
2+
* The shape of a Choice member: a lowercase token of at most 64 characters,
3+
* of letters, digits, `_` and `-`, which may start with a digit (a bucket
4+
* such as `110_to_143`) and carry a hyphen (a kind such as `merge-base`),
5+
* unlike a name or a key (TOKEN).
56
*/
6-
export const CHOICE_TOKEN = /^[a-z0-9][a-z0-9_]{0,63}$/
7+
export const CHOICE_TOKEN = /^[a-z0-9][a-z0-9_-]{0,63}$/

‎mods/telemetry/hooks/telemetry-types/choice/choice.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
* A string property: the value and the list it is chosen from, declared
33
* beside it, so no free text reaches the row.
44
*
5-
* Every member of `of` is a snake_case token, which may start with a digit,
6-
* at most CHOICES_LIMIT of them; `value` is one of them.
5+
* Every member of `of` is a lowercase token of letters, digits, `_` and
6+
* `-`, which may start with a digit, at most CHOICES_LIMIT of them; `value`
7+
* is one of them.
78
*/
89
export type Choice = { value: string; of: readonly string[] }

0 commit comments

Comments
 (0)