diff --git a/.eslintrc b/.eslintrc index 403188c6649..8c5d4d4b405 100644 --- a/.eslintrc +++ b/.eslintrc @@ -33,7 +33,8 @@ { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", - "caughtErrorsIgnorePattern": "^_" + "caughtErrorsIgnorePattern": "^_", + "ignoreRestSiblings": true } ] } diff --git a/cypress/cypress.config.js b/cypress/cypress.config.js index b76dbc0ffe5..515c72ea8b0 100644 --- a/cypress/cypress.config.js +++ b/cypress/cypress.config.js @@ -11,7 +11,7 @@ export default defineConfig({ e2e: { // We've imported your old cypress plugins here. // You may want to clean this up later by importing these. - setupNodeEvents(on, config) { + setupNodeEvents(on) { on('before:browser:launch', (browser = {}, launchOptions) => { // Fix for Cypress 4: // https://docs.cypress.io/api/plugins/browser-launch-api.html#Usage diff --git a/cypress/e2e/edit.cy.js b/cypress/e2e/edit.cy.js index 487b959473d..4b57a412be8 100644 --- a/cypress/e2e/edit.cy.js +++ b/cypress/e2e/edit.cy.js @@ -83,7 +83,7 @@ describe('Edit Page', () => { cy.contains('Required'); // FIXME: We navigate away from the page and confirm the unsaved changes // This is needed because HashHistory would prevent further navigation - cy.window().then(win => { + cy.window().then(() => { cy.on('window:confirm', () => true); }); cy.get('.RaSidebar-fixed [role="menuitem"]:first-child').click(); diff --git a/examples/crm/src/dataGenerator/sales.ts b/examples/crm/src/dataGenerator/sales.ts index 44d75889df0..d0e0739646a 100644 --- a/examples/crm/src/dataGenerator/sales.ts +++ b/examples/crm/src/dataGenerator/sales.ts @@ -2,7 +2,7 @@ import { name, internet } from 'faker/locale/en_US'; import { Db } from './types'; -export const generateSales = (db: Db) => { +export const generateSales = (_: Db) => { const randomSales = Array.from(Array(10).keys()).map(id => { const first_name = name.firstName(); const last_name = name.lastName(); diff --git a/examples/crm/src/dataGenerator/tags.ts b/examples/crm/src/dataGenerator/tags.ts index a00d98cbdcb..fd275acd320 100644 --- a/examples/crm/src/dataGenerator/tags.ts +++ b/examples/crm/src/dataGenerator/tags.ts @@ -20,6 +20,6 @@ const tags = [ { id: 5, name: 'vip', color: '#dbe7e4' }, ]; -export const generateTags = (db: Db) => { +export const generateTags = (_: Db) => { return [...tags]; }; diff --git a/examples/crm/src/deals/OnlyMineInput.tsx b/examples/crm/src/deals/OnlyMineInput.tsx index 3f5880150f8..bc987698d8f 100644 --- a/examples/crm/src/deals/OnlyMineInput.tsx +++ b/examples/crm/src/deals/OnlyMineInput.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { useListFilterContext, useGetIdentity } from 'react-admin'; import { Box, Switch, FormControlLabel } from '@mui/material'; -export const OnlyMineInput = ({ alwaysOn }: { alwaysOn: boolean }) => { +export const OnlyMineInput = (_: { alwaysOn: boolean }) => { const { filterValues, displayedFilters, diff --git a/examples/demo/src/orders/MobileGrid.tsx b/examples/demo/src/orders/MobileGrid.tsx index 1db8cb90f7a..1fc501ae346 100644 --- a/examples/demo/src/orders/MobileGrid.tsx +++ b/examples/demo/src/orders/MobileGrid.tsx @@ -9,18 +9,13 @@ import { BooleanField, useTranslate, useListContext, - RaRecord, RecordContextProvider, } from 'react-admin'; import CustomerReferenceField from '../visitors/CustomerReferenceField'; import { Order } from '../types'; -interface MobileGridProps { - data?: RaRecord[]; -} - -const MobileGrid = (props: MobileGridProps) => { +const MobileGrid = () => { const { data, isLoading } = useListContext(); const translate = useTranslate(); if (isLoading || data.length === 0) { diff --git a/examples/demo/src/products/ThumbnailField.tsx b/examples/demo/src/products/ThumbnailField.tsx index 9bd215daa55..2edab5d2d03 100644 --- a/examples/demo/src/products/ThumbnailField.tsx +++ b/examples/demo/src/products/ThumbnailField.tsx @@ -10,7 +10,7 @@ const Img = styled('img')({ verticalAlign: 'middle', }); -const ThumbnailField = (props: { source: string; label?: string }) => { +const ThumbnailField = (_: { source: string; label?: string }) => { const record = useRecordContext(); if (!record) return null; return ; diff --git a/examples/demo/src/visitors/CustomerLinkField.tsx b/examples/demo/src/visitors/CustomerLinkField.tsx index 0e42108ac6e..64d4f5827e0 100644 --- a/examples/demo/src/visitors/CustomerLinkField.tsx +++ b/examples/demo/src/visitors/CustomerLinkField.tsx @@ -4,7 +4,7 @@ import { Link, FieldProps, useRecordContext } from 'react-admin'; import FullNameField from './FullNameField'; import { Customer } from '../types'; -const CustomerLinkField = (props: FieldProps) => { +const CustomerLinkField = (_: FieldProps) => { const record = useRecordContext(); if (!record) { return null; diff --git a/examples/demo/src/visitors/SegmentsField.tsx b/examples/demo/src/visitors/SegmentsField.tsx index 646daf05984..79bce6572e7 100644 --- a/examples/demo/src/visitors/SegmentsField.tsx +++ b/examples/demo/src/visitors/SegmentsField.tsx @@ -9,7 +9,7 @@ const segmentsById = segments.reduce((acc, segment) => { return acc; }, {} as { [key: string]: any }); -const SegmentsField = (props: FieldProps) => { +const SegmentsField = (_: FieldProps) => { const translate = useTranslate(); const record = useRecordContext(); if (!record || !record.groups) { diff --git a/examples/simple/src/posts/PostCreate.tsx b/examples/simple/src/posts/PostCreate.tsx index 0f5fba40b36..f8acc6ee04e 100644 --- a/examples/simple/src/posts/PostCreate.tsx +++ b/examples/simple/src/posts/PostCreate.tsx @@ -30,7 +30,7 @@ import { import { useFormContext, useWatch } from 'react-hook-form'; import { Button, Dialog, DialogActions, DialogContent } from '@mui/material'; -const PostCreateToolbar = props => { +const PostCreateToolbar = () => { const notify = useNotify(); const redirect = useRedirect(); const { reset } = useFormContext(); @@ -163,12 +163,7 @@ const PostCreate = () => { /> - {({ - formData, - scopedFormData, - getSource, - ...rest - }) => + {({ scopedFormData, getSource, ...rest }) => scopedFormData && scopedFormData.user_id ? ( ( ); const SanitizedBox = ({ + // eslint-disable-next-line @typescript-eslint/no-unused-vars fullWidth, ...props }: BoxProps & { fullWidth?: boolean }) => ; @@ -156,12 +157,7 @@ const PostEdit = () => { - {({ - formData, - scopedFormData, - getSource, - ...rest - }) => + {({ scopedFormData, getSource, ...rest }) => scopedFormData && scopedFormData.user_id ? ( { +const QuickFilter = ({ + label, +}: { + label?: string; + source?: string; + defaultValue?: any; +}) => { const translate = useTranslate(); return ; }; @@ -104,13 +110,19 @@ const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ '& .publishedAt': { fontStyle: 'italic' }, })); -const PostListBulkActions = memo(({ children, ...props }) => ( - - - - - -)); +const PostListBulkActions = memo( + ({ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + children, + ...props + }) => ( + + + + + + ) +); const PostListActions = () => ( @@ -121,11 +133,11 @@ const PostListActions = () => ( ); -const PostListActionToolbar = ({ children, ...props }) => ( +const PostListActionToolbar = ({ children }) => ( {children} ); -const rowClick = (id, resource, record) => { +const rowClick = (_id, _resource, record) => { if (record.commentable) { return 'edit'; } @@ -133,7 +145,7 @@ const rowClick = (id, resource, record) => { return 'show'; }; -const PostPanel = ({ id, record, resource }) => ( +const PostPanel = ({ record }) => (
); diff --git a/examples/simple/src/users/UserCreate.tsx b/examples/simple/src/users/UserCreate.tsx index 7621a203c9e..7d2323a4f34 100644 --- a/examples/simple/src/users/UserCreate.tsx +++ b/examples/simple/src/users/UserCreate.tsx @@ -26,7 +26,7 @@ const UserEditToolbar = ({ permissions, ...props }) => { { + onSuccess: () => { notify('ra.notification.created', { type: 'info', messageArgs: { diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx index cc919e1e872..0654d5e450f 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.tsx @@ -449,7 +449,7 @@ If you provided a React element for the optionText prop, you must also provide t const handleInputChange = ( event: any, newInputValue: string, - reason: string + _reason: string ) => { if ( event?.type === 'change' || @@ -511,7 +511,7 @@ If you provided a React element for the optionText prop, you must also provide t const handleAutocompleteChange = ( event: any, newValue: any, - reason: string + _reason: string ) => { handleChangeWithCreateSupport(newValue != null ? newValue : emptyValue); }; diff --git a/packages/ra-ui-materialui/src/input/DatagridInput.stories.tsx b/packages/ra-ui-materialui/src/input/DatagridInput.stories.tsx index 5e721bcb348..1d2e1c78933 100644 --- a/packages/ra-ui-materialui/src/input/DatagridInput.stories.tsx +++ b/packages/ra-ui-materialui/src/input/DatagridInput.stories.tsx @@ -12,7 +12,7 @@ import { ReferenceArrayInput } from './ReferenceArrayInput'; export default { title: 'ra-ui-materialui/input/DatagridInput' }; const dataProvider = { - getOne: (resource, params) => + getOne: () => Promise.resolve({ data: { id: 1, @@ -23,7 +23,7 @@ const dataProvider = { year: 1869, }, }), - update: (resource, params) => Promise.resolve(params), + update: (_resource, params) => Promise.resolve(params), } as any; const history = createMemoryHistory({ initialEntries: ['/books/1'] }); @@ -74,7 +74,7 @@ const authors = [ ]; const dataProviderWithAuthors = { - getOne: (resource, params) => + getOne: () => Promise.resolve({ data: { id: 1, @@ -85,11 +85,11 @@ const dataProviderWithAuthors = { year: 1869, }, }), - getMany: (resource, params) => + getMany: (_resource, params) => Promise.resolve({ data: authors.filter(author => params.ids.includes(author.id)), }), - getList: (resource, params) => + getList: (_resource, params) => new Promise(resolve => { // eslint-disable-next-line eqeqeq if (params.filter.q == undefined) { @@ -119,8 +119,8 @@ const dataProviderWithAuthors = { 500 ); }), - update: (resource, params) => Promise.resolve(params), - create: (resource, params) => { + update: (_resource, params) => Promise.resolve(params), + create: (_resource, params) => { const newAuthor = { id: authors.length + 1, name: params.data.name, diff --git a/packages/ra-ui-materialui/src/input/DateInput.spec.tsx b/packages/ra-ui-materialui/src/input/DateInput.spec.tsx index 2053d158598..90704784ede 100644 --- a/packages/ra-ui-materialui/src/input/DateInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/DateInput.spec.tsx @@ -157,7 +157,7 @@ describe('', () => { onSubmit={onSubmit} defaultValues={{ publishedAt: new Date('2021-09-11') }} > - null} /> + null} /> ); diff --git a/packages/ra-ui-materialui/src/input/FileInput.spec.tsx b/packages/ra-ui-materialui/src/input/FileInput.spec.tsx index 483afabb1dc..7a384e0fea8 100644 --- a/packages/ra-ui-materialui/src/input/FileInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/FileInput.spec.tsx @@ -282,7 +282,7 @@ describe('', () => { > { + validateFileRemoval={() => { throw Error('Cancel Removal Action'); }} > @@ -334,7 +334,7 @@ describe('', () => { > { + validateFileRemoval={async () => { throw Error('Cancel Removal Action'); }} > @@ -381,7 +381,7 @@ describe('', () => { > true} + validateFileRemoval={() => true} > @@ -420,7 +420,7 @@ describe('', () => { > true} + validateFileRemoval={async () => true} > diff --git a/packages/ra-ui-materialui/src/input/NumberInput.spec.tsx b/packages/ra-ui-materialui/src/input/NumberInput.spec.tsx index e22ff1262cc..6b94d91556b 100644 --- a/packages/ra-ui-materialui/src/input/NumberInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/NumberInput.spec.tsx @@ -550,7 +550,7 @@ describe('', () => { > undefined} + validate={() => undefined} /> diff --git a/packages/ra-ui-materialui/src/input/ReferenceInput.stories.tsx b/packages/ra-ui-materialui/src/input/ReferenceInput.stories.tsx index 722427be2e1..00c535a37ee 100644 --- a/packages/ra-ui-materialui/src/input/ReferenceInput.stories.tsx +++ b/packages/ra-ui-materialui/src/input/ReferenceInput.stories.tsx @@ -36,7 +36,7 @@ const authors = [ ]; export const dataProviderWithAuthors = { - getOne: (resource, params) => + getOne: () => Promise.resolve({ data: { id: 1, @@ -47,11 +47,11 @@ export const dataProviderWithAuthors = { year: 1869, }, }), - getMany: (resource, params) => + getMany: (_resource, params) => Promise.resolve({ data: authors.filter(author => params.ids.includes(author.id)), }), - getList: (resource, params) => + getList: () => new Promise(resolve => { // eslint-disable-next-line eqeqeq setTimeout( @@ -64,7 +64,7 @@ export const dataProviderWithAuthors = { ); return; }), - update: (resource, params) => Promise.resolve(params), + update: (_resource, params) => Promise.resolve(params), } as any; const BookEdit = () => ( @@ -288,14 +288,14 @@ export const ErrorAutocomplete = () => ( Promise.resolve({ data: book }), - getMany: (resource, params) => + getOne: () => Promise.resolve({ data: book }), + getMany: (_resource, params) => Promise.resolve({ data: authors.filter(author => params.ids.includes(author.id) ), }), - getList: (resource, params) => + getList: (_resource, params) => params.filter.q === 'lorem' ? Promise.reject(new Error('An error occured')) : Promise.resolve({ @@ -360,14 +360,14 @@ export const ErrorSelectInput = () => ( Promise.resolve({ data: book }), - getMany: (resource, params) => + getOne: () => Promise.resolve({ data: book }), + getMany: (_resource, params) => Promise.resolve({ data: authors.filter(author => params.ids.includes(author.id) ), }), - getList: (resource, params) => + getList: (_resource, _params) => Promise.reject(new Error('An error occured')), } as any } @@ -429,14 +429,14 @@ export const ErrorRadioButtonGroupInput = () => ( Promise.resolve({ data: book }), - getMany: (resource, params) => + getOne: () => Promise.resolve({ data: book }), + getMany: (_resource, params) => Promise.resolve({ data: authors.filter(author => params.ids.includes(author.id) ), }), - getList: (resource, params) => + getList: (_resource, _params) => Promise.reject(new Error('An error occured')), } as any } @@ -479,7 +479,7 @@ const BookEditWithSelfReference = () => { { + onSuccess: () => { // Redirecting to another page is an indirect way to make sure that // no errors happened during the update nor its side effects // (used by the jest tests) diff --git a/packages/ra-ui-materialui/src/input/SelectInput.stories.tsx b/packages/ra-ui-materialui/src/input/SelectInput.stories.tsx index 9dc065bc186..04cd3da0479 100644 --- a/packages/ra-ui-materialui/src/input/SelectInput.stories.tsx +++ b/packages/ra-ui-materialui/src/input/SelectInput.stories.tsx @@ -211,7 +211,7 @@ const authors = [ ]; const dataProviderWithAuthors = { - getOne: (resource, params) => + getOne: () => Promise.resolve({ data: { id: 1, @@ -222,11 +222,11 @@ const dataProviderWithAuthors = { year: 1869, }, }), - getMany: (resource, params) => + getMany: (_resource, params) => Promise.resolve({ data: authors.filter(author => params.ids.includes(author.id)), }), - getList: (resource, params) => + getList: () => new Promise(resolve => { // eslint-disable-next-line eqeqeq setTimeout( @@ -239,8 +239,8 @@ const dataProviderWithAuthors = { ); return; }), - update: (resource, params) => Promise.resolve(params), - create: (resource, params) => { + update: (_resource, params) => Promise.resolve(params), + create: (_resource, params) => { const newAuthor = { id: authors.length + 1, first_name: params.data.first_name, @@ -291,7 +291,7 @@ export const InsideReferenceInputDefaultValue = ({ + getOne: () => Promise.resolve({ data: { id: 1, diff --git a/packages/ra-ui-materialui/src/layout/Menu.stories.tsx b/packages/ra-ui-materialui/src/layout/Menu.stories.tsx index cea7e07c307..fe8d9b5921c 100644 --- a/packages/ra-ui-materialui/src/layout/Menu.stories.tsx +++ b/packages/ra-ui-materialui/src/layout/Menu.stories.tsx @@ -40,7 +40,7 @@ export const Default = () => { }; export const Dense = () => { - const MenuDense = props => ; + const MenuDense = () => ; const LayoutDense = props => ; return ( diff --git a/packages/ra-ui-materialui/src/layout/ResourceMenuItem.spec.tsx b/packages/ra-ui-materialui/src/layout/ResourceMenuItem.spec.tsx index 2ba03566927..ad835d5b117 100644 --- a/packages/ra-ui-materialui/src/layout/ResourceMenuItem.spec.tsx +++ b/packages/ra-ui-materialui/src/layout/ResourceMenuItem.spec.tsx @@ -47,9 +47,7 @@ describe('ResourceMenuItem', () => { > - {permissions => ( - - )} + {() => } ); diff --git a/packages/ra-ui-materialui/src/list/SingleFieldList.tsx b/packages/ra-ui-materialui/src/list/SingleFieldList.tsx index b4cfde2bd84..5e1feb29e98 100644 --- a/packages/ra-ui-materialui/src/list/SingleFieldList.tsx +++ b/packages/ra-ui-materialui/src/list/SingleFieldList.tsx @@ -159,14 +159,14 @@ export const SingleFieldListClasses = { const Root = styled('div', { name: PREFIX, overridesResolver: (props, styles) => styles.root, -})(({ theme }) => ({ +})({ display: 'flex', flexWrap: 'wrap', [`& .${SingleFieldListClasses.link}`]: { textDecoration: 'none', }, -})); +}); // useful to prevent click bubbling in a datagrid with rowClick const stopPropagation = e => e.stopPropagation(); diff --git a/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.spec.tsx b/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.spec.tsx index b7d1eee1f02..0c4c1b75ebe 100644 --- a/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.spec.tsx +++ b/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.spec.tsx @@ -7,7 +7,10 @@ import { DatagridHeaderCell } from './DatagridHeaderCell'; describe('', () => { it('should accept a React element as Field label', () => { const Label = () => <>Label; - const Field = ({ source, label }) =>
; + const Field = (_props: { + source?: string; + label?: React.ReactNode; + }) =>
; const { getByText } = render( @@ -26,7 +29,7 @@ describe('', () => { }); describe('sorting on a column', () => { - const Field = (props: { + const Field = (_props: { source?: string; sortBy?: string; sortByOrder?: string; @@ -170,7 +173,7 @@ describe('', () => {
); - expect(container.querySelector('td').className).toContain('blue'); + expect(container.querySelector('td')?.className).toContain('blue'); }); }); }); diff --git a/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.tsx b/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.tsx index cc16962d7cb..7c98b12d773 100644 --- a/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.tsx +++ b/packages/ra-ui-materialui/src/list/datagrid/DatagridHeaderCell.tsx @@ -110,11 +110,11 @@ export const DatagridHeaderCellClasses = { const StyledTableCell = styled(TableCell, { name: PREFIX, overridesResolver: (props, styles) => styles.root, -})(({ theme }) => ({ +})({ [`& .MuiTableSortLabel-icon`]: { display: 'none', }, [`& .Mui-active .MuiTableSortLabel-icon`]: { display: 'inline', }, -})); +}); diff --git a/packages/ra-ui-materialui/src/list/datagrid/SelectColumnsButton.tsx b/packages/ra-ui-materialui/src/list/datagrid/SelectColumnsButton.tsx index 5dbfcc1aa83..ba26bc46d7b 100644 --- a/packages/ra-ui-materialui/src/list/datagrid/SelectColumnsButton.tsx +++ b/packages/ra-ui-materialui/src/list/datagrid/SelectColumnsButton.tsx @@ -191,11 +191,13 @@ const StyledButton = styled(Button, { }, }); +/* eslint-disable @typescript-eslint/no-unused-vars */ const sanitizeRestProps = ({ resource = null, preferenceKey = null, ...rest }) => rest; +/* eslint-enable @typescript-eslint/no-unused-vars */ export interface SelectColumnsButtonProps extends React.HtmlHTMLAttributes { diff --git a/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx b/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx index 3d6552970c3..adf059f46d5 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterButton.tsx @@ -221,12 +221,14 @@ export const FilterButton = (props: FilterButtonProps): JSX.Element => { ); }; +/* eslint-disable @typescript-eslint/no-unused-vars */ const sanitizeRestProps = ({ displayedFilters = null, filterValues = null, showFilter = null, ...rest }) => rest; +/* eslint-enable @typescript-eslint/no-unused-vars */ FilterButton.propTypes = { resource: PropTypes.string, @@ -252,6 +254,6 @@ const PREFIX = 'RaFilterButton'; const Root = styled('div', { name: PREFIX, overridesResolver: (props, styles) => styles.root, -})(({ theme }) => ({ +})({ display: 'inline-block', -})); +}); diff --git a/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx b/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx index 47bca53b2ec..5169bcc9bcb 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterForm.tsx @@ -55,7 +55,7 @@ export const FilterForm = (props: FilterFormProps) => { }, [filterValues, form]); useEffect(() => { - const subscription = form.watch(async (values, { name, type }) => { + const subscription = form.watch(async (values, { name }) => { // We must check whether the form is valid as watch will not check that for us. // We can't rely on form state as it might not be synchronized yet const isFormValid = await form.trigger(); diff --git a/packages/ra-ui-materialui/src/list/filter/FilterListItem.spec.tsx b/packages/ra-ui-materialui/src/list/filter/FilterListItem.spec.tsx index 632008eb3e1..fad60015b0f 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterListItem.spec.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterListItem.spec.tsx @@ -12,22 +12,22 @@ const defaultListContext: ListControllerResult = { filterValues: null, hasNextPage: false, hasPreviousPage: false, - hideFilter: (filterName: string) => {}, + hideFilter: () => {}, isFetching: false, isLoading: false, - onSelect: (ids: any[]) => {}, - onToggleItem: (id: any) => {}, + onSelect: () => {}, + onToggleItem: () => {}, onUnselectItems: () => {}, page: 1, perPage: 10, refetch: () => {}, resource: 'posts', selectedIds: [], - setFilters: (filters: any) => {}, - setPage: (page: number) => {}, - setPerPage: (perPage: number) => {}, - setSort: (sort: any) => {}, - showFilter: (filterName: string) => {}, + setFilters: () => {}, + setPage: () => {}, + setPerPage: () => {}, + setSort: () => {}, + showFilter: () => {}, sort: { field: '', order: 'ASC' }, total: 0, }; diff --git a/packages/ra-ui-materialui/src/list/filter/FilterListItem.tsx b/packages/ra-ui-materialui/src/list/filter/FilterListItem.tsx index f5e9f6ff7bc..3804b24cbd3 100644 --- a/packages/ra-ui-materialui/src/list/filter/FilterListItem.tsx +++ b/packages/ra-ui-materialui/src/list/filter/FilterListItem.tsx @@ -232,7 +232,7 @@ export const FilterListItemClasses = { const StyledListItem = styled(ListItem, { name: PREFIX, overridesResolver: (props, styles) => styles.root, -})(({ theme }) => ({ +})({ [`& .${FilterListItemClasses.listItemButton}`]: { paddingRight: '2em', paddingLeft: '2em', @@ -240,7 +240,7 @@ const StyledListItem = styled(ListItem, { [`& .${FilterListItemClasses.listItemText}`]: { margin: 0, }, -})); +}); export interface FilterListItemProps extends Omit { label: string | ReactElement; diff --git a/packages/ra-ui-materialui/src/list/pagination/PaginationActions.tsx b/packages/ra-ui-materialui/src/list/pagination/PaginationActions.tsx index c6f8d01df93..851c5f4048b 100644 --- a/packages/ra-ui-materialui/src/list/pagination/PaginationActions.tsx +++ b/packages/ra-ui-materialui/src/list/pagination/PaginationActions.tsx @@ -84,7 +84,7 @@ const PREFIX = 'RaPaginationActions'; const Root = styled('div', { name: PREFIX, overridesResolver: (props, styles) => styles.root, -})(({ theme }) => ({ +})(() => ({ flexShrink: 0, ml: 4, })); diff --git a/packages/ra-ui-materialui/src/preferences/Configurable.stories.tsx b/packages/ra-ui-materialui/src/preferences/Configurable.stories.tsx index 1be6f6d2f31..7b9e82ad301 100644 --- a/packages/ra-ui-materialui/src/preferences/Configurable.stories.tsx +++ b/packages/ra-ui-materialui/src/preferences/Configurable.stories.tsx @@ -115,7 +115,7 @@ const SalesBlockEditor = () => { setShowDate(v => !v)} + onChange={() => setShowDate(v => !v)} id="showDate" /> diff --git a/packages/ra-ui-materialui/src/preferences/Configurable.tsx b/packages/ra-ui-materialui/src/preferences/Configurable.tsx index a4f6df61ee6..ed4d4a2c5b3 100644 --- a/packages/ra-ui-materialui/src/preferences/Configurable.tsx +++ b/packages/ra-ui-materialui/src/preferences/Configurable.tsx @@ -88,7 +88,7 @@ export const Configurable = (props: ConfigurableProps) => { setPreferenceKey(prefixedPreferenceKey); }; - const handleShowButton = event => { + const handleShowButton = () => { setIsCustomizeButtonVisible(true); };