Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos in comments and string literals #5739

Merged
merged 10 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/ra-core/src/auth/useCheckAuth.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('useCheckAuth', () => {
expect(queryByText('not authenticated')).not.toBeNull();
});

it('should logout whitout showing a notification when disableNotification is true', async () => {
it('should logout without showing a notification when disableNotification is true', async () => {
const { queryByText } = render(
<AuthContext.Provider value={authProvider}>
<TestComponent params={{ token: false }} disableNotification />
Expand All @@ -114,7 +114,7 @@ describe('useCheckAuth', () => {
expect(queryByText('authenticated')).toBeNull();
});

it('should logout whitout showing a notification when authProvider returns error with message false', async () => {
it('should logout without showing a notification when authProvider returns error with message false', async () => {
const { queryByText } = render(
<AuthContext.Provider
value={{
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/auth/useCheckAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const checkAuthWithoutAuthProvider = () => Promise.resolve();
* Logs the user out on failure.
*
* @param {Object} params The parameters to pass to the authProvider
* @param {boolean} logoutOnFailure Whether the user should be logged out if the authProvider fails to authenticatde them. True by default.
* @param {boolean} logoutOnFailure Whether the user should be logged out if the authProvider fails to authenticate them. True by default.
* @param {string} redirectTo The login form url. Defaults to '/login'
* @param {boolean} disableNotification Avoid showing a notification after the user is logged out. false by default.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/auth/useLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 {string} pathName The path to redirect to after login. By default, redirects to the home page, or to the last page visited after deconnexion.
* @param {string} pathName The path to redirect to after login. By default, redirects to the home page, or to the last page visited after disconnection.
*
* @return {Promise} The authProvider response
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/auth/useLogout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const useLogout = (): Logout => {
// do not redirect
return;
}
// redirectTo can contain a query string, e.g '/login?foo=bar'
// redirectTo can contain a query string, e.g. '/login?foo=bar'
// we must split the redirectTo to pass a structured location to history.push()
const redirectToParts = (
redirectToFromProvider || redirectTo
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-core/src/auth/useLogoutIfAccessDenied.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('useLogoutIfAccessDenied', () => {
expect(queryByText('logged in')).toBeNull();
});

it('should logout whitout showing a notification if disableAuthentication is true', async () => {
it('should logout without showing a notification if disableAuthentication is true', async () => {
const { queryByText } = render(
<AuthContext.Provider value={authProvider}>
<TestComponent
Expand All @@ -122,7 +122,7 @@ describe('useLogoutIfAccessDenied', () => {
expect(queryByText('logged in')).toBeNull();
});

it('should logout whitout showing a notification if authProvider returns error with message false', async () => {
it('should logout without showing a notification if authProvider returns error with message false', async () => {
const { queryByText } = render(
<AuthContext.Provider
value={{
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/auth/useLogoutIfAccessDenied.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const useLogoutIfAccessDenied = (): LogoutIfAccessDenied => {
const logoutIfAccessDeniedWithoutProvider = () => Promise.resolve(false);

/**
* Call the authProvider.authError() method, unsing the error passed as argument.
* Call the authProvider.authError() method, using the error passed as argument.
* If the authProvider rejects the call, logs the user out and shows a logged out notification.
*
* @param {Error} error An Error object (usually returned by the dataProvider)
Expand Down
10 changes: 5 additions & 5 deletions packages/ra-core/src/controller/ListContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { ListControllerProps } from './useListController';
* Context to store the result of the useListController() hook.
*
* Use the useListContext() hook to read the context. That's what many
* List components do in react-admn (e.g. <Datagrid>, <Filter>, <Pagination>).
* List components do in react-admin (e.g. <Datagrid>, <Filter>, <Pagination>).
*
* @typedef {Object} ListControllerProps
* @prop {Object} data an id-based dictionary of the list data, e.g. { 123: { id: 123, title: 'hello world' }, 456: { ... } }
* @prop {Array} ids an array listing the ids of the records in the list, e.g [123, 456, ...]
* @prop {Array} ids an array listing the ids of the records in the list, e.g. [123, 456, ...]
* @prop {integer} total the total number of results for the current filters, excluding pagination. Useful to build the pagination controls. e.g. 23
* @prop {boolean} loaded boolean that is false until the data is available
* @prop {boolean} loading boolean that is true on mount, and false once the data was fetched
Expand All @@ -23,9 +23,9 @@ import { ListControllerProps } from './useListController';
* @prop {Function} setFilters a callback to update the filters, e.g. setFilters(filters, displayedFilters)
* @prop {Object} displayedFilters a dictionary of the displayed filters, e.g. { title: true, nationality: true }
* @prop {Function} showFilter a callback to show one of the filters, e.g. showFilter('title', defaultValue)
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hidefilter('title')
* @prop {Array} selectedIds an array listing the ids of the selcted rows, e.g. [123, 456]
* @prop {Function} onSelect callback to change the list of selected rows, e.g onSelect([456, 789])
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hideFilter('title')
* @prop {Array} selectedIds an array listing the ids of the selected rows, e.g. [123, 456]
* @prop {Function} onSelect callback to change the list of selected rows, e.g. onSelect([456, 789])
* @prop {Function} onToggleItem callback to toggle the selection of a given record based on its id, e.g. onToggleItem(456)
* @prop {Function} onUnselectItems callback to clear the selection, e.g. onUnselectItems();
* @prop {string} basePath deduced from the location, useful for action buttons
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-core/src/controller/ListFilterContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import { ListControllerProps } from './useListController';
* Context to store the filter part of the useListController() result.
*
* Use the useListFilterContext() hook to read the context. That's what many
* List components do in react-admn (e.g. <Filter>, <FilterListItem>).
* List components do in react-admin (e.g. <Filter>, <FilterListItem>).
*
* @typedef {Object} ListFilterContextValue
* @prop {Object} filterValues a dictionary of filter values, e.g. { title: 'lorem', nationality: 'fr' }
* @prop {Function} setFilters a callback to update the filters, e.g. setFilters(filters, displayedFilters)
* @prop {Object} displayedFilters a dictionary of the displayed filters, e.g. { title: true, nationality: true }
* @prop {Function} showFilter a callback to show one of the filters, e.g. showFilter('title', defaultValue)
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hidefilter('title')
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hideFilter('title')
* @prop {string} resource the resource name, deduced from the location. e.g. 'posts'
*
* @typedef Props
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/ListPaginationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ListControllerProps } from './useListController';
* Context to store the pagination part of the useListController() result.
*
* Use the useListPaginationContext() hook to read the pagination information.
* That's what List components do in react-admn (e.g. <Pagination>).
* That's what List components do in react-admin (e.g. <Pagination>).
*
* @typedef {Object} ListPaginationContextValue
* @prop {boolean} loading boolean that is true on mount, and false once the data was fetched
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/ListSortContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ListControllerProps } from './useListController';
* Context to store the sort part of the useListController() result.
*
* Use the useListSortContext() hook to read the context. That's what many
* List components do in react-admn (e.g. <SortButton>).
* List components do in react-admin (e.g. <SortButton>).
*
* @typedef {Object} ListSortContextValue
* @prop {Object} currentSort a sort object { field, order }, e.g. { field: 'date', order: 'DESC' }
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/details/SaveContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const useSaveContext = <
*/
if (process.env.NODE_ENV !== 'production') {
console.log(
"Edit or Create child components must be used inside a <SaveContextProvider>. Relying on props rather than context to get persistance related data and callbacks is deprecated and won't be supported in the next major version of react-admin."
"Edit or Create child components must be used inside a <SaveContextProvider>. Relying on props rather than context to get persistence related data and callbacks is deprecated and won't be supported in the next major version of react-admin."
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/details/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export * from './useEditContext';
export * from './useShowContext';

// We don't want to export CreateProps, EditProps and ShowProps as they should
// not be used outside of ra-core would conflict with ra-ui-materialui types,
// not be used outside ra-core, since it would conflict with ra-ui-materialui types,
// hence the named imports/exports
export type { CreateControllerProps, EditControllerProps, ShowControllerProps };
export { useCreateController, useEditController, useShowController };
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface Props {
/**
* Fetch reference record, and delegate rendering to child component.
*
* The reference prop sould be the name of one of the <Resource> components
* The reference prop should be the name of one of the <Resource> components
* added as <Admin> child.
*
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ interface Options {
const defaultFilter = {};

/**
* Fetch reference records, and return them when avaliable
* Fetch reference records, and return them when available
*
* The reference prop sould be the name of one of the <Resource> components
* The reference prop should be the name of one of the <Resource> components
* added as <Admin> child.
*
* @example
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/useFilterState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const defaultFilterToQuery = (v: string) => ({ q: v });
* permanentFilter: { foo: 'bar' },
* debounceTime: 500,
* });
* // filter inital value:
* // filter initial value:
* {
* query: '',
* foo: 'bar'
Expand Down
8 changes: 4 additions & 4 deletions packages/ra-core/src/controller/useListContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Record } from '../types';
*
* @typedef {Object} ListControllerProps
* @prop {Object} data an id-based dictionary of the list data, e.g. { 123: { id: 123, title: 'hello world' }, 456: { ... } }
* @prop {Array} ids an array listing the ids of the records in the list, e.g [123, 456, ...]
* @prop {Array} ids an array listing the ids of the records in the list, e.g. [123, 456, ...]
* @prop {integer} total the total number of results for the current filters, excluding pagination. Useful to build the pagination controls. e.g. 23
* @prop {boolean} loaded boolean that is false until the data is available
* @prop {boolean} loading boolean that is true on mount, and false once the data was fetched
Expand All @@ -26,9 +26,9 @@ import { Record } from '../types';
* @prop {Function} setFilters a callback to update the filters, e.g. setFilters(filters, displayedFilters)
* @prop {Object} displayedFilters a dictionary of the displayed filters, e.g. { title: true, nationality: true }
* @prop {Function} showFilter a callback to show one of the filters, e.g. showFilter('title', defaultValue)
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hidefilter('title')
* @prop {Array} selectedIds an array listing the ids of the selcted rows, e.g. [123, 456]
* @prop {Function} onSelect callback to change the list of selected rows, e.g onSelect([456, 789])
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hideFilter('title')
* @prop {Array} selectedIds an array listing the ids of the selected rows, e.g. [123, 456]
* @prop {Function} onSelect callback to change the list of selected rows, e.g. onSelect([456, 789])
* @prop {Function} onToggleItem callback to toggle the selection of a given record based on its id, e.g. onToggleItem(456)
* @prop {Function} onUnselectItems callback to clear the selection, e.g. onUnselectItems();
* @prop {string} basePath deduced from the location, useful for action buttons
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/useListFilterContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ListFilterContext, { ListFilterContextValue } from './ListFilterContext';
* @prop {Function} setFilters a callback to update the filters, e.g. setFilters(filters, displayedFilters)
* @prop {Object} displayedFilters a dictionary of the displayed filters, e.g. { title: true, nationality: true }
* @prop {Function} showFilter a callback to show one of the filters, e.g. showFilter('title', defaultValue)
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hidefilter('title')
* @prop {Function} hideFilter a callback to hide one of the filters, e.g. hideFilter('title')
* @prop {string} resource the resource name, deduced from the location. e.g. 'posts'
*
* @returns {ListFilterContextValue} list controller props
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/usePaginationState.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('usePaginationState', () => {
expect(hookValue.pagination).toEqual({ page: 1, perPage: 25 });
});

it('should take given page and perPage props to initalize', () => {
it('should take given page and perPage props to initialize with', () => {
const { hookValue } = renderHook(() =>
usePaginationState({ perPage: 50, page: 10 })
);
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-core/src/controller/usePaginationState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const defaultPagination = {
};

/**
* Hooks to provide pagination state (apge and perPage)
* Hooks to provide pagination state (page and perPage)
*
* @example
*
* const { page, setpage, perPage, setPerPage } = usePagination(initialPerPage);
* const { page, setPage, perPage, setPerPage } = usePagination(initialPerPage);
*
* @param {number} initialPagination the initial value per page
* @returns {PaginationHookResult} The pagination props
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/useReference.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('useReference', () => {
expect(dispatch).toBeCalledTimes(10);
});

it('it should not refetch reference when other props change change', async () => {
it('it should not refetch reference when other props change', async () => {
const dataProvider = {
getMany: jest.fn(() =>
Promise.resolve({ data: [{ id: 1, title: 'foo' }] })
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/controller/useReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface UseReferenceProps {
/**
* Fetch reference record, and return it when available
*
* The reference prop sould be the name of one of the <Resource> components
* The reference prop should be the name of one of the <Resource> components
* added as <Admin> child.
*
* @example
Expand Down
8 changes: 4 additions & 4 deletions packages/ra-core/src/controller/useSortState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,24 @@ const sortReducer = (state: SortPayload, action: Action): SortPayload => {
export const defaultSort = { field: 'id', order: 'DESC' };

/**
* set the sort { field, order }
* Set the sort { field, order }
* @name setSort
* @function
* @param {SortPayload} sort the sort object
*/

/**
* set the sort field, swap the order if the field is the same
* Set the sort field, swap the order if the field is the same
* @name setSortField
* @function
* @param {string} field the sort field
*/

/**
* set the sort order
* Set the sort order
* @name setSortOrder
* @function
* @param {string} order the sort order eiather ASC or DESC
* @param {string} order The sort order, either ASC or DESC
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/core/CoreAdminRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const CoreAdminRouter: FunctionComponent<AdminRouterProps> = props => {
return (
<div>
{
// Render every resources children outside the React Router Switch
// Render every resource children outside the React Router Switch
// as we need all of them and not just the one rendered
Children.map(
childrenToRender,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/core/ResourceContext.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createContext } from 'react';

/**
* Context to store the current resource informations.
* Context to store the current resource information.
*
* Use the useResource() hook to read the context. That's what most components do in react-admin.
*
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-core/src/dataProvider/Mutation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ interface Props {
* @param {Object} options
* @param {string} options.action Redux action type
* @param {boolean} options.undoable Set to true to run the mutation locally before calling the dataProvider
* @param {Function} options.onSuccess Side effect function to be executed upon success or 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} options.onSuccess Side effect function to be executed upon success or 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) }
*
* @example
*
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/dataProvider/Query.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ describe('Query', () => {
payload: undefined,
meta: { resource: 'foo' },
});
dispatchSpy.mockClear(); // clar initial fetch
dispatchSpy.mockClear(); // clear initial fetch

const testElement = getByTestId('test');
fireEvent.click(testElement);
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-core/src/dataProvider/Query.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ interface Props {
* @param {Object} payload The payload object, e.g; { post_id: 12 }
* @param {Object} options
* @param {string} options.action Redux action type
* @param {Function} options.onSuccess Side effect function to be executed upon success or 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} options.onSuccess Side effect function to be executed upon success or 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) }
*
* This component also supports legacy side effects (e.g. { onSuccess: { refresh: true } })
*
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/dataProvider/useCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useMutation from './useMutation';
* - error: [callback, { error: [error from response], loading: false, loaded: true }]
*
* @param resource The resource name, e.g. 'posts'
* @param data The data to initialize the new record with, e.g. { title: 'hello, world" }
* @param data The data to initialize the new record with, e.g. { title: 'hello, world' }
* @param options Options object to pass to the dataProvider. May include side effects to be executed upon success or failure, e.g. { onSuccess: { refresh: true } }
*
* @returns The current request state. Destructure as [create, { data, error, loading, loaded }].
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/dataProvider/useDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import { useState } from 'react';
* <Fragment>
* {posts.map((post, key) => <PostDetail post={post} key={key} />)}
* </Fragment>
* }
* );
* }
*
* @example Handling all states (loading, error, success)
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-core/src/dataProvider/useGetOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const useGetOne = <RecordType extends Record = Record>(
if (
// resources are registered
Object.keys(state.admin.resources).length > 0 &&
// no registered resource mathing the query
// no registered resource matching the query
!state.admin.resources[resource]
) {
throw new Error(
Expand Down
Loading