From 033b6581d31d5ba6c9c63554cfd8decf2804adc2 Mon Sep 17 00:00:00 2001 From: asvarcas Date: Wed, 16 Oct 2019 22:06:11 -0300 Subject: [PATCH 1/5] Fix JSDocs errors. --- packages/ra-core/src/auth/convertLegacyAuthProvider.ts | 2 +- packages/ra-core/src/controller/usePaginationState.ts | 2 +- packages/ra-core/src/dataProvider/Mutation.tsx | 1 + packages/ra-core/src/dataProvider/Query.tsx | 1 + packages/ra-core/src/dataProvider/convertLegacyDataProvider.ts | 2 +- packages/ra-core/src/dataProvider/useGetList.ts | 2 +- packages/ra-core/src/dataProvider/useGetManyReference.ts | 2 +- packages/ra-core/src/dataProvider/useGetMatching.ts | 2 +- packages/ra-core/src/i18n/useSetLocale.tsx | 2 -- packages/ra-core/src/sideEffect/admin.ts | 1 + packages/ra-core/src/util/renderWithRedux.tsx | 2 +- packages/ra-data-graphql/README.md | 2 +- 12 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/ra-core/src/auth/convertLegacyAuthProvider.ts b/packages/ra-core/src/auth/convertLegacyAuthProvider.ts index 5fe31228802..01030eeb655 100644 --- a/packages/ra-core/src/auth/convertLegacyAuthProvider.ts +++ b/packages/ra-core/src/auth/convertLegacyAuthProvider.ts @@ -12,7 +12,7 @@ import { AuthProvider, LegacyAuthProvider } from '../types'; * * Allows using legacy authProviders transparently. * - * @param {Function} authProvider A legacy authProvider (type, params) => Promise + * @param {Function} legacyAuthProvider A legacy authProvider (type, params) => Promise * * @returns {Object} An authProvider that react-admin can use */ diff --git a/packages/ra-core/src/controller/usePaginationState.ts b/packages/ra-core/src/controller/usePaginationState.ts index 6ae102ab1e3..3952665d73f 100644 --- a/packages/ra-core/src/controller/usePaginationState.ts +++ b/packages/ra-core/src/controller/usePaginationState.ts @@ -47,7 +47,7 @@ const defaultPagination = { * * const { page, setpage, perPage, setPerPage } = usePagination(initialPerPage); * - * @param {numper} initialPerPage the initial value per page + * @param {number} initialPagination the initial value per page * @returns {PaginationProps} The pagination props */ export default ( diff --git a/packages/ra-core/src/dataProvider/Mutation.tsx b/packages/ra-core/src/dataProvider/Mutation.tsx index ab334cdc422..58d40ddc789 100644 --- a/packages/ra-core/src/dataProvider/Mutation.tsx +++ b/packages/ra-core/src/dataProvider/Mutation.tsx @@ -28,6 +28,7 @@ interface Props { /** * Get a callback to call the data provider and pass the result to a child function * + * @param {any} children * @param {string} type The method called on the data provider, e.g. 'update', 'delete'. Can also be a custom method if the dataProvider supports is. * @param {string} resource A resource name, e.g. 'posts', 'comments' * @param {Object} payload The payload object, e.g; { id: 12 } diff --git a/packages/ra-core/src/dataProvider/Query.tsx b/packages/ra-core/src/dataProvider/Query.tsx index 6a6f67aca90..69609568d97 100644 --- a/packages/ra-core/src/dataProvider/Query.tsx +++ b/packages/ra-core/src/dataProvider/Query.tsx @@ -20,6 +20,7 @@ interface Props { /** * Fetch the data provider and pass the result to a child function * + * @param {any} children * @param {string} type The method called on the data provider, e.g. 'getList', 'getOne'. Can also be a custom method if the dataProvider supports is. * @param {string} resource A resource name, e.g. 'posts', 'comments' * @param {Object} payload The payload object, e.g; { post_id: 12 } diff --git a/packages/ra-core/src/dataProvider/convertLegacyDataProvider.ts b/packages/ra-core/src/dataProvider/convertLegacyDataProvider.ts index bfd7c9db1b3..854944de431 100644 --- a/packages/ra-core/src/dataProvider/convertLegacyDataProvider.ts +++ b/packages/ra-core/src/dataProvider/convertLegacyDataProvider.ts @@ -42,7 +42,7 @@ interface ConvertedDataProvider extends DataProvider { * * Allows using legacy dataProviders transparently. * - * @param {Function} dataProvider A legacy dataProvider (type, resource, params) => Promise + * @param {Function} legacyDataProvider A legacy dataProvider (type, resource, params) => Promise * * @returns {Object} A dataProvider that react-admin can use */ diff --git a/packages/ra-core/src/dataProvider/useGetList.ts b/packages/ra-core/src/dataProvider/useGetList.ts index 1879ecc4e54..c9fa57e31b9 100644 --- a/packages/ra-core/src/dataProvider/useGetList.ts +++ b/packages/ra-core/src/dataProvider/useGetList.ts @@ -17,7 +17,7 @@ import useQueryWithStore from './useQueryWithStore'; * @param {string} resource The resource name, e.g. 'posts' * @param {Object} pagination The request pagination { page, perPage }, e.g. { page: 1, perPage: 10 } * @param {Object} sort The request sort { field, order }, e.g. { field: 'id', order: 'DESC' } - * @param {Object} filters The request filters, e.g. { title: 'hello, world' } + * @param {Object} filter The request filters, e.g. { title: 'hello, world' } * @param {Object} options Options object to pass to the dataProvider. May include side effects to be executed upon success of failure, e.g. { onSuccess: { refresh: true } } * * @returns The current request state. Destructure as { data, total, ids, error, loading, loaded }. diff --git a/packages/ra-core/src/dataProvider/useGetManyReference.ts b/packages/ra-core/src/dataProvider/useGetManyReference.ts index 61950ce1464..5ad2471428a 100644 --- a/packages/ra-core/src/dataProvider/useGetManyReference.ts +++ b/packages/ra-core/src/dataProvider/useGetManyReference.ts @@ -28,7 +28,7 @@ import { useMemo } from 'react'; * @param {Object} id The identifier of the record to look for in 'target' * @param {Object} pagination The request pagination { page, perPage }, e.g. { page: 1, perPage: 10 } * @param {Object} sort The request sort { field, order }, e.g. { field: 'id', order: 'DESC' } - * @param {Object} filters The request filters, e.g. { body: 'hello, world' } + * @param {Object} filter The request filters, e.g. { body: 'hello, world' } * @param {string} referencingResource The resource name, e.g. 'posts'. Used to generate a cache key * @param {Object} options Options object to pass to the dataProvider. May include side effects to be executed upon success of failure, e.g. { onSuccess: { refresh: true } } * diff --git a/packages/ra-core/src/dataProvider/useGetMatching.ts b/packages/ra-core/src/dataProvider/useGetMatching.ts index 54a353bd587..c104caa3e1b 100644 --- a/packages/ra-core/src/dataProvider/useGetMatching.ts +++ b/packages/ra-core/src/dataProvider/useGetMatching.ts @@ -30,7 +30,7 @@ const referenceSource = (resource, source) => `${resource}@${source}`; * @param {string} resource The referenced resource name, e.g. 'tags' * @param {Object} pagination The request pagination { page, perPage }, e.g. { page: 1, perPage: 10 } * @param {Object} sort The request sort { field, order }, e.g. { field: 'id', order: 'DESC' } - * @param {Object} filters The request filters, e.g. { title: 'hello, world' } + * @param {Object} filter The request filters, e.g. { title: 'hello, world' } * @param {string} source The field in resource containing the ids of the referenced records, e.g. 'tag_ids' * @param {string} referencingResource The resource name, e.g. 'posts'. Used to build a cache key * @param {Object} options Options object to pass to the dataProvider. May include side effects to be executed upon success of failure, e.g. { onSuccess: { refresh: true } } diff --git a/packages/ra-core/src/i18n/useSetLocale.tsx b/packages/ra-core/src/i18n/useSetLocale.tsx index 228e373f826..be4d017b635 100644 --- a/packages/ra-core/src/i18n/useSetLocale.tsx +++ b/packages/ra-core/src/i18n/useSetLocale.tsx @@ -9,8 +9,6 @@ import { useNotify } from '../sideEffect'; * * This hook rerenders when the locale changes. * - * @param {string} locale - * * @example * * import { useLocale } from 'react-admin'; diff --git a/packages/ra-core/src/sideEffect/admin.ts b/packages/ra-core/src/sideEffect/admin.ts index a176def4d3f..2215be46c5a 100644 --- a/packages/ra-core/src/sideEffect/admin.ts +++ b/packages/ra-core/src/sideEffect/admin.ts @@ -11,6 +11,7 @@ import undo from './undo'; /** * @param {Object} dataProvider A Data Provider function + * @param {Function} authProvider */ export default ( dataProvider: DataProvider, diff --git a/packages/ra-core/src/util/renderWithRedux.tsx b/packages/ra-core/src/util/renderWithRedux.tsx index 8c495f0a46c..f45d9839ec1 100644 --- a/packages/ra-core/src/util/renderWithRedux.tsx +++ b/packages/ra-core/src/util/renderWithRedux.tsx @@ -17,7 +17,7 @@ export interface RenderWithReduxResult extends RenderResult { * ); * * @param {ReactNode} component: The component you want to test in jsx - * @param {Object} initialstate: Optional initial state of the redux store + * @param {Object} initialState: Optional initial state of the redux store * @param {Object} options: Render options, e.g. to use a custom container element * @return {{ dispatch, reduxStore, ...rest }} helper function to test rendered component. * Same as @testing-library/react render method with added dispatch and reduxStore helper diff --git a/packages/ra-data-graphql/README.md b/packages/ra-data-graphql/README.md index 0cc63035e4a..56c53c2e7ac 100644 --- a/packages/ra-data-graphql/README.md +++ b/packages/ra-data-graphql/README.md @@ -131,7 +131,7 @@ The introspection result is an object with 4 properties: - `types`: an array of all the GraphQL types discovered on your endpoint - `queries`: an array of all the GraphQL queries and mutations discovered on your endpoint -- `resources`: an array of objects with a `type` property, which is the GraphQL type for this resource, and a property for each react-admin fetch verb for which we found a matching query or mutation +- `resources`: an array of objects with a `type` property, which is the GraphQL type for this resource, and a property for each react-admin fetch verb for which we found a matching query or mutation - `schema`: the full schema For example: From 634461d8764096011db8c242236fdd69baf0a00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Svarcas?= Date: Thu, 17 Oct 2019 09:44:31 -0300 Subject: [PATCH 2/5] Update packages/ra-core/src/sideEffect/admin.ts Co-Authored-By: Gildas Garcia --- packages/ra-core/src/sideEffect/admin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ra-core/src/sideEffect/admin.ts b/packages/ra-core/src/sideEffect/admin.ts index 2215be46c5a..c538c98f3a2 100644 --- a/packages/ra-core/src/sideEffect/admin.ts +++ b/packages/ra-core/src/sideEffect/admin.ts @@ -11,7 +11,7 @@ import undo from './undo'; /** * @param {Object} dataProvider A Data Provider function - * @param {Function} authProvider + * @param {Function} authProvider An Authentication Provider object */ export default ( dataProvider: DataProvider, From efe708cc9660584a064123292141f2d6b2e2fd19 Mon Sep 17 00:00:00 2001 From: asvarcas Date: Thu, 17 Oct 2019 09:45:34 -0300 Subject: [PATCH 3/5] Updated JSDocs with suggested changes. --- packages/ra-core/src/dataProvider/Mutation.tsx | 2 +- packages/ra-core/src/dataProvider/Query.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ra-core/src/dataProvider/Mutation.tsx b/packages/ra-core/src/dataProvider/Mutation.tsx index 58d40ddc789..e78e67ac910 100644 --- a/packages/ra-core/src/dataProvider/Mutation.tsx +++ b/packages/ra-core/src/dataProvider/Mutation.tsx @@ -28,7 +28,7 @@ interface Props { /** * Get a callback to call the data provider and pass the result to a child function * - * @param {any} children + * @param {Function} children Must be a function which will be called with the mutate callback * @param {string} type The method called on the data provider, e.g. 'update', 'delete'. Can also be a custom method if the dataProvider supports is. * @param {string} resource A resource name, e.g. 'posts', 'comments' * @param {Object} payload The payload object, e.g; { id: 12 } diff --git a/packages/ra-core/src/dataProvider/Query.tsx b/packages/ra-core/src/dataProvider/Query.tsx index 69609568d97..b6e6049809b 100644 --- a/packages/ra-core/src/dataProvider/Query.tsx +++ b/packages/ra-core/src/dataProvider/Query.tsx @@ -20,7 +20,7 @@ interface Props { /** * Fetch the data provider and pass the result to a child function * - * @param {any} children + * @param {Function} children Must be a function which will be called with the mutate callback * @param {string} type The method called on the data provider, e.g. 'getList', 'getOne'. Can also be a custom method if the dataProvider supports is. * @param {string} resource A resource name, e.g. 'posts', 'comments' * @param {Object} payload The payload object, e.g; { post_id: 12 } From 16ea6964fa11e172e61c61d6a13615abcaf0b7cd Mon Sep 17 00:00:00 2001 From: asvarcas Date: Thu, 17 Oct 2019 10:08:27 -0300 Subject: [PATCH 4/5] Corrected Readme. --- packages/ra-tree-language-french/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ra-tree-language-french/README.md b/packages/ra-tree-language-french/README.md index 93cef61704c..0d40654b693 100644 --- a/packages/ra-tree-language-french/README.md +++ b/packages/ra-tree-language-french/README.md @@ -11,7 +11,7 @@ npm install --save ra-language-french ra-tree-language-french ## Usage ```js -import englishMessages from 'ra-language-french'; +import frenchMessages from 'ra-language-french'; import treeFrenchMessages from 'ra-tree-language-french'; import { mergeTranslations } from 'react-admin'; From 525f8d4683ff6b4f0697da60a5cd981fc44cb78d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Svarcas?= Date: Thu, 17 Oct 2019 10:09:51 -0300 Subject: [PATCH 5/5] Update packages/ra-core/src/dataProvider/Query.tsx Co-Authored-By: Gildas Garcia --- packages/ra-core/src/dataProvider/Query.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ra-core/src/dataProvider/Query.tsx b/packages/ra-core/src/dataProvider/Query.tsx index b6e6049809b..2f97e66acdb 100644 --- a/packages/ra-core/src/dataProvider/Query.tsx +++ b/packages/ra-core/src/dataProvider/Query.tsx @@ -20,7 +20,7 @@ interface Props { /** * Fetch the data provider and pass the result to a child function * - * @param {Function} children Must be a function which will be called with the mutate callback + * @param {Function} children Must be a function which will be called with an object containing the following keys: data, loading and error * @param {string} type The method called on the data provider, e.g. 'getList', 'getOne'. Can also be a custom method if the dataProvider supports is. * @param {string} resource A resource name, e.g. 'posts', 'comments' * @param {Object} payload The payload object, e.g; { post_id: 12 }