From ec8e41e762d516b4caacbc898cfe52cbd8db456f Mon Sep 17 00:00:00 2001 From: asvarcas Date: Fri, 6 Mar 2020 17:39:33 -0300 Subject: [PATCH 1/2] Fix some jsDocs defintions. --- packages/ra-core/src/auth/useLogin.ts | 2 +- .../controller/field/useReferenceManyFieldController.ts | 2 +- packages/ra-core/src/controller/useListParams.ts | 2 +- packages/ra-core/src/controller/usePaginationState.ts | 6 +++--- packages/ra-core/src/dataProvider/useQueryWithStore.ts | 4 ++-- packages/ra-core/src/form/FormWithRedirect.tsx | 8 ++++---- packages/ra-ui-materialui/src/form/SimpleForm.js | 6 +++--- packages/ra-ui-materialui/src/form/TabbedForm.js | 6 +++--- packages/ra-ui-materialui/src/layout/LinearProgress.js | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/ra-core/src/auth/useLogin.ts b/packages/ra-core/src/auth/useLogin.ts index 51bff88916b..6af8f2d8f0d 100644 --- a/packages/ra-core/src/auth/useLogin.ts +++ b/packages/ra-core/src/auth/useLogin.ts @@ -56,7 +56,7 @@ const useLogin = (): Login => { /** * Log a user in by calling the authProvider.login() method * - * @param {object} params Login parameters to pass to the authProvider. May contain username/email, password, etc + * @param {Object} params Login parameters to pass to the authProvider. May contain username/email, password, etc * @param {string} pathName The path to redirect to after login. By default, redirects to the home page, or to the last page visited after deconnexion. * * @return {Promise} The authProvider response diff --git a/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts b/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts index e8b60424b20..6be6c6e8845 100644 --- a/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts +++ b/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts @@ -72,7 +72,7 @@ const defaultFilter = {}; * @param {string} option.basePath basepath to current resource * @param {number} option.page the page number * @param {number} option.perPage the number of item per page - * @param {object} option.sort the sort to apply to the referenced records + * @param {Object} option.sort the sort to apply to the referenced records * * @returns {ReferenceManyProps} The reference many props */ diff --git a/packages/ra-core/src/controller/useListParams.ts b/packages/ra-core/src/controller/useListParams.ts index 4d11f70e564..d67aabbabd0 100644 --- a/packages/ra-core/src/controller/useListParams.ts +++ b/packages/ra-core/src/controller/useListParams.ts @@ -279,7 +279,7 @@ export const parseQueryFromLocation = ({ search }) => { * To check if the user has custom params, we must compare the params * to these initial values. * - * @param {object} params + * @param {Object} params */ export const hasCustomParams = (params: ListParams) => { return ( diff --git a/packages/ra-core/src/controller/usePaginationState.ts b/packages/ra-core/src/controller/usePaginationState.ts index 5690c6c08fc..45a0b6212a1 100644 --- a/packages/ra-core/src/controller/usePaginationState.ts +++ b/packages/ra-core/src/controller/usePaginationState.ts @@ -6,9 +6,9 @@ import { Pagination } from '../types'; * @type {Object} * @property {number} page: The page number. * @property {number} perPage: The number of item per page. - * @property {function} setPage: Set the page number - * @property {function} setPerPage: Set the per page number - * @property {function} setPagination: Set page and perPage pagination numbers + * @property {Function} setPage: Set the page number + * @property {Function} setPerPage: Set the per page number + * @property {Function} setPagination: Set page and perPage pagination numbers */ export interface PaginationProps { page: number; diff --git a/packages/ra-core/src/dataProvider/useQueryWithStore.ts b/packages/ra-core/src/dataProvider/useQueryWithStore.ts index cb662396daa..5e33134ee2a 100644 --- a/packages/ra-core/src/dataProvider/useQueryWithStore.ts +++ b/packages/ra-core/src/dataProvider/useQueryWithStore.ts @@ -70,8 +70,8 @@ const defaultTotalSelector = () => null; * @param {string} options.action Redux action type * @param {Function} options.onSuccess Side effect function to be executed upon success of failure, e.g. { onSuccess: response => refresh() } } * @param {Function} options.onFailure Side effect function to be executed upon failure, e.g. { onFailure: error => notify(error.message) } } - * @param {function} dataSelector Redux selector to get the result. Required. - * @param {function} totalSelector Redux selector to get the total (optional, only for LIST queries) + * @param {Function} dataSelector Redux selector to get the result. Required. + * @param {Function} totalSelector Redux selector to get the total (optional, only for LIST queries) * * @returns The current request state. Destructure as { data, total, error, loading, loaded }. * diff --git a/packages/ra-core/src/form/FormWithRedirect.tsx b/packages/ra-core/src/form/FormWithRedirect.tsx index 4e1f229d85a..0f15104bbce 100644 --- a/packages/ra-core/src/form/FormWithRedirect.tsx +++ b/packages/ra-core/src/form/FormWithRedirect.tsx @@ -22,10 +22,10 @@ import FormContext from './FormContext'; * /> * ); * - * @typedef {object} Props the props you can use (other props are injected by Create or Edit) - * @prop {object} initialValues - * @prop {function} validate - * @prop {function} save + * @typedef {Object} Props the props you can use (other props are injected by Create or Edit) + * @prop {Object} initialValues + * @prop {Function} validate + * @prop {Function} save * @prop {boolean} submitOnEnter * @prop {string} redirect * diff --git a/packages/ra-ui-materialui/src/form/SimpleForm.js b/packages/ra-ui-materialui/src/form/SimpleForm.js index e668ab02325..5126e11e3c9 100644 --- a/packages/ra-ui-materialui/src/form/SimpleForm.js +++ b/packages/ra-ui-materialui/src/form/SimpleForm.js @@ -29,10 +29,10 @@ import CardContentInner from '../layout/CardContentInner'; * * ); * - * @typedef {object} Props the props you can use (other props are injected by Create or Edit) + * @typedef {Object} Props the props you can use (other props are injected by Create or Edit) * @prop {ReactElement[]} children Input elements - * @prop {object} initialValues - * @prop {function} validate + * @prop {Object} initialValues + * @prop {Function} validate * @prop {boolean} submitOnEnter * @prop {string} redirect * @prop {ReactElement} toolbar The element displayed at the bottom of the form, contzining the SaveButton diff --git a/packages/ra-ui-materialui/src/form/TabbedForm.js b/packages/ra-ui-materialui/src/form/TabbedForm.js index 5c6389cb01e..0840e3ddecf 100644 --- a/packages/ra-ui-materialui/src/form/TabbedForm.js +++ b/packages/ra-ui-materialui/src/form/TabbedForm.js @@ -64,10 +64,10 @@ import TabbedFormTabs, { getTabFullPath } from './TabbedFormTabs'; * * ); * - * @typedef {object} Props the props you can use (other props are injected by Create or Edit) + * @typedef {Object} Props the props you can use (other props are injected by Create or Edit) * @prop {ReactElement[]} FormTab elements - * @prop {object} initialValues - * @prop {function} validate + * @prop {Object} initialValues + * @prop {Function} validate * @prop {boolean} submitOnEnter * @prop {string} redirect * @prop {ReactElement} toolbar The element displayed at the bottom of the form, contzining the SaveButton diff --git a/packages/ra-ui-materialui/src/layout/LinearProgress.js b/packages/ra-ui-materialui/src/layout/LinearProgress.js index 6fae62b6554..c90fb2e6665 100644 --- a/packages/ra-ui-materialui/src/layout/LinearProgress.js +++ b/packages/ra-ui-materialui/src/layout/LinearProgress.js @@ -22,7 +22,7 @@ const useStyles = makeStyles( * @see ReferenceField * @see ReferenceInput * - * @param {object} classes CSS class names + * @param {Object} classes CSS class names */ const LinearProgress = ({ classes: classesOverride, className, ...rest }) => { const classes = useStyles({ classes: classesOverride }); From 8350b11e3c7d12cbeebf50b040ffb041402f57cb Mon Sep 17 00:00:00 2001 From: asvarcas Date: Sat, 7 Mar 2020 14:26:34 -0300 Subject: [PATCH 2/2] More jsdoc minor fixes. --- packages/ra-core/src/controller/useSortState.ts | 2 +- packages/ra-core/src/i18n/TranslationUtils.ts | 2 +- packages/ra-core/src/inference/inferElementFromValues.tsx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ra-core/src/controller/useSortState.ts b/packages/ra-core/src/controller/useSortState.ts index e13ce87f320..a921ff06f77 100644 --- a/packages/ra-core/src/controller/useSortState.ts +++ b/packages/ra-core/src/controller/useSortState.ts @@ -75,7 +75,7 @@ export const defaultSort = { field: 'id', order: 'DESC' }; * @typedef SortProps * @type {Object} * @property {Object} sort: the sort object. - * @property {String} sort.field: the sort object. + * @property {string} sort.field: the sort object. * @property {'ASC' | 'DESC'} sort.order: the sort object. * @property {setSort} setSort * @property {setSortField} setSortField diff --git a/packages/ra-core/src/i18n/TranslationUtils.ts b/packages/ra-core/src/i18n/TranslationUtils.ts index 197c6afabff..b7c293ad562 100644 --- a/packages/ra-core/src/i18n/TranslationUtils.ts +++ b/packages/ra-core/src/i18n/TranslationUtils.ts @@ -26,7 +26,7 @@ interface AllNavigatorLanguage extends NavigatorLanguage { * * ); * - * @param {String} defaultLocale Defaults to 'en' + * @param {string} defaultLocale Defaults to 'en' */ export const resolveBrowserLocale = (defaultLocale = DEFAULT_LOCALE) => { // from http://blog.ksol.fr/user-locale-detection-browser-javascript/ diff --git a/packages/ra-core/src/inference/inferElementFromValues.tsx b/packages/ra-core/src/inference/inferElementFromValues.tsx index bb0c32075be..4f0361251da 100644 --- a/packages/ra-core/src/inference/inferElementFromValues.tsx +++ b/packages/ra-core/src/inference/inferElementFromValues.tsx @@ -71,8 +71,8 @@ const hasType = (type, types) => typeof types[type] !== 'undefined'; * ); * // null * - * @param {String} name Property name, e.g. 'date_of_birth' - * @param {[mixed]} values an array of values from which to determine the type, e.g. [12, 34.4, 43] + * @param {string} name Property name, e.g. 'date_of_birth' + * @param {any[]} values an array of values from which to determine the type, e.g. [12, 34.4, 43] * @param {Object} types A set of components indexed by type. The string type is the only required one * * @return InferredElement