Skip to content

Commit 0449b86

Browse files
committed
docs(tsdoc): fixed some tsdoc annotations and styling
This fixed: - `@return` must be `@returns` - `@param {name} {description}` must be `@param {name} - {description}` - `@typeparam {name} {description}` must be `@typeParam {name} - {description}` - `@default` must be `@defaultValue {value}` (with backticks around value) - `@private` must be `@internal` - `>` must be > or in a code block - inline code blocks must not wrap lines This partially fixed: - some cases where I use markdown links instead of `{@link href|name}` Still remaining: - change `@since` tag to something else (nothing exists yet) - fix `Tabs` with how the ids work - fix generate code about @react-md/dev-utils since it needs to be \@react-md/dev-utils - fix remaining invalid link usage - need to verify `@see` usage - need to verify `{@link}` usage - might be able to use `{@inheritdoc}` for some of these - updated eslint to use eslint-plugin-tsdoc or upgrade @mlaursen/eslint-config - fix `Example:` places to be `@example`. - eventually should update all public exports to be documented correctly Reference: https://tsdoc.org/
1 parent 83c2b65 commit 0449b86

File tree

160 files changed

+675
-651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+675
-651
lines changed

packages/alert/src/MessageQueueContext.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface Message {
3131
* existing messages will maintain their order but pushed behind this new
3232
* message.
3333
*
34-
* @default "normal"
34+
* @defaultValue `"normal"`
3535
*/
3636
messagePriority?: MessagePriority;
3737

@@ -41,7 +41,7 @@ export interface Message {
4141
* the user presses the action inside or it is a toast that will be hidden by
4242
* some other logic (like online/offline).
4343
*
44-
* @default false
44+
* @defaultValue `false`
4545
*/
4646
disableAutohide?: boolean;
4747
}
@@ -68,7 +68,7 @@ export interface ToastMessage
6868
export type AddMessage<M extends Message> = (message: M) => void;
6969

7070
/**
71-
* @private
71+
* @internal
7272
*/
7373
export const AddMessageContext = createContext<AddMessage<Message>>(() => {
7474
throw new Error(
@@ -77,7 +77,7 @@ export const AddMessageContext = createContext<AddMessage<Message>>(() => {
7777
});
7878

7979
/**
80-
* @private
80+
* @internal
8181
*/
8282
export const MessageVisibilityContext = createContext(false);
8383

@@ -95,7 +95,7 @@ export function useAddMessage<
9595
/**
9696
* Gets the current message visibility to provide to the toast.
9797
*
98-
* @private
98+
* @internal
9999
*/
100100
export function useMessageVisibility(): boolean {
101101
return useContext(MessageVisibilityContext);
@@ -144,7 +144,7 @@ export type RestartVisibilityTimer = () => void;
144144
export type ResetQueue<M extends Message> = () => M[];
145145

146146
/**
147-
* @private
147+
* @internal
148148
*/
149149
export interface MessageQueueActions<M extends Message> {
150150
popMessage: PopMessage;
@@ -156,7 +156,7 @@ export interface MessageQueueActions<M extends Message> {
156156
}
157157

158158
/**
159-
* @private
159+
* @internal
160160
*/
161161
export const MessageQueueActionsContext = createContext<
162162
MessageQueueActions<Message>
@@ -205,7 +205,7 @@ export function useMessageQueueActions<
205205
}
206206

207207
/**
208-
* @private
208+
* @internal
209209
*/
210210
export const MessageQueueContext = createContext<Message[]>([]);
211211

packages/alert/src/SnackbarQueue.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function getId(
4747
* component, it's actually required to create a separate component instance so
4848
* that the context API can be
4949
*
50-
* @private
50+
* @internal
5151
*/
5252
function SnackbarQueueT<M extends ToastMessage = ToastMessage>(
5353
{ queue, onActionClick, ...props }: SnackbarQueueProps<M>,

packages/alert/src/useMessageQueue.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const POP_MESSAGE = "POP_MESSAGE";
1818
export const RESET_QUEUE = "RESET_QUEUE";
1919

2020
/**
21-
* @private
21+
* @internal
2222
*/
2323
export interface AddMessageAction<M extends Message = ToastMessage> {
2424
type: typeof ADD_MESSAGE;
@@ -27,7 +27,7 @@ export interface AddMessageAction<M extends Message = ToastMessage> {
2727
}
2828

2929
/**
30-
* @private
30+
* @internal
3131
*/
3232
export function addMessage<M extends Message = ToastMessage>(
3333
message: M,
@@ -37,31 +37,31 @@ export function addMessage<M extends Message = ToastMessage>(
3737
}
3838

3939
/**
40-
* @private
40+
* @internal
4141
*/
4242
export interface PopMessageAction {
4343
type: typeof POP_MESSAGE;
4444
}
4545

4646
/**
47-
* @private
47+
* @internal
4848
*/
4949
export const popMessage = (): PopMessageAction => ({ type: POP_MESSAGE });
5050

5151
/**
52-
* @private
52+
* @internal
5353
*/
5454
export interface ResetQueueAction {
5555
type: typeof RESET_QUEUE;
5656
}
5757

5858
/**
59-
* @private
59+
* @internal
6060
*/
6161
export const resetQueue = (): ResetQueueAction => ({ type: RESET_QUEUE });
6262

6363
/**
64-
* @private
64+
* @internal
6565
*/
6666
export type MessageActions<M extends Message = ToastMessage> =
6767
| AddMessageAction<M>
@@ -72,7 +72,7 @@ export type MessageActions<M extends Message = ToastMessage> =
7272
* This function is used to update the message queue state by adding a new message when
7373
* needed.
7474
*
75-
* @private
75+
* @internal
7676
*/
7777
export function handleAddMessage<M extends Message = ToastMessage>(
7878
state: M[],
@@ -137,7 +137,7 @@ type MessageQueueReducer<M extends Message = ToastMessage> = Reducer<
137137
>;
138138

139139
/**
140-
* @private
140+
* @internal
141141
*/
142142
export function reducer<M extends Message = ToastMessage>(
143143
state: M[],
@@ -174,7 +174,7 @@ export interface MessageQueueResult<M extends Message = ToastMessage>
174174
* - creating timeouts as needed to show/hide toasts within the SnackbarQueue component
175175
* - create a way to push messages with optional priority onto the queue
176176
*
177-
* @private
177+
* @internal
178178
*/
179179
export function useMessageQueue<M extends Message = ToastMessage>({
180180
timeout = DEFAULT_MESSAGE_QUEUE_TIMEOUT,

packages/alert/src/useWindowBlurPause.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Options {
1717
* user since they minimized the browser or viewing something on a second
1818
* screen.
1919
*
20-
* @private
20+
* @internal
2121
*/
2222
export function useWindowBlurPause({
2323
startTimer,

packages/app-bar/src/AppBarTitle.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const AppBarTitle = forwardRef<HTMLHeadingElement, AppBarTitleProps>(
5858
}
5959
);
6060

61+
/* istanbul ignore next */
6162
if (process.env.NODE_ENV !== "production") {
6263
try {
6364
const PropTypes = require("prop-types");

packages/app-bar/src/useActionClassName.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export interface AppBarActionClassNameProps extends AppBarColorInherit {
1313

1414
/**
1515
* Boolean if this is the first action within the app bar. This is really just
16-
* used to automatically right-align all the actions by applying `margin-left:
17-
* auto` to this action.
16+
* used to automatically right-align all the actions by applying
17+
* `margin-left: auto` to this action.
1818
*/
1919
first?: boolean;
2020

@@ -32,7 +32,7 @@ export interface AppBarActionClassNameProps extends AppBarColorInherit {
3232
* really not be used externally and is really just for creating dropdown menus
3333
* within app bars that have the action styles.
3434
*
35-
* @private
35+
* @internal
3636
*/
3737
export function useActionClassName({
3838
first,

packages/app-bar/src/useInheritContext.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createContext, useContext } from "react";
22

33
/**
44
* Boolean if the child components should inherit the color of the app bar.
5-
* @private
5+
* @internal
66
*/
77
export const InheritContext = createContext(false);
88

@@ -21,9 +21,9 @@ export interface AppBarColorInherit {
2121
* AppBar. If the `inheritColor` prop was provided to the component, that value
2222
* will be used instead.
2323
*
24-
* @param inheritColor The prop inheritColor for the component
25-
* @return true if the color should be inherited.
26-
* @private
24+
* @param inheritColor - The prop inheritColor for the component
25+
* @returns true if the color should be inherited.
26+
* @internal
2727
*/
2828
export function useInheritContext(inheritColor: boolean | undefined): boolean {
2929
const inheritContext = useContext(InheritContext);
@@ -36,13 +36,13 @@ export function useInheritContext(inheritColor: boolean | undefined): boolean {
3636
* nested app bars usually happen with prominent toolbars and the root app bar
3737
* defines the theme.
3838
*
39-
* @private
39+
* @internal
4040
*/
4141
export const ParentContext = createContext(false);
4242

4343
/**
4444
*
45-
* @private
45+
* @internal
4646
*/
4747
export function useParentContext(): boolean {
4848
return useContext(ParentContext);

packages/autocomplete/src/useAutoComplete.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export interface AutoCompleteReturnValue {
9191
/**
9292
* This hook handles all the autocomplete's "logic" and behavior.
9393
*
94-
* @private
94+
* @internal
9595
*/
9696
export function useAutoComplete({
9797
suggestionsId,

packages/autocomplete/src/utils.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import {
1010
/**
1111
* Generates an id for each result in the autocomplete's listbox.
1212
*
13-
* @param id The listbox's id
14-
* @param index The index of the result in the list
15-
* @return an id string
13+
* @param id - The listbox's id
14+
* @param index - The index of the result in the list
15+
* @returns an id string
1616
*/
1717
export function getResultId(id: string, index: number): string {
1818
return `${id}-result-${index + 1}`;
@@ -22,12 +22,12 @@ export function getResultId(id: string, index: number): string {
2222
* Gets a renderable label for each result in the autocomplete's listbox. This
2323
* will be applied as the `children` for the `Option` element.
2424
*
25-
* @param datum The current result datum to get a label for
26-
* @param labelKey The key to extract a label from if the datum is an object
27-
* @param query The current search query. This is useful if you want to
25+
* @param datum - The current result datum to get a label for
26+
* @param labelKey - The key to extract a label from if the datum is an object
27+
* @param query - The current search query. This is useful if you want to
2828
* implement text "highlighting" (bold) of all the letters that match in the
2929
* item.
30-
* @return a renderable node to display
30+
* @returns a renderable node to display
3131
*/
3232
export function getResultLabel(
3333
datum: Readonly<AutoCompleteData>,
@@ -45,10 +45,10 @@ export function getResultLabel(
4545
/**
4646
* Gets a value string from each result that can be searched.
4747
*
48-
* @param datum The current result datum that should have a string extracted
49-
* @param valueKey The key to use to extract a string value from if the datum is
50-
* an object
51-
* @return a searchable string.
48+
* @param datum - The current result datum that should have a string extracted
49+
* @param valueKey - The key to use to extract a string value from if the datum
50+
* is an object
51+
* @returns a searchable string.
5252
*/
5353
export function getResultValue(
5454
datum: Readonly<AutoCompleteData>,
@@ -73,15 +73,15 @@ export function getResultValue(
7373
/**
7474
* This is used to disable filtering and just return the data list immediately.
7575
* Useful when the filtering is done somewhere else like a server/API
76-
* @private
76+
* @internal
7777
*/
7878
export const noFilter: FilterFunction = (_, data) => data;
7979

8080
/**
8181
* Gets the filter function to use within the Autocomplete based on the provided
8282
* filter prop
8383
*
84-
* @private
84+
* @internal
8585
*/
8686
export function getFilterFunction<O extends {} = {}>(
8787
filter: AutoCompleteFilterFunction<O>
@@ -131,7 +131,7 @@ export function getFilterFunction<O extends {} = {}>(
131131
* }, [])
132132
* ```
133133
*
134-
* @param datum The result data to type guard against.
134+
* @param datum - The result data to type guard against.
135135
*/
136136
export function isResultOf<T extends {}>(
137137
datum: Readonly<AutoCompleteData>

packages/avatar/src/Avatar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface AvatarProps extends HTMLAttributes<HTMLSpanElement> {
2727
* An optional `referrerPolicy` to provide to the `<img>` element if the `src`
2828
* or `imgProps` props are provided.
2929
*
30-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-referrerpolicy
30+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-referrerpolicy|Referrer Policy}
3131
*
3232
* @since 2.2.0
3333
*/

packages/badge/src/BadgedButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface BadgedButtonProps
1818

1919
/**
2020
* An optional id for the badge. Either this prop or the `id` prop is required
21-
* for a11y when the `badgeChildren` is provided` to create the
21+
* for a11y when the `badgeChildren` is provided to create the
2222
* `aria-describedby` value on the button.
2323
*/
2424
badgeId?: string;

packages/badge/src/isEmpty.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ReactNode } from "react";
33
/**
44
* A small util to check if the badge is considered empty.
55
*
6-
* @private
6+
* @internal
77
*/
88
export function isEmpty(
99
children: ReactNode,

packages/button/src/buttonThemeClassNames.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ const block = bem("rmd-button");
7575
* used so that other elements like clickable `<div>`s or `<input type="file">`
7676
* can look like buttons.
7777
*
78-
* @param props An object containing the themeable button props to generate a
78+
* @param props - An object containing the themeable button props to generate a
7979
* button theme className.
80-
* @return a string of class names to create an element with a button theme.
80+
* @returns a string of class names to create an element with a button theme.
8181
*/
8282
export function buttonThemeClassNames({
8383
theme: propTheme = "clear",

packages/card/src/CardHeaderAddon.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const block = bem("rmd-card");
99
* This component is used to dynamically add addons to the `CardHeader`
1010
* component. When no children are provided, nothing will be rendered.
1111
*
12-
* @private
12+
* @internal
1313
*/
1414
export function CardHeaderAddon({
1515
className,

packages/chip/src/Chip.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@ export interface ChipProps extends ButtonAttributes {
7070
* `true` and will transition in and out when swapped between `true` and
7171
* `false`.
7272
*
73-
* > See the `disableIconTransition` and `selectedIcon` props for more details
74-
* > about the icon behavior
73+
* @remarks
74+
*
75+
* See the `disableIconTransition` and `selectedIcon` props for more details
76+
* about the icon behavior
7577
*/
7678
selected?: boolean;
7779

0 commit comments

Comments
 (0)