From 04bfa3c54f5767dc9c2bc84bb747cb2d6b9b4f66 Mon Sep 17 00:00:00 2001 From: Hossein Mohammadi Date: Mon, 28 Dec 2020 11:00:18 +0330 Subject: [PATCH] chore: add prettier-plugin-jsdoc (#28551) --- .../_util/__tests__/getScrollNode.test.ts | 4 +- components/_util/transButton.tsx | 1 + components/_util/type.ts | 8 ++-- components/affix/index.tsx | 4 +- components/alert/index.tsx | 4 +- components/auto-complete/index.tsx | 6 +-- components/avatar/avatar.tsx | 2 +- components/badge/index.tsx | 2 +- components/breadcrumb/BreadcrumbItem.tsx | 5 +-- components/button/button.tsx | 2 +- components/cascader/index.tsx | 4 +- components/comment/index.tsx | 2 +- components/date-picker/locale/ru_RU.tsx | 4 +- components/drawer/index.tsx | 2 +- components/empty/index.tsx | 4 +- components/form/ErrorList.tsx | 1 + components/form/FormItemInput.tsx | 4 +- components/form/context.tsx | 19 ++-------- components/form/hooks/useCacheErrors.ts | 4 +- components/form/index.zh-CN.md | 12 +++--- components/input/ClearableLabeledInput.tsx | 8 +--- components/input/__tests__/textarea.test.js | 4 +- components/modal/confirm.tsx | 1 + components/progress/Line.tsx | 37 +++++++++---------- components/result/index.tsx | 5 +-- components/table/Column.tsx | 5 +-- components/table/ColumnGroup.tsx | 5 +-- components/table/Table.tsx | 7 ++-- .../table/__tests__/Table.pagination.test.js | 5 +-- components/tag/CheckableTag.tsx | 5 ++- components/time-picker/locale/ru_RU.tsx | 4 +- components/timeline/TimelineItem.tsx | 2 +- components/transfer/list.tsx | 2 +- components/tree/Tree.tsx | 2 +- package.json | 1 + scripts/dark-vars.js | 5 ++- scripts/default-vars.js | 5 ++- scripts/generateLegacyLocale.js | 4 +- site/theme/template/AppShell.jsx | 1 + tests/shared/demoTest.ts | 8 ++-- 40 files changed, 86 insertions(+), 124 deletions(-) diff --git a/components/_util/__tests__/getScrollNode.test.ts b/components/_util/__tests__/getScrollNode.test.ts index b7edf6353c..94faad81a8 100644 --- a/components/_util/__tests__/getScrollNode.test.ts +++ b/components/_util/__tests__/getScrollNode.test.ts @@ -1,6 +1,4 @@ -/** - * @jest-environment node - */ +/** @jest-environment node */ import getScroll from '../getScroll'; describe('getScroll node', () => { diff --git a/components/_util/transButton.tsx b/components/_util/transButton.tsx index 0101238a8b..5caffe5a80 100644 --- a/components/_util/transButton.tsx +++ b/components/_util/transButton.tsx @@ -1,5 +1,6 @@ /** * Wrap of sub component which need use as Button capacity (like Icon component). + * * This helps accessibility reader to tread as a interactive button to operation. */ import * as React from 'react'; diff --git a/components/_util/type.ts b/components/_util/type.ts index ac02d7ec2d..783a44b6af 100644 --- a/components/_util/type.ts +++ b/components/_util/type.ts @@ -5,12 +5,10 @@ export const tuple = (...args: T) => args; export const tupleNum = (...args: T) => args; /** - * https://stackoverflow.com/a/59187769 - * Extract the type of an element of an array/tuple without performing indexing + * https://stackoverflow.com/a/59187769 Extract the type of an element of an array/tuple without + * performing indexing */ export type ElementOf = T extends (infer E)[] ? E : T extends readonly (infer F)[] ? F : never; -/** - * https://github.com/Microsoft/TypeScript/issues/29729 - */ +/** https://github.com/Microsoft/TypeScript/issues/29729 */ export type LiteralUnion = T | (U & {}); diff --git a/components/affix/index.tsx b/components/affix/index.tsx index e95bf8426f..78d402a93d 100644 --- a/components/affix/index.tsx +++ b/components/affix/index.tsx @@ -19,9 +19,7 @@ function getDefaultTarget() { // Affix export interface AffixProps { - /** - * 距离窗口顶部达到指定偏移量后触发 - */ + /** 距离窗口顶部达到指定偏移量后触发 */ offsetTop?: number; /** 距离窗口底部达到指定偏移量后触发 */ offsetBottom?: number; diff --git a/components/alert/index.tsx b/components/alert/index.tsx index b57f7ccc3b..d569397d05 100644 --- a/components/alert/index.tsx +++ b/components/alert/index.tsx @@ -17,9 +17,7 @@ import ErrorBoundary from './ErrorBoundary'; import { replaceElement } from '../_util/reactNode'; export interface AlertProps { - /** - * Type of Alert styles, options:`success`, `info`, `warning`, `error` - */ + /** Type of Alert styles, options:`success`, `info`, `warning`, `error` */ type?: 'success' | 'info' | 'warning' | 'error'; /** Whether Alert can be closed */ closable?: boolean; diff --git a/components/auto-complete/index.tsx b/components/auto-complete/index.tsx index 587349a723..ff3c2391f5 100755 --- a/components/auto-complete/index.tsx +++ b/components/auto-complete/index.tsx @@ -1,8 +1,8 @@ /** * TODO: 4.0 - * - remove `dataSource` - * - `size` not work with customizeInput - * - customizeInput not feedback `ENTER` key since accessibility enhancement + * - remove `dataSource` + * - `size` not work with customizeInput + * - customizeInput not feedback `ENTER` key since accessibility enhancement */ import * as React from 'react'; diff --git a/components/avatar/avatar.tsx b/components/avatar/avatar.tsx index 74d108750a..dcb39ce7be 100644 --- a/components/avatar/avatar.tsx +++ b/components/avatar/avatar.tsx @@ -22,7 +22,7 @@ export interface AvatarProps { /** Srcset of image avatar */ srcSet?: string; draggable?: boolean; - /** icon to be used in avatar */ + /** Icon to be used in avatar */ icon?: React.ReactNode; style?: React.CSSProperties; prefixCls?: string; diff --git a/components/badge/index.tsx b/components/badge/index.tsx index de32d56a04..1eb3fa44ca 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -22,7 +22,7 @@ export interface BadgeProps { showZero?: boolean; /** Max count to show */ overflowCount?: number; - /** whether to show red dot without number */ + /** Whether to show red dot without number */ dot?: boolean; style?: React.CSSProperties; prefixCls?: string; diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index e4c54c14cc..1744211a8f 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -26,10 +26,7 @@ const BreadcrumbItem: BreadcrumbItemInterface = ({ }) => { const { getPrefixCls } = React.useContext(ConfigContext); const prefixCls = getPrefixCls('breadcrumb', customizePrefixCls); - /** - * if overlay is have - * Wrap a DropDown - */ + /** If overlay is have Wrap a DropDown */ const renderBreadcrumbNode = (breadcrumbItem: React.ReactNode) => { if (overlay) { return ( diff --git a/components/button/button.tsx b/components/button/button.tsx index 207b94d5ac..4888d92a84 100644 --- a/components/button/button.tsx +++ b/components/button/button.tsx @@ -140,7 +140,7 @@ const InternalButton: React.ForwardRefRenderFunction = (pr icon, ghost = false, block = false, - /** if we extract items here, we dont need use omit.js */ + /** If we extract items here, we don't need use omit.js */ // React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`. htmlType = 'button' as ButtonProps['htmlType'], ...rest diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 8375b23c1b..93a1306886 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -93,7 +93,7 @@ export interface CascaderProps { name?: string; /** 输入框id */ id?: string; - /** whether has border style */ + /** Whether has border style */ bordered?: boolean; /** 禁用 */ disabled?: boolean; @@ -115,7 +115,7 @@ export interface CascaderProps { inputPrefixCls?: string; getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; popupVisible?: boolean; - /** use this after antd@3.7.0 */ + /** Use this after antd@3.7.0 */ fieldNames?: FieldNamesType; suffixIcon?: React.ReactNode; dropdownRender?: (menus: React.ReactNode) => React.ReactNode; diff --git a/components/comment/index.tsx b/components/comment/index.tsx index 623ecdae78..a1757cf454 100644 --- a/components/comment/index.tsx +++ b/components/comment/index.tsx @@ -9,7 +9,7 @@ export interface CommentProps { author?: React.ReactNode; /** The element to display as the comment avatar - generally an antd Avatar */ avatar?: React.ReactNode; - /** className of comment */ + /** ClassName of comment */ className?: string; /** The main content of the comment */ content: React.ReactNode; diff --git a/components/date-picker/locale/ru_RU.tsx b/components/date-picker/locale/ru_RU.tsx index 2c5a2bd315..9df98f93db 100644 --- a/components/date-picker/locale/ru_RU.tsx +++ b/components/date-picker/locale/ru_RU.tsx @@ -1,6 +1,4 @@ -/** - * Created by Andrey Gayvoronsky on 13/04/16. - */ +/** Created by Andrey Gayvoronsky on 13/04/16. */ import CalendarLocale from 'rc-picker/lib/locale/ru_RU'; import TimePickerLocale from '../../time-picker/locale/ru_RU'; diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index fdf9feafec..8395f457b2 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -31,7 +31,7 @@ export interface DrawerProps { mask?: boolean; maskStyle?: React.CSSProperties; style?: React.CSSProperties; - /** wrapper dom node style of header and body */ + /** Wrapper dom node style of header and body */ drawerStyle?: React.CSSProperties; headerStyle?: React.CSSProperties; bodyStyle?: React.CSSProperties; diff --git a/components/empty/index.tsx b/components/empty/index.tsx index cb220cfcb5..301fe7d0ec 100644 --- a/components/empty/index.tsx +++ b/components/empty/index.tsx @@ -16,9 +16,7 @@ export interface EmptyProps { prefixCls?: string; className?: string; style?: React.CSSProperties; - /** - * @since 3.16.0 - */ + /** @since 3.16.0 */ imageStyle?: React.CSSProperties; image?: React.ReactNode; description?: React.ReactNode; diff --git a/components/form/ErrorList.tsx b/components/form/ErrorList.tsx index afacd85bbb..e92b62f1fb 100644 --- a/components/form/ErrorList.tsx +++ b/components/form/ErrorList.tsx @@ -30,6 +30,7 @@ export default function ErrorList({ if (changedVisible) { /** * We trigger in sync to avoid dom shaking but this get warning in react 16.13. + * * So use Promise to keep in micro async to handle this. * https://github.com/ant-design/ant-design/issues/21698#issuecomment-593743485 */ diff --git a/components/form/FormItemInput.tsx b/components/form/FormItemInput.tsx index 7f4fdc74b5..f3957756a1 100644 --- a/components/form/FormItemInput.tsx +++ b/components/form/FormItemInput.tsx @@ -17,9 +17,7 @@ interface FormItemInputMiscProps { hasFeedback?: boolean; validateStatus?: ValidateStatus; onDomErrorVisibleChange: (visible: boolean) => void; - /** - * @private Internal usage, do not use in any of your production. - */ + /** @private Internal usage, do not use in any of your production. */ _internalItemRender?: { mark: string; render: ( diff --git a/components/form/context.tsx b/components/form/context.tsx index 1bec1c02c5..c5a55d5749 100644 --- a/components/form/context.tsx +++ b/components/form/context.tsx @@ -7,10 +7,7 @@ import { FormLabelAlign } from './interface'; import { RequiredMark } from './Form'; import { ValidateStatus } from './FormItem'; -/** - * Form Context - * Set top form style and pass to Form Item usage. - */ +/** Form Context. Set top form style and pass to Form Item usage. */ export interface FormContextProps { vertical: boolean; name?: string; @@ -28,10 +25,7 @@ export const FormContext = React.createContext({ itemRef: (() => {}) as any, }); -/** - * Form Item Context - * Used for Form noStyle Item error collection - */ +/** Form Item Context. Used for Form noStyle Item error collection */ export interface FormItemContextProps { updateItemErrors: (name: string, errors: string[]) => void; } @@ -40,10 +34,7 @@ export const FormItemContext = React.createContext({ updateItemErrors: () => {}, }); -/** - * Form Provider - * - */ +/** Form Provider */ export interface FormProviderProps extends Omit {} export const FormProvider: React.FC = props => { @@ -51,9 +42,7 @@ export const FormProvider: React.FC = props => { return ; }; -/** - * Used for ErrorList only - */ +/** Used for ErrorList only */ export interface FormItemPrefixContextProps { prefixCls: string; status?: ValidateStatus; diff --git a/components/form/hooks/useCacheErrors.ts b/components/form/hooks/useCacheErrors.ts index 56d3aa9aec..6d5e395216 100644 --- a/components/form/hooks/useCacheErrors.ts +++ b/components/form/hooks/useCacheErrors.ts @@ -1,9 +1,7 @@ import * as React from 'react'; import useForceUpdate from '../../_util/hooks/useForceUpdate'; -/** - * Always debounce error to avoid [error -> null -> error] blink - */ +/** Always debounce error to avoid [error -> null -> error] blink */ export default function useCacheErrors( errors: React.ReactNode[], changeTrigger: (visible: boolean) => void, diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index 49ee2b5ea6..08cb91b0fd 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -176,11 +176,13 @@ Form 通过增量更新方式,只更新被修改的字段相关组件以达到 ```tsx - {fields => fields.map(field => ( - - - - ))} + {fields => + fields.map(field => ( + + + + )) + } ``` diff --git a/components/input/ClearableLabeledInput.tsx b/components/input/ClearableLabeledInput.tsx index bde640a028..43601dda88 100644 --- a/components/input/ClearableLabeledInput.tsx +++ b/components/input/ClearableLabeledInput.tsx @@ -17,9 +17,7 @@ function hasAddon(props: InputProps | ClearableInputProps) { return !!(props.addonBefore || props.addonAfter); } -/** - * This basic props required for input and textarea. - */ +/** This basic props required for input and textarea. */ interface BasicProps { prefixCls: string; inputType: typeof ClearableInputType[number]; @@ -36,9 +34,7 @@ interface BasicProps { bordered: boolean; } -/** - * This props only for input. - */ +/** This props only for input. */ interface ClearableInputProps extends BasicProps { size?: SizeType; suffix?: React.ReactNode; diff --git a/components/input/__tests__/textarea.test.js b/components/input/__tests__/textarea.test.js index 3aea2d36d3..18a0dd12c3 100644 --- a/components/input/__tests__/textarea.test.js +++ b/components/input/__tests__/textarea.test.js @@ -58,12 +58,12 @@ describe('TextArea', () => { const wrapper = mount(