Conversation
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
It's useful to be able to see all the possible values of format, for reference, rather than just a few examples.
3965d16 to
2dfd553
Compare
Prompted by a suggestion from GitHub Copilot's PR review.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the documentation by displaying all possible format values for article formats instead of just providing examples. It introduces a utility function to extract enum values and dynamically shows all available options for Design, Display, and Theme.
- Adds imports for article format enums (
ArticleDesign,ArticleDisplay,ArticleSpecial,Pillar) - Creates a
formatValuesutility function to extract string values from TypeScript enums - Updates documentation descriptions to show complete lists of format values instead of examples
Comments suppressed due to low confidence (1)
dotcom-rendering/src/devServer/docs/article.tsx:109
- The parameter name 'a' is ambiguous and unclear. Consider renaming it to something more descriptive like 'enumObject' or 'enumType'.
const formatValues = (a: object): string =>
| * | ||
| * https://www.typescriptlang.org/docs/handbook/enums.html#reverse-mappings | ||
| */ | ||
| const formatValues = (a: object): string => |
There was a problem hiding this comment.
The parameter type 'object' is too generic. Consider using a more specific type constraint like 'Record<string, string | number>' to better reflect that this function expects enum objects.
| const formatValues = (a: object): string => | |
| const formatValues = (a: Record<string, string | number>): string => |
There was a problem hiding this comment.
I think that this is a fair comment, although if we're going to opt for a narrower type then it's probably preferable to use the specific enums this function was designed for, which I've done in 0679c61. This function isn't intended to be used for all Records (or objects), just for these four enums.
Prompted by a suggestion from GitHub Copilot's PR review.
|
Seen on PROD (merged by @JamieB-gu 13 minutes and 41 seconds ago) Please check your changes! |
It's useful to be able to see all the possible values of format, for reference, rather than just a few examples.
Part of #13737.