pr-11515
thorn0 opened this issue · comments
run #11515
prettier/prettier#11515 VS prettier/prettier@main
- babel/babel@c25ec3e
- vuejs/eslint-plugin-vue@5fe2445
- excalidraw/excalidraw@5da3207
- prettier/prettier@104c9fd
- marmelab/react-admin@52cbce7
- typescript-eslint/typescript-eslint@8218055
- vega/vega-lite@b6458aa
Diff (935 lines)
diff --git ORI/excalidraw/src/components/Card.tsx ALT/excalidraw/src/components/Card.tsx
index c531523..f94dc7b 100644
--- ORI/excalidraw/src/components/Card.tsx
+++ ALT/excalidraw/src/components/Card.tsx
@@ -2,9 +2,11 @@ import OpenColor from "open-color";
import "./Card.scss";
-export const Card: React.FC<{
- color: keyof OpenColor;
-}> = ({ children, color }) => {
+export const Card: React.FC<
+ {
+ color: keyof OpenColor;
+ }
+> = ({ children, color }) => {
return (
<div
className="Card"
diff --git ORI/excalidraw/src/components/CheckboxItem.tsx ALT/excalidraw/src/components/CheckboxItem.tsx
index 41c28b8..9903186 100644
--- ORI/excalidraw/src/components/CheckboxItem.tsx
+++ ALT/excalidraw/src/components/CheckboxItem.tsx
@@ -4,10 +4,12 @@ import { checkIcon } from "./icons";
import "./CheckboxItem.scss";
-export const CheckboxItem: React.FC<{
- checked: boolean;
- onChange: (checked: boolean) => void;
-}> = ({ children, checked, onChange }) => {
+export const CheckboxItem: React.FC<
+ {
+ checked: boolean;
+ onChange: (checked: boolean) => void;
+ }
+> = ({ children, checked, onChange }) => {
return (
<div
className={clsx("Checkbox", { "is-checked": checked })}
diff --git ORI/excalidraw/src/components/ImageExportDialog.tsx ALT/excalidraw/src/components/ImageExportDialog.tsx
index e02b43d..d30b34c 100644
--- ORI/excalidraw/src/components/ImageExportDialog.tsx
+++ ALT/excalidraw/src/components/ImageExportDialog.tsx
@@ -53,12 +53,14 @@ export type ExportCB = (
scale?: number,
) => void;
-const ExportButton: React.FC<{
- color: keyof OpenColor;
- onClick: () => void;
- title: string;
- shade?: number;
-}> = ({ children, title, onClick, color, shade = 6 }) => {
+const ExportButton: React.FC<
+ {
+ color: keyof OpenColor;
+ onClick: () => void;
+ title: string;
+ shade?: number;
+ }
+> = ({ children, title, onClick, color, shade = 6 }) => {
return (
<button
className="ExportDialog-imageExportButton"
diff --git ORI/excalidraw/src/components/LibraryButton.tsx ALT/excalidraw/src/components/LibraryButton.tsx
index 7fca4e9..dcc2caa 100644
--- ORI/excalidraw/src/components/LibraryButton.tsx
+++ ALT/excalidraw/src/components/LibraryButton.tsx
@@ -13,10 +13,12 @@ const LIBRARY_ICON = (
</svg>
);
-export const LibraryButton: React.FC<{
- appState: AppState;
- setAppState: React.Component<any, AppState>["setState"];
-}> = ({ appState, setAppState }) => {
+export const LibraryButton: React.FC<
+ {
+ appState: AppState;
+ setAppState: React.Component<any, AppState>["setState"];
+ }
+> = ({ appState, setAppState }) => {
return (
<label
className={clsx(
diff --git ORI/excalidraw/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx ALT/excalidraw/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx
index 36c7e79..eb34d18 100644
--- ORI/excalidraw/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx
+++ ALT/excalidraw/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx
@@ -60,11 +60,13 @@ const exportToExcalidrawPlus = async (
window.open(`https://plus.excalidraw.com/import?excalidraw=${id},${key}`);
};
-export const ExportToExcalidrawPlus: React.FC<{
- elements: readonly NonDeletedExcalidrawElement[];
- appState: AppState;
- onError: (error: Error) => void;
-}> = ({ elements, appState, onError }) => {
+export const ExportToExcalidrawPlus: React.FC<
+ {
+ elements: readonly NonDeletedExcalidrawElement[];
+ appState: AppState;
+ onError: (error: Error) => void;
+ }
+> = ({ elements, appState, onError }) => {
return (
<Card color="indigo">
<div className="Card-icon">{excalidrawPlusIcon}</div>
diff --git ORI/react-admin/examples/demo/src/themeReducer.ts ALT/react-admin/examples/demo/src/themeReducer.ts
index 6259ac6..4510afa 100644
--- ORI/react-admin/examples/demo/src/themeReducer.ts
+++ ALT/react-admin/examples/demo/src/themeReducer.ts
@@ -7,10 +7,10 @@ type Action =
| ReturnType<typeof changeTheme>
| { type: 'OTHER_ACTION'; payload?: any };
-const themeReducer: Reducer<State, Action> = (
- previousState = 'light',
- action
-) => {
+const themeReducer: Reducer<
+ State,
+ Action
+> = (previousState = 'light', action) => {
if (action.type === CHANGE_THEME) {
return action.payload;
}
diff --git ORI/react-admin/packages/ra-core/src/dataProvider/Query.tsx ALT/react-admin/packages/ra-core/src/dataProvider/Query.tsx
index 51716b8..944c168 100644
--- ORI/react-admin/packages/ra-core/src/dataProvider/Query.tsx
+++ ALT/react-admin/packages/ra-core/src/dataProvider/Query.tsx
@@ -66,7 +66,9 @@ interface Props {
* </Query>
* );
*/
-const Query: FunctionComponent<Props> = ({
+const Query: FunctionComponent<
+ Props
+> = ({
children,
type,
resource,
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts ALT/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts
index ee6db94..0026ecf 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts
@@ -5,10 +5,9 @@ export interface State {
}
// reducer for queries called via useQueryWithStore and without a custom action name
-const customQueriesReducer: Reducer<State> = (
- previousState = {},
- { type, requestPayload, payload, meta }
-) => {
+const customQueriesReducer: Reducer<
+ State
+> = (previousState = {}, { type, requestPayload, payload, meta }) => {
if (type !== 'CUSTOM_QUERY_SUCCESS') {
return previousState;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/notifications.ts ALT/react-admin/packages/ra-core/src/reducer/admin/notifications.ts
index d61a007..f282180 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/notifications.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/notifications.ts
@@ -21,10 +21,9 @@ type State = NotificationPayload[];
const initialState = [];
-const notificationsReducer: Reducer<State> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const notificationsReducer: Reducer<
+ State
+> = (previousState = initialState, action: ActionTypes) => {
switch (action.type) {
case SHOW_NOTIFICATION:
return previousState.concat(action.payload);
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts ALT/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts
index 5fa5879..32f379e 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts
@@ -18,10 +18,9 @@ type ActionTypes =
| CrudDeleteSuccessAction
| { type: 'OTHER_ACTION'; payload: any; meta?: any };
-const oneToManyReducer: Reducer<OneToManyState> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const oneToManyReducer: Reducer<
+ OneToManyState
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.optimistic) {
const relatedTo = getRelatedReferences(
previousState,
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts ALT/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts
index ab7d020..3f6f4b5 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts
@@ -18,10 +18,9 @@ type ActionTypes =
| CrudGetMatchingFailureAction
| { type: 'OTHER_ACTION' };
-const possibleValuesreducer: Reducer<PossibleValuesState> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const possibleValuesreducer: Reducer<
+ PossibleValuesState
+> = (previousState = initialState, action: ActionTypes) => {
switch (action.type) {
case CRUD_GET_MATCHING_SUCCESS:
return {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts
index 08b8930..1576b92 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts
@@ -156,10 +156,9 @@ export const removeRecords = (
const initialState = hideFetchedAt({ fetchedAt: {} });
-const dataReducer: Reducer<RecordSetWithDate> = (
- previousState = initialState,
- { payload, meta }
-) => {
+const dataReducer: Reducer<
+ RecordSetWithDate
+> = (previousState = initialState, { payload, meta }) => {
if (meta && meta.optimistic) {
if (meta.fetch === UPDATE) {
const updatedRecord = {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts
index 151d64b..13fb922 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts
@@ -27,10 +27,9 @@ interface State {
const initialState = {};
const initialSubstate = { ids: [], total: null, validity: null };
-const cachedRequestsReducer: Reducer<State> = (
- previousState = initialState,
- action
-) => {
+const cachedRequestsReducer: Reducer<
+ State
+> = (previousState = initialState, action) => {
if (action.type === REFRESH_VIEW) {
if (action.payload?.hard) {
// force refresh
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts
index e5be1a7..b3d6d9e 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts
@@ -17,10 +17,9 @@ type ActionTypes =
const initialState = [];
-const idsReducer: Reducer<State> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const idsReducer: Reducer<
+ State
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.fetchResponse === GET_LIST) {
return action.payload.data.map(({ id }) => id);
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts
index cfa1edb..f4915cb 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts
@@ -15,10 +15,9 @@ type State = number;
const initialState = null;
-const totalReducer: Reducer<State> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const totalReducer: Reducer<
+ State
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.fetchResponse === GET_LIST) {
return action.payload.total;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts
index db58330..87c0f23 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts
@@ -5,10 +5,9 @@ type State = Date;
const initialState = null;
-const validityReducer: Reducer<State> = (
- previousState = initialState,
- { payload, meta }
-) => {
+const validityReducer: Reducer<
+ State
+> = (previousState = initialState, { payload, meta }) => {
switch (meta.fetchResponse) {
case GET_LIST: {
if (payload.validUntil) {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts
index 3000184..0b88a23 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts
@@ -15,10 +15,9 @@ type ActionTypes =
};
const initialState = [];
-const expanded: Reducer<IdentifierArray> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const expanded: Reducer<
+ IdentifierArray
+> = (previousState = initialState, action: ActionTypes) => {
if (action.type === TOGGLE_LIST_ITEM_EXPAND) {
const index = previousState
.map(el => el == action.payload) // eslint-disable-line eqeqeq
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts
index 83927cd..dd03927 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts
@@ -36,10 +36,9 @@ const initialState = [];
* @see useListController
*
*/
-const idsReducer: Reducer<IdentifierArray> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const idsReducer: Reducer<
+ IdentifierArray
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.optimistic) {
if (action.meta.fetch === DELETE) {
const index = previousState
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts
index 8f2e6e9..289f6df 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts
@@ -24,10 +24,9 @@ type ActionTypes =
| ChangeListParamsAction
| { type: 'OTHER_ACTION'; payload: any };
-const paramsReducer: Reducer<ParamsState> = (
- previousState = defaultState,
- action: ActionTypes
-) => {
+const paramsReducer: Reducer<
+ ParamsState
+> = (previousState = defaultState, action: ActionTypes) => {
switch (action.type) {
case CRUD_CHANGE_LIST_PARAMS:
return action.payload;
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts
index 9892d00..91b4664 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts
@@ -51,10 +51,9 @@ type ActionTypes =
/**
* This reducer is for the react-router query string, NOT for redux.
*/
-const queryReducer: Reducer<ListParams> = (
- previousState,
- action: ActionTypes
-) => {
+const queryReducer: Reducer<
+ ListParams
+> = (previousState, action: ActionTypes) => {
switch (action.type) {
case SET_SORT:
if (action.payload.sort === previousState.sort) {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts
index ddcfa02..2d25f97 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts
@@ -29,10 +29,9 @@ type ActionTypes =
payload: any;
};
-const selectedIdsReducer: Reducer<State> = (
- previousState: State = initialState,
- action: ActionTypes
-) => {
+const selectedIdsReducer: Reducer<
+ State
+> = (previousState: State = initialState, action: ActionTypes) => {
if (action.type === SET_LIST_SELECTED_IDS) {
return action.payload;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts
index 1d43900..895d7ab 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts
@@ -15,10 +15,9 @@ type ActionTypes =
type State = number;
-const totalReducer: Reducer<State> = (
- previousState = null,
- action: ActionTypes
-) => {
+const totalReducer: Reducer<
+ State
+> = (previousState = null, action: ActionTypes) => {
if (action.type === CRUD_GET_LIST_SUCCESS) {
return action.payload.total;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts
index 2cb3b24..bc1a650 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts
@@ -8,10 +8,9 @@ interface ValidityRegistry {
const initialState = {};
-const validityReducer: Reducer<ValidityRegistry> = (
- previousState = initialState,
- { type, payload, requestPayload, meta }
-) => {
+const validityReducer: Reducer<
+ ValidityRegistry
+> = (previousState = initialState, { type, payload, requestPayload, meta }) => {
if (type === REFRESH_VIEW) {
return initialState;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts
index b655996..f0571c1 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts
@@ -21,10 +21,9 @@ interface ValidityRegistry {
const initialState = {};
-const validityReducer: Reducer<ValidityRegistry> = (
- previousState = initialState,
- { type, payload, requestPayload, meta }
-) => {
+const validityReducer: Reducer<
+ ValidityRegistry
+> = (previousState = initialState, { type, payload, requestPayload, meta }) => {
if (type === REFRESH_VIEW) {
return initialState;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/ui.ts ALT/react-admin/packages/ra-core/src/reducer/admin/ui.ts
index 420dcee..9328bff 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/ui.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/ui.ts
@@ -49,10 +49,9 @@ const defaultState: UIState = {
viewVersion: 0,
};
-const uiReducer: Reducer<UIState> = (
- previousState = defaultState,
- action: ActionTypes
-) => {
+const uiReducer: Reducer<
+ UIState
+> = (previousState = defaultState, action: ActionTypes) => {
switch (action.type) {
case TOGGLE_SIDEBAR:
return {
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index 7024be9..ff82848 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,36 +176,31 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
- props => {
- const {
- children,
- pagination,
- className,
- resource,
- reference,
- ...rest
- } = props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
- };
+export const ReferenceArrayFieldView: FC<
+ ReferenceArrayFieldViewProps
+> = props => {
+ const { children, pagination, className, resource, reference, ...rest } =
+ props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+};
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 65ba764..523738a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,22 +156,23 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
- props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
- };
+export const ReferenceManyFieldView: FC<
+ ReferenceManyFieldViewProps
+> = props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+};
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/SelectField.spec.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/SelectField.spec.tsx
index 08980d9..e36876a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/SelectField.spec.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/SelectField.spec.tsx
@@ -126,9 +126,9 @@ describe('<SelectField />', () => {
});
it('should use optionText with an element value as text identifier', () => {
- const Foobar: FC<{ record?: Record }> = ({ record }) => (
- <span>{record.foobar}</span>
- );
+ const Foobar: FC<
+ { record?: Record }
+ > = ({ record }) => <span>{record.foobar}</span>;
const { queryAllByText } = render(
<SelectField
{...defaultProps}
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx
index 5fd1677..ac8a46e 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx
@@ -56,7 +56,9 @@ import { LinearProgress } from '../layout';
*
* @see https://github.com/final-form/react-final-form-arrays
*/
-const ArrayInput: FC<ArrayInputProps> = ({
+const ArrayInput: FC<
+ ArrayInputProps
+> = ({
className,
defaultValue,
label,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 41e43b2..885329b 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,142 +80,139 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
- props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<
+ CheckboxGroupInputProps
+> = props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const {
- id,
- input: {
- onChange: finalFormOnChange,
- onBlur: finalFormOnBlur,
- value,
- },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ const {
+ id,
+ input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
+
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
+ if (loading) {
+ return (
+ <Labeled
+ label={label}
+ source={source}
+ resource={resource}
+ className={className}
+ isRequired={isRequired}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
);
+ }
- if (loading) {
- return (
- <Labeled
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
label={label}
source={source}
resource={resource}
- className={className}
isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
- );
- }
-
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
- label={label}
- source={source}
- resource={resource}
- isRequired={isRequired}
+ />
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
/>
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
- />
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
- };
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+};
const sanitizeRestProps = ({
refetch,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx
index a1e5af3..cae974d 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx
@@ -25,7 +25,9 @@ const convertStringToNumber = value => {
*
* The object passed as `options` props is passed to the material-ui <TextField> component
*/
-const NumberInput: FunctionComponent<NumberInputProps> = ({
+const NumberInput: FunctionComponent<
+ NumberInputProps
+> = ({
format,
helperText,
label,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx ALT/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx
index 27f33ba..7c44c0a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx
@@ -11,13 +11,9 @@ export interface TitleProps {
title?: string | ReactElement;
}
-const Title: FC<TitleProps> = ({
- className,
- defaultTitle,
- record,
- title,
- ...rest
-}) => {
+const Title: FC<
+ TitleProps
+> = ({ className, defaultTitle, record, title, ...rest }) => {
const translate = useTranslate();
const container =
typeof document !== 'undefined'
diff --git ORI/react-admin/packages/react-admin/src/AdminContext.tsx ALT/react-admin/packages/react-admin/src/AdminContext.tsx
index 0886d44..c27dc35 100644
--- ORI/react-admin/packages/react-admin/src/AdminContext.tsx
+++ ALT/react-admin/packages/react-admin/src/AdminContext.tsx
@@ -4,9 +4,9 @@ import { CoreAdminContext, AdminContextProps } from 'ra-core';
import defaultI18nProvider from './defaultI18nProvider';
-const AdminContext: FC<AdminContextProps> = props => (
- <CoreAdminContext {...props} />
-);
+const AdminContext: FC<
+ AdminContextProps
+> = props => <CoreAdminContext {...props} />;
AdminContext.defaultProps = {
i18nProvider: defaultI18nProvider,
run #11515
prettier/prettier#11515 VS prettier/prettier@main
- babel/babel@c25ec3e
- vuejs/eslint-plugin-vue@5fe2445
- excalidraw/excalidraw@5da3207
- prettier/prettier@104c9fd
- marmelab/react-admin@52cbce7
- typescript-eslint/typescript-eslint@8218055
- vega/vega-lite@b6458aa
Diff (810 lines)
diff --git ORI/react-admin/examples/demo/src/themeReducer.ts ALT/react-admin/examples/demo/src/themeReducer.ts
index 6259ac6..4510afa 100644
--- ORI/react-admin/examples/demo/src/themeReducer.ts
+++ ALT/react-admin/examples/demo/src/themeReducer.ts
@@ -7,10 +7,10 @@ type Action =
| ReturnType<typeof changeTheme>
| { type: 'OTHER_ACTION'; payload?: any };
-const themeReducer: Reducer<State, Action> = (
- previousState = 'light',
- action
-) => {
+const themeReducer: Reducer<
+ State,
+ Action
+> = (previousState = 'light', action) => {
if (action.type === CHANGE_THEME) {
return action.payload;
}
diff --git ORI/react-admin/packages/ra-core/src/dataProvider/Query.tsx ALT/react-admin/packages/ra-core/src/dataProvider/Query.tsx
index 51716b8..944c168 100644
--- ORI/react-admin/packages/ra-core/src/dataProvider/Query.tsx
+++ ALT/react-admin/packages/ra-core/src/dataProvider/Query.tsx
@@ -66,7 +66,9 @@ interface Props {
* </Query>
* );
*/
-const Query: FunctionComponent<Props> = ({
+const Query: FunctionComponent<
+ Props
+> = ({
children,
type,
resource,
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts ALT/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts
index ee6db94..0026ecf 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/customQueries.ts
@@ -5,10 +5,9 @@ export interface State {
}
// reducer for queries called via useQueryWithStore and without a custom action name
-const customQueriesReducer: Reducer<State> = (
- previousState = {},
- { type, requestPayload, payload, meta }
-) => {
+const customQueriesReducer: Reducer<
+ State
+> = (previousState = {}, { type, requestPayload, payload, meta }) => {
if (type !== 'CUSTOM_QUERY_SUCCESS') {
return previousState;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/notifications.ts ALT/react-admin/packages/ra-core/src/reducer/admin/notifications.ts
index d61a007..f282180 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/notifications.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/notifications.ts
@@ -21,10 +21,9 @@ type State = NotificationPayload[];
const initialState = [];
-const notificationsReducer: Reducer<State> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const notificationsReducer: Reducer<
+ State
+> = (previousState = initialState, action: ActionTypes) => {
switch (action.type) {
case SHOW_NOTIFICATION:
return previousState.concat(action.payload);
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts ALT/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts
index 5fa5879..32f379e 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/references/oneToMany.ts
@@ -18,10 +18,9 @@ type ActionTypes =
| CrudDeleteSuccessAction
| { type: 'OTHER_ACTION'; payload: any; meta?: any };
-const oneToManyReducer: Reducer<OneToManyState> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const oneToManyReducer: Reducer<
+ OneToManyState
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.optimistic) {
const relatedTo = getRelatedReferences(
previousState,
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts ALT/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts
index ab7d020..3f6f4b5 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/references/possibleValues.ts
@@ -18,10 +18,9 @@ type ActionTypes =
| CrudGetMatchingFailureAction
| { type: 'OTHER_ACTION' };
-const possibleValuesreducer: Reducer<PossibleValuesState> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const possibleValuesreducer: Reducer<
+ PossibleValuesState
+> = (previousState = initialState, action: ActionTypes) => {
switch (action.type) {
case CRUD_GET_MATCHING_SUCCESS:
return {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts
index 08b8930..1576b92 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/data.ts
@@ -156,10 +156,9 @@ export const removeRecords = (
const initialState = hideFetchedAt({ fetchedAt: {} });
-const dataReducer: Reducer<RecordSetWithDate> = (
- previousState = initialState,
- { payload, meta }
-) => {
+const dataReducer: Reducer<
+ RecordSetWithDate
+> = (previousState = initialState, { payload, meta }) => {
if (meta && meta.optimistic) {
if (meta.fetch === UPDATE) {
const updatedRecord = {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts
index 151d64b..13fb922 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests.ts
@@ -27,10 +27,9 @@ interface State {
const initialState = {};
const initialSubstate = { ids: [], total: null, validity: null };
-const cachedRequestsReducer: Reducer<State> = (
- previousState = initialState,
- action
-) => {
+const cachedRequestsReducer: Reducer<
+ State
+> = (previousState = initialState, action) => {
if (action.type === REFRESH_VIEW) {
if (action.payload?.hard) {
// force refresh
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts
index e5be1a7..b3d6d9e 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/ids.ts
@@ -17,10 +17,9 @@ type ActionTypes =
const initialState = [];
-const idsReducer: Reducer<State> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const idsReducer: Reducer<
+ State
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.fetchResponse === GET_LIST) {
return action.payload.data.map(({ id }) => id);
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts
index cfa1edb..f4915cb 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/total.ts
@@ -15,10 +15,9 @@ type State = number;
const initialState = null;
-const totalReducer: Reducer<State> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const totalReducer: Reducer<
+ State
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.fetchResponse === GET_LIST) {
return action.payload.total;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts
index db58330..87c0f23 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/cachedRequests/validity.ts
@@ -5,10 +5,9 @@ type State = Date;
const initialState = null;
-const validityReducer: Reducer<State> = (
- previousState = initialState,
- { payload, meta }
-) => {
+const validityReducer: Reducer<
+ State
+> = (previousState = initialState, { payload, meta }) => {
switch (meta.fetchResponse) {
case GET_LIST: {
if (payload.validUntil) {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts
index 3000184..0b88a23 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/expanded.ts
@@ -15,10 +15,9 @@ type ActionTypes =
};
const initialState = [];
-const expanded: Reducer<IdentifierArray> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const expanded: Reducer<
+ IdentifierArray
+> = (previousState = initialState, action: ActionTypes) => {
if (action.type === TOGGLE_LIST_ITEM_EXPAND) {
const index = previousState
.map(el => el == action.payload) // eslint-disable-line eqeqeq
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts
index 83927cd..dd03927 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/ids.ts
@@ -36,10 +36,9 @@ const initialState = [];
* @see useListController
*
*/
-const idsReducer: Reducer<IdentifierArray> = (
- previousState = initialState,
- action: ActionTypes
-) => {
+const idsReducer: Reducer<
+ IdentifierArray
+> = (previousState = initialState, action: ActionTypes) => {
if (action.meta && action.meta.optimistic) {
if (action.meta.fetch === DELETE) {
const index = previousState
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts
index 8f2e6e9..289f6df 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/params.ts
@@ -24,10 +24,9 @@ type ActionTypes =
| ChangeListParamsAction
| { type: 'OTHER_ACTION'; payload: any };
-const paramsReducer: Reducer<ParamsState> = (
- previousState = defaultState,
- action: ActionTypes
-) => {
+const paramsReducer: Reducer<
+ ParamsState
+> = (previousState = defaultState, action: ActionTypes) => {
switch (action.type) {
case CRUD_CHANGE_LIST_PARAMS:
return action.payload;
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts
index 9892d00..91b4664 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/queryReducer.ts
@@ -51,10 +51,9 @@ type ActionTypes =
/**
* This reducer is for the react-router query string, NOT for redux.
*/
-const queryReducer: Reducer<ListParams> = (
- previousState,
- action: ActionTypes
-) => {
+const queryReducer: Reducer<
+ ListParams
+> = (previousState, action: ActionTypes) => {
switch (action.type) {
case SET_SORT:
if (action.payload.sort === previousState.sort) {
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts
index ddcfa02..2d25f97 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/selectedIds.ts
@@ -29,10 +29,9 @@ type ActionTypes =
payload: any;
};
-const selectedIdsReducer: Reducer<State> = (
- previousState: State = initialState,
- action: ActionTypes
-) => {
+const selectedIdsReducer: Reducer<
+ State
+> = (previousState: State = initialState, action: ActionTypes) => {
if (action.type === SET_LIST_SELECTED_IDS) {
return action.payload;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts
index 1d43900..895d7ab 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/total.ts
@@ -15,10 +15,9 @@ type ActionTypes =
type State = number;
-const totalReducer: Reducer<State> = (
- previousState = null,
- action: ActionTypes
-) => {
+const totalReducer: Reducer<
+ State
+> = (previousState = null, action: ActionTypes) => {
if (action.type === CRUD_GET_LIST_SUCCESS) {
return action.payload.total;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts
index 2cb3b24..bc1a650 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/list/validity.ts
@@ -8,10 +8,9 @@ interface ValidityRegistry {
const initialState = {};
-const validityReducer: Reducer<ValidityRegistry> = (
- previousState = initialState,
- { type, payload, requestPayload, meta }
-) => {
+const validityReducer: Reducer<
+ ValidityRegistry
+> = (previousState = initialState, { type, payload, requestPayload, meta }) => {
if (type === REFRESH_VIEW) {
return initialState;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts ALT/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts
index b655996..f0571c1 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/resource/validity.ts
@@ -21,10 +21,9 @@ interface ValidityRegistry {
const initialState = {};
-const validityReducer: Reducer<ValidityRegistry> = (
- previousState = initialState,
- { type, payload, requestPayload, meta }
-) => {
+const validityReducer: Reducer<
+ ValidityRegistry
+> = (previousState = initialState, { type, payload, requestPayload, meta }) => {
if (type === REFRESH_VIEW) {
return initialState;
}
diff --git ORI/react-admin/packages/ra-core/src/reducer/admin/ui.ts ALT/react-admin/packages/ra-core/src/reducer/admin/ui.ts
index 420dcee..9328bff 100644
--- ORI/react-admin/packages/ra-core/src/reducer/admin/ui.ts
+++ ALT/react-admin/packages/ra-core/src/reducer/admin/ui.ts
@@ -49,10 +49,9 @@ const defaultState: UIState = {
viewVersion: 0,
};
-const uiReducer: Reducer<UIState> = (
- previousState = defaultState,
- action: ActionTypes
-) => {
+const uiReducer: Reducer<
+ UIState
+> = (previousState = defaultState, action: ActionTypes) => {
switch (action.type) {
case TOGGLE_SIDEBAR:
return {
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index 7024be9..ff82848 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,36 +176,31 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
- props => {
- const {
- children,
- pagination,
- className,
- resource,
- reference,
- ...rest
- } = props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
- };
+export const ReferenceArrayFieldView: FC<
+ ReferenceArrayFieldViewProps
+> = props => {
+ const { children, pagination, className, resource, reference, ...rest } =
+ props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+};
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 65ba764..523738a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,22 +156,23 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
- props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
- };
+export const ReferenceManyFieldView: FC<
+ ReferenceManyFieldViewProps
+> = props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+};
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx
index 5fd1677..ac8a46e 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput.tsx
@@ -56,7 +56,9 @@ import { LinearProgress } from '../layout';
*
* @see https://github.com/final-form/react-final-form-arrays
*/
-const ArrayInput: FC<ArrayInputProps> = ({
+const ArrayInput: FC<
+ ArrayInputProps
+> = ({
className,
defaultValue,
label,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 41e43b2..885329b 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,142 +80,139 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
- props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<
+ CheckboxGroupInputProps
+> = props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const {
- id,
- input: {
- onChange: finalFormOnChange,
- onBlur: finalFormOnBlur,
- value,
- },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ const {
+ id,
+ input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
+
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
+ if (loading) {
+ return (
+ <Labeled
+ label={label}
+ source={source}
+ resource={resource}
+ className={className}
+ isRequired={isRequired}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
);
+ }
- if (loading) {
- return (
- <Labeled
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
label={label}
source={source}
resource={resource}
- className={className}
isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
- );
- }
-
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
- label={label}
- source={source}
- resource={resource}
- isRequired={isRequired}
+ />
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
/>
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
- />
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
- };
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+};
const sanitizeRestProps = ({
refetch,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx
index a1e5af3..cae974d 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.tsx
@@ -25,7 +25,9 @@ const convertStringToNumber = value => {
*
* The object passed as `options` props is passed to the material-ui <TextField> component
*/
-const NumberInput: FunctionComponent<NumberInputProps> = ({
+const NumberInput: FunctionComponent<
+ NumberInputProps
+> = ({
format,
helperText,
label,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx ALT/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx
index 27f33ba..7c44c0a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/layout/Title.tsx
@@ -11,13 +11,9 @@ export interface TitleProps {
title?: string | ReactElement;
}
-const Title: FC<TitleProps> = ({
- className,
- defaultTitle,
- record,
- title,
- ...rest
-}) => {
+const Title: FC<
+ TitleProps
+> = ({ className, defaultTitle, record, title, ...rest }) => {
const translate = useTranslate();
const container =
typeof document !== 'undefined'
diff --git ORI/react-admin/packages/react-admin/src/AdminContext.tsx ALT/react-admin/packages/react-admin/src/AdminContext.tsx
index 0886d44..c27dc35 100644
--- ORI/react-admin/packages/react-admin/src/AdminContext.tsx
+++ ALT/react-admin/packages/react-admin/src/AdminContext.tsx
@@ -4,9 +4,9 @@ import { CoreAdminContext, AdminContextProps } from 'ra-core';
import defaultI18nProvider from './defaultI18nProvider';
-const AdminContext: FC<AdminContextProps> = props => (
- <CoreAdminContext {...props} />
-);
+const AdminContext: FC<
+ AdminContextProps
+> = props => <CoreAdminContext {...props} />;
AdminContext.defaultProps = {
i18nProvider: defaultI18nProvider,
run #11515
prettier/prettier#11515 VS prettier/prettier@main
- babel/babel@c25ec3e
- vuejs/eslint-plugin-vue@5fe2445
- excalidraw/excalidraw@5da3207
- prettier/prettier@104c9fd
- marmelab/react-admin@52cbce7
- typescript-eslint/typescript-eslint@8218055
- vega/vega-lite@b6458aa
Diff (384 lines)
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index 7024be9..ff82848 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,36 +176,31 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
- props => {
- const {
- children,
- pagination,
- className,
- resource,
- reference,
- ...rest
- } = props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
- };
+export const ReferenceArrayFieldView: FC<
+ ReferenceArrayFieldViewProps
+> = props => {
+ const { children, pagination, className, resource, reference, ...rest } =
+ props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+};
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 65ba764..523738a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,22 +156,23 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
- props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
- };
+export const ReferenceManyFieldView: FC<
+ ReferenceManyFieldViewProps
+> = props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+};
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 41e43b2..885329b 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,142 +80,139 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
- props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<
+ CheckboxGroupInputProps
+> = props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const {
- id,
- input: {
- onChange: finalFormOnChange,
- onBlur: finalFormOnBlur,
- value,
- },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ const {
+ id,
+ input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
+
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
+ if (loading) {
+ return (
+ <Labeled
+ label={label}
+ source={source}
+ resource={resource}
+ className={className}
+ isRequired={isRequired}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
);
+ }
- if (loading) {
- return (
- <Labeled
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
label={label}
source={source}
resource={resource}
- className={className}
isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
- );
- }
-
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
- label={label}
- source={source}
- resource={resource}
- isRequired={isRequired}
+ />
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
/>
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
- />
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
- };
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+};
const sanitizeRestProps = ({
refetch,
run thorn0/prettier@alt-10848-2
run thorn0/prettier#alt-10848-2
thorn0/prettier@alt-10848-2 VS prettier/prettier@main
- babel/babel@c25ec3e
- vuejs/eslint-plugin-vue@5fe2445
- excalidraw/excalidraw@5da3207
- prettier/prettier@104c9fd
- marmelab/react-admin@52cbce7
- typescript-eslint/typescript-eslint@8218055
- vega/vega-lite@b6458aa
Diff (1105 lines)
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index 7024be9..ff82848 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,36 +176,31 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
- props => {
- const {
- children,
- pagination,
- className,
- resource,
- reference,
- ...rest
- } = props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
- };
+export const ReferenceArrayFieldView: FC<
+ ReferenceArrayFieldViewProps
+> = props => {
+ const { children, pagination, className, resource, reference, ...rest } =
+ props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+};
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 65ba764..523738a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,22 +156,23 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
- props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
- };
+export const ReferenceManyFieldView: FC<
+ ReferenceManyFieldViewProps
+> = props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+};
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 41e43b2..885329b 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,142 +80,139 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
- props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<
+ CheckboxGroupInputProps
+> = props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const {
- id,
- input: {
- onChange: finalFormOnChange,
- onBlur: finalFormOnBlur,
- value,
- },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ const {
+ id,
+ input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
+
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
+ if (loading) {
+ return (
+ <Labeled
+ label={label}
+ source={source}
+ resource={resource}
+ className={className}
+ isRequired={isRequired}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
);
+ }
- if (loading) {
- return (
- <Labeled
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
label={label}
source={source}
resource={resource}
- className={className}
isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
- );
- }
-
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
- label={label}
- source={source}
- resource={resource}
- isRequired={isRequired}
+ />
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
/>
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
- />
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
- };
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+};
const sanitizeRestProps = ({
refetch,
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts
index f8fc068..08beebb 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts
@@ -45,8 +45,8 @@ function itHasBaseRulesOverriden(
}
describe('all.json config', () => {
- const unfilteredConfigRules: Record<string, string> =
- plugin.configs.all.rules;
+ const unfilteredConfigRules: Record<string, string> = plugin.configs.all
+ .rules;
const configRules = filterRules(unfilteredConfigRules);
// note: exclude deprecated rules, this config is allowed to change between minor versions
const ruleConfigs = Object.entries(rules)
@@ -61,8 +61,8 @@ describe('all.json config', () => {
});
describe('recommended.json config', () => {
- const unfilteredConfigRules: Record<string, string> =
- plugin.configs.recommended.rules;
+ const unfilteredConfigRules: Record<string, string> = plugin.configs
+ .recommended.rules;
const configRules = filterRules(unfilteredConfigRules);
// note: include deprecated rules so that the config doesn't change between major bumps
const ruleConfigs = Object.entries(rules)
@@ -84,8 +84,9 @@ describe('recommended.json config', () => {
});
describe('recommended-requiring-type-checking.json config', () => {
- const unfilteredConfigRules: Record<string, string> =
- plugin.configs['recommended-requiring-type-checking'].rules;
+ const unfilteredConfigRules: Record<string, string> = plugin.configs[
+ 'recommended-requiring-type-checking'
+ ].rules;
const configRules = filterRules(unfilteredConfigRules);
// note: include deprecated rules so that the config doesn't change between major bumps
const ruleConfigs = Object.entries(rules)
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
index b531438..c17aa57 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
@@ -5155,12 +5155,14 @@ type Foo = {
],
};
-const sortedWithGroupingDefaultOption: TSESLint.RunTests<MessageIds, Options> =
- {
- valid: [
- // default option + interface + default order + alphabetically
- {
- code: `
+const sortedWithGroupingDefaultOption: TSESLint.RunTests<
+ MessageIds,
+ Options
+> = {
+ valid: [
+ // default option + interface + default order + alphabetically
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5177,14 +5179,14 @@ interface Foo {
c() : void;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + interface + custom order + alphabetically
- {
- code: `
+ // default option + interface + custom order + alphabetically
+ {
+ code: `
interface Foo {
new () : Bar;
@@ -5200,19 +5202,19 @@ interface Foo {
() : Baz;
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'method', 'field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'method', 'field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // default option + type literal + default order + alphabetically
- {
- code: `
+ // default option + type literal + default order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5229,14 +5231,14 @@ type Foo = {
c() : void;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + type literal + custom order + alphabetically
- {
- code: `
+ // default option + type literal + custom order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5253,19 +5255,19 @@ type Foo = {
() : Baz;
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'method', 'field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'method', 'field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // default option + class + default order + alphabetically
- {
- code: `
+ // default option + class + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5278,13 +5280,13 @@ class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
- // default option + class + decorators + default order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
+ // default option + class + decorators + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5301,14 +5303,14 @@ class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + class + custom order + alphabetically
- {
- code: `
+ // default option + class + custom order + alphabetically
+ {
+ code: `
class Foo {
constructor() {}
@@ -5321,19 +5323,19 @@ class Foo {
private static c: string = "";
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // default option + class expression + default order + alphabetically
- {
- code: `
+ // default option + class expression + default order + alphabetically
+ {
+ code: `
const foo = class Foo {
public static a: string;
protected static b: string = "";
@@ -5346,14 +5348,14 @@ const foo = class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + class expression + custom order + alphabetically
- {
- code: `
+ // default option + class expression + custom order + alphabetically
+ {
+ code: `
const foo = class Foo {
constructor() {}
@@ -5366,20 +5368,20 @@ const foo = class Foo {
private static c: string = "";
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
- },
- },
- ],
- },
- ],
- invalid: [
- // default option + interface + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
+ },
+ },
+ ],
+ },
+ ],
+ invalid: [
+ // default option + interface + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5396,30 +5398,30 @@ interface Foo {
new () : Bar;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'call',
- rank: 'field',
- },
- },
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'new',
- rank: 'method',
- },
- },
- ],
- },
-
- // default option + type literal + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'call',
+ rank: 'field',
+ },
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'new',
+ rank: 'method',
+ },
+ },
+ ],
+ },
+
+ // default option + type literal + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5436,30 +5438,30 @@ type Foo = {
new () : Bar;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'call',
- rank: 'field',
- },
- },
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'new',
- rank: 'method',
- },
- },
- ],
- },
-
- // default option + class + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'call',
+ rank: 'field',
+ },
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'new',
+ rank: 'method',
+ },
+ },
+ ],
+ },
+
+ // default option + class + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
public static c: string = "";
public static b: string = "";
@@ -5470,23 +5472,23 @@ class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
},
- ],
- },
+ },
+ ],
+ },
- // default option + class expression + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ // default option + class expression + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
const foo = class Foo {
public static c: string = "";
public static b: string = "";
@@ -5497,22 +5499,22 @@ const foo = class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
- },
- ],
- },
- // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
+ },
+ },
+ ],
+ },
+ // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
@Dec() a1: string;
@Dec()
@@ -5529,45 +5531,47 @@ class Foo {
@Dec() d(): void
}
`,
- options: [
- {
- default: {
- memberTypes: [
- 'decorated-field',
- 'field',
- 'constructor',
- 'decorated-method',
- ],
- order: 'alphabetically',
- },
- },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'b1',
- rank: 'constructor',
- },
- },
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'b2',
- rank: 'constructor',
- },
- },
- ],
- },
- ],
- };
-
-const sortedWithGroupingClassesOption: TSESLint.RunTests<MessageIds, Options> =
- {
- valid: [
- // classes option + interface + alphabetically --> Default order applies
- {
- code: `
+ options: [
+ {
+ default: {
+ memberTypes: [
+ 'decorated-field',
+ 'field',
+ 'constructor',
+ 'decorated-method',
+ ],
+ order: 'alphabetically',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'b1',
+ rank: 'constructor',
+ },
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'b2',
+ rank: 'constructor',
+ },
+ },
+ ],
+ },
+ ],
+};
+
+const sortedWithGroupingClassesOption: TSESLint.RunTests<
+ MessageIds,
+ Options
+> = {
+ valid: [
+ // classes option + interface + alphabetically --> Default order applies
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5584,12 +5588,12 @@ interface Foo {
a() : void;
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
- // classes option + type literal + alphabetically --> Default order applies
- {
- code: `
+ // classes option + type literal + alphabetically --> Default order applies
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5606,12 +5610,12 @@ type Foo = {
a() : void;
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
- // classes option + class + default order + alphabetically
- {
- code: `
+ // classes option + class + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5624,14 +5628,14 @@ class Foo {
constructor() {}
}
`,
- options: [
- { classes: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { classes: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // classes option + class + custom order + alphabetically
- {
- code: `
+ // classes option + class + custom order + alphabetically
+ {
+ code: `
class Foo {
constructor() {}
@@ -5644,19 +5648,19 @@ class Foo {
private static c: string = "";
}
`,
- options: [
- {
- classes: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ classes: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // classes option + class expression + alphabetically --> Default order applies
- {
- code: `
+ // classes option + class expression + alphabetically --> Default order applies
+ {
+ code: `
const foo = class Foo {
public static a: string;
protected static b: string = "";
@@ -5669,13 +5673,13 @@ const foo = class Foo {
constructor() {}
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
- ],
- invalid: [
- // default option + class + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
+ ],
+ invalid: [
+ // default option + class + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
public static c: string = "";
public static b: string = "";
@@ -5686,21 +5690,21 @@ class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
- },
- ],
- },
- ],
- };
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
+ },
+ },
+ ],
+ },
+ ],
+};
const sortedWithGroupingClassExpressionsOption: TSESLint.RunTests<
MessageIds,
thorn0/prettier@alt-10848-2 VS prettier/prettier@main
- babel/babel@c25ec3e
- vuejs/eslint-plugin-vue@5fe2445
- excalidraw/excalidraw@5da3207
- prettier/prettier@104c9fd
- marmelab/react-admin@52cbce7
- typescript-eslint/typescript-eslint@8218055
- vega/vega-lite@b6458aa
Diff (1105 lines)
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index 7024be9..ff82848 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,36 +176,31 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
- props => {
- const {
- children,
- pagination,
- className,
- resource,
- reference,
- ...rest
- } = props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
- };
+export const ReferenceArrayFieldView: FC<
+ ReferenceArrayFieldViewProps
+> = props => {
+ const { children, pagination, className, resource, reference, ...rest } =
+ props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+};
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 65ba764..523738a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,22 +156,23 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
- props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
- };
+export const ReferenceManyFieldView: FC<
+ ReferenceManyFieldViewProps
+> = props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+};
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 41e43b2..885329b 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,142 +80,139 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
- props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<
+ CheckboxGroupInputProps
+> = props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const {
- id,
- input: {
- onChange: finalFormOnChange,
- onBlur: finalFormOnBlur,
- value,
- },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ const {
+ id,
+ input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
+
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
+ if (loading) {
+ return (
+ <Labeled
+ label={label}
+ source={source}
+ resource={resource}
+ className={className}
+ isRequired={isRequired}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
);
+ }
- if (loading) {
- return (
- <Labeled
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
label={label}
source={source}
resource={resource}
- className={className}
isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
- );
- }
-
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
- label={label}
- source={source}
- resource={resource}
- isRequired={isRequired}
+ />
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
/>
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
- />
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
- };
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+};
const sanitizeRestProps = ({
refetch,
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts
index f8fc068..08beebb 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/configs.test.ts
@@ -45,8 +45,8 @@ function itHasBaseRulesOverriden(
}
describe('all.json config', () => {
- const unfilteredConfigRules: Record<string, string> =
- plugin.configs.all.rules;
+ const unfilteredConfigRules: Record<string, string> = plugin.configs.all
+ .rules;
const configRules = filterRules(unfilteredConfigRules);
// note: exclude deprecated rules, this config is allowed to change between minor versions
const ruleConfigs = Object.entries(rules)
@@ -61,8 +61,8 @@ describe('all.json config', () => {
});
describe('recommended.json config', () => {
- const unfilteredConfigRules: Record<string, string> =
- plugin.configs.recommended.rules;
+ const unfilteredConfigRules: Record<string, string> = plugin.configs
+ .recommended.rules;
const configRules = filterRules(unfilteredConfigRules);
// note: include deprecated rules so that the config doesn't change between major bumps
const ruleConfigs = Object.entries(rules)
@@ -84,8 +84,9 @@ describe('recommended.json config', () => {
});
describe('recommended-requiring-type-checking.json config', () => {
- const unfilteredConfigRules: Record<string, string> =
- plugin.configs['recommended-requiring-type-checking'].rules;
+ const unfilteredConfigRules: Record<string, string> = plugin.configs[
+ 'recommended-requiring-type-checking'
+ ].rules;
const configRules = filterRules(unfilteredConfigRules);
// note: include deprecated rules so that the config doesn't change between major bumps
const ruleConfigs = Object.entries(rules)
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
index b531438..c17aa57 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
@@ -5155,12 +5155,14 @@ type Foo = {
],
};
-const sortedWithGroupingDefaultOption: TSESLint.RunTests<MessageIds, Options> =
- {
- valid: [
- // default option + interface + default order + alphabetically
- {
- code: `
+const sortedWithGroupingDefaultOption: TSESLint.RunTests<
+ MessageIds,
+ Options
+> = {
+ valid: [
+ // default option + interface + default order + alphabetically
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5177,14 +5179,14 @@ interface Foo {
c() : void;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + interface + custom order + alphabetically
- {
- code: `
+ // default option + interface + custom order + alphabetically
+ {
+ code: `
interface Foo {
new () : Bar;
@@ -5200,19 +5202,19 @@ interface Foo {
() : Baz;
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'method', 'field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'method', 'field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // default option + type literal + default order + alphabetically
- {
- code: `
+ // default option + type literal + default order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5229,14 +5231,14 @@ type Foo = {
c() : void;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + type literal + custom order + alphabetically
- {
- code: `
+ // default option + type literal + custom order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5253,19 +5255,19 @@ type Foo = {
() : Baz;
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'method', 'field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'method', 'field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // default option + class + default order + alphabetically
- {
- code: `
+ // default option + class + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5278,13 +5280,13 @@ class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
- // default option + class + decorators + default order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
+ // default option + class + decorators + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5301,14 +5303,14 @@ class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + class + custom order + alphabetically
- {
- code: `
+ // default option + class + custom order + alphabetically
+ {
+ code: `
class Foo {
constructor() {}
@@ -5321,19 +5323,19 @@ class Foo {
private static c: string = "";
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // default option + class expression + default order + alphabetically
- {
- code: `
+ // default option + class expression + default order + alphabetically
+ {
+ code: `
const foo = class Foo {
public static a: string;
protected static b: string = "";
@@ -5346,14 +5348,14 @@ const foo = class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + class expression + custom order + alphabetically
- {
- code: `
+ // default option + class expression + custom order + alphabetically
+ {
+ code: `
const foo = class Foo {
constructor() {}
@@ -5366,20 +5368,20 @@ const foo = class Foo {
private static c: string = "";
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
- },
- },
- ],
- },
- ],
- invalid: [
- // default option + interface + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
+ },
+ },
+ ],
+ },
+ ],
+ invalid: [
+ // default option + interface + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5396,30 +5398,30 @@ interface Foo {
new () : Bar;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'call',
- rank: 'field',
- },
- },
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'new',
- rank: 'method',
- },
- },
- ],
- },
-
- // default option + type literal + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'call',
+ rank: 'field',
+ },
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'new',
+ rank: 'method',
+ },
+ },
+ ],
+ },
+
+ // default option + type literal + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5436,30 +5438,30 @@ type Foo = {
new () : Bar;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'call',
- rank: 'field',
- },
- },
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'new',
- rank: 'method',
- },
- },
- ],
- },
-
- // default option + class + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'call',
+ rank: 'field',
+ },
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'new',
+ rank: 'method',
+ },
+ },
+ ],
+ },
+
+ // default option + class + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
public static c: string = "";
public static b: string = "";
@@ -5470,23 +5472,23 @@ class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
},
- ],
- },
+ },
+ ],
+ },
- // default option + class expression + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ // default option + class expression + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
const foo = class Foo {
public static c: string = "";
public static b: string = "";
@@ -5497,22 +5499,22 @@ const foo = class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
- },
- ],
- },
- // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
+ },
+ },
+ ],
+ },
+ // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
@Dec() a1: string;
@Dec()
@@ -5529,45 +5531,47 @@ class Foo {
@Dec() d(): void
}
`,
- options: [
- {
- default: {
- memberTypes: [
- 'decorated-field',
- 'field',
- 'constructor',
- 'decorated-method',
- ],
- order: 'alphabetically',
- },
- },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'b1',
- rank: 'constructor',
- },
- },
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'b2',
- rank: 'constructor',
- },
- },
- ],
- },
- ],
- };
-
-const sortedWithGroupingClassesOption: TSESLint.RunTests<MessageIds, Options> =
- {
- valid: [
- // classes option + interface + alphabetically --> Default order applies
- {
- code: `
+ options: [
+ {
+ default: {
+ memberTypes: [
+ 'decorated-field',
+ 'field',
+ 'constructor',
+ 'decorated-method',
+ ],
+ order: 'alphabetically',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'b1',
+ rank: 'constructor',
+ },
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'b2',
+ rank: 'constructor',
+ },
+ },
+ ],
+ },
+ ],
+};
+
+const sortedWithGroupingClassesOption: TSESLint.RunTests<
+ MessageIds,
+ Options
+> = {
+ valid: [
+ // classes option + interface + alphabetically --> Default order applies
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5584,12 +5588,12 @@ interface Foo {
a() : void;
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
- // classes option + type literal + alphabetically --> Default order applies
- {
- code: `
+ // classes option + type literal + alphabetically --> Default order applies
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5606,12 +5610,12 @@ type Foo = {
a() : void;
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
- // classes option + class + default order + alphabetically
- {
- code: `
+ // classes option + class + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5624,14 +5628,14 @@ class Foo {
constructor() {}
}
`,
- options: [
- { classes: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { classes: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // classes option + class + custom order + alphabetically
- {
- code: `
+ // classes option + class + custom order + alphabetically
+ {
+ code: `
class Foo {
constructor() {}
@@ -5644,19 +5648,19 @@ class Foo {
private static c: string = "";
}
`,
- options: [
- {
- classes: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
- },
+ options: [
+ {
+ classes: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
},
- ],
- },
+ },
+ ],
+ },
- // classes option + class expression + alphabetically --> Default order applies
- {
- code: `
+ // classes option + class expression + alphabetically --> Default order applies
+ {
+ code: `
const foo = class Foo {
public static a: string;
protected static b: string = "";
@@ -5669,13 +5673,13 @@ const foo = class Foo {
constructor() {}
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
- ],
- invalid: [
- // default option + class + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
+ ],
+ invalid: [
+ // default option + class + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
public static c: string = "";
public static b: string = "";
@@ -5686,21 +5690,21 @@ class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
- },
- ],
- },
- ],
- };
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
+ },
+ },
+ ],
+ },
+ ],
+};
const sortedWithGroupingClassExpressionsOption: TSESLint.RunTests<
MessageIds,
run thorn0/prettier#alt-10848-3
thorn0/prettier@alt-10848-3 VS prettier/prettier@main
- babel/babel@c25ec3e
- vuejs/eslint-plugin-vue@5fe2445
- excalidraw/excalidraw@5da3207
- prettier/prettier@104c9fd
- marmelab/react-admin@52cbce7
- typescript-eslint/typescript-eslint@8218055
- vega/vega-lite@b6458aa
Diff (384 lines)
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index 7024be9..ff82848 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,36 +176,31 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
- props => {
- const {
- children,
- pagination,
- className,
- resource,
- reference,
- ...rest
- } = props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
- };
+export const ReferenceArrayFieldView: FC<
+ ReferenceArrayFieldViewProps
+> = props => {
+ const { children, pagination, className, resource, reference, ...rest } =
+ props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+};
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 65ba764..523738a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,22 +156,23 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
- props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
- };
+export const ReferenceManyFieldView: FC<
+ ReferenceManyFieldViewProps
+> = props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+};
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 41e43b2..885329b 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,142 +80,139 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
- props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<
+ CheckboxGroupInputProps
+> = props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const {
- id,
- input: {
- onChange: finalFormOnChange,
- onBlur: finalFormOnBlur,
- value,
- },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ const {
+ id,
+ input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
+
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
+ if (loading) {
+ return (
+ <Labeled
+ label={label}
+ source={source}
+ resource={resource}
+ className={className}
+ isRequired={isRequired}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
);
+ }
- if (loading) {
- return (
- <Labeled
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
label={label}
source={source}
resource={resource}
- className={className}
isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
- );
- }
-
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
- label={label}
- source={source}
- resource={resource}
- isRequired={isRequired}
+ />
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
/>
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
- />
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
- };
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+};
const sanitizeRestProps = ({
refetch,
run #11515
prettier/prettier#11515 VS prettier/prettier@main
- babel/babel@c25ec3e
- vuejs/eslint-plugin-vue@5fe2445
- excalidraw/excalidraw@5da3207
- prettier/prettier@104c9fd
- marmelab/react-admin@52cbce7
- typescript-eslint/typescript-eslint@8218055
- vega/vega-lite@b6458aa
Diff (384 lines)
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
index 7024be9..ff82848 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceArrayField.tsx
@@ -176,36 +176,31 @@ export interface ReferenceArrayFieldViewProps
classes?: ClassesOverride<typeof useStyles>;
}
-export const ReferenceArrayFieldView: FC<ReferenceArrayFieldViewProps> =
- props => {
- const {
- children,
- pagination,
- className,
- resource,
- reference,
- ...rest
- } = props;
- const classes = useStyles(props);
- const { loaded } = useListContext(props);
-
- if (!loaded) {
- return <LinearProgress className={classes.progress} />;
- }
-
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- className,
- resource,
- })}{' '}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination, sanitizeFieldRestProps(rest))}
- </>
- );
- };
+export const ReferenceArrayFieldView: FC<
+ ReferenceArrayFieldViewProps
+> = props => {
+ const { children, pagination, className, resource, reference, ...rest } =
+ props;
+ const classes = useStyles(props);
+ const { loaded } = useListContext(props);
+
+ if (!loaded) {
+ return <LinearProgress className={classes.progress} />;
+ }
+
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ className,
+ resource,
+ })}{' '}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination, sanitizeFieldRestProps(rest))}
+ </>
+ );
+};
ReferenceArrayFieldView.propTypes = {
basePath: PropTypes.string,
diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
index 65ba764..523738a 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyField.tsx
@@ -156,22 +156,23 @@ ReferenceManyField.defaultProps = {
addLabel: true,
};
-export const ReferenceManyFieldView: FC<ReferenceManyFieldViewProps> =
- props => {
- const { basePath, children, pagination, reference, ...rest } = props;
- return (
- <>
- {cloneElement(Children.only(children), {
- ...sanitizeFieldRestProps(rest),
- basePath,
- resource: reference,
- })}
- {pagination &&
- props.total !== undefined &&
- cloneElement(pagination)}
- </>
- );
- };
+export const ReferenceManyFieldView: FC<
+ ReferenceManyFieldViewProps
+> = props => {
+ const { basePath, children, pagination, reference, ...rest } = props;
+ return (
+ <>
+ {cloneElement(Children.only(children), {
+ ...sanitizeFieldRestProps(rest),
+ basePath,
+ resource: reference,
+ })}
+ {pagination &&
+ props.total !== undefined &&
+ cloneElement(pagination)}
+ </>
+ );
+};
export interface ReferenceManyFieldViewProps
extends Omit<
diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
index 41e43b2..885329b 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
@@ -80,142 +80,139 @@ import { ClassesOverride } from '../types';
*
* The object passed as `options` props is passed to the material-ui <Checkbox> components
*/
-const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> =
- props => {
- const {
- choices = [],
- className,
- classes: classesOverride,
- format,
- helperText,
- label,
- loaded,
- loading,
- margin = 'dense',
- onBlur,
- onChange,
- onFocus,
- optionText,
- optionValue,
- options,
- parse,
- resource,
- row,
- source,
- translate,
- translateChoice,
- validate,
- ...rest
- } = props;
- const classes = useStyles(props);
+const CheckboxGroupInput: FunctionComponent<
+ CheckboxGroupInputProps
+> = props => {
+ const {
+ choices = [],
+ className,
+ classes: classesOverride,
+ format,
+ helperText,
+ label,
+ loaded,
+ loading,
+ margin = 'dense',
+ onBlur,
+ onChange,
+ onFocus,
+ optionText,
+ optionValue,
+ options,
+ parse,
+ resource,
+ row,
+ source,
+ translate,
+ translateChoice,
+ validate,
+ ...rest
+ } = props;
+ const classes = useStyles(props);
- warning(
- source === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
- );
+ warning(
+ source === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the source prop`
+ );
- warning(
- choices === undefined,
- `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
- );
+ warning(
+ choices === undefined,
+ `If you're not wrapping the CheckboxGroupInput inside a ReferenceArrayInput, you must provide the choices prop`
+ );
- const {
- id,
- input: {
- onChange: finalFormOnChange,
- onBlur: finalFormOnBlur,
- value,
- },
- isRequired,
- meta: { error, submitError, touched },
- } = useInput({
- format,
- onBlur,
- onChange,
- onFocus,
- parse,
- resource,
- source,
- validate,
- ...rest,
- });
+ const {
+ id,
+ input: { onChange: finalFormOnChange, onBlur: finalFormOnBlur, value },
+ isRequired,
+ meta: { error, submitError, touched },
+ } = useInput({
+ format,
+ onBlur,
+ onChange,
+ onFocus,
+ parse,
+ resource,
+ source,
+ validate,
+ ...rest,
+ });
+
+ const handleCheck = useCallback(
+ (event, isChecked) => {
+ let newValue;
+ try {
+ // try to convert string value to number, e.g. '123'
+ newValue = JSON.parse(event.target.value);
+ } catch (e) {
+ // impossible to convert value, e.g. 'abc'
+ newValue = event.target.value;
+ }
+ if (isChecked) {
+ finalFormOnChange([...(value || []), ...[newValue]]);
+ } else {
+ finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
+ }
+ finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
+ },
+ [finalFormOnChange, finalFormOnBlur, value]
+ );
- const handleCheck = useCallback(
- (event, isChecked) => {
- let newValue;
- try {
- // try to convert string value to number, e.g. '123'
- newValue = JSON.parse(event.target.value);
- } catch (e) {
- // impossible to convert value, e.g. 'abc'
- newValue = event.target.value;
- }
- if (isChecked) {
- finalFormOnChange([...(value || []), ...[newValue]]);
- } else {
- finalFormOnChange(value.filter(v => v != newValue)); // eslint-disable-line eqeqeq
- }
- finalFormOnBlur(); // HACK: See https://github.com/final-form/react-final-form/issues/365#issuecomment-515045503
- },
- [finalFormOnChange, finalFormOnBlur, value]
+ if (loading) {
+ return (
+ <Labeled
+ label={label}
+ source={source}
+ resource={resource}
+ className={className}
+ isRequired={isRequired}
+ margin={margin}
+ >
+ <LinearProgress />
+ </Labeled>
);
+ }
- if (loading) {
- return (
- <Labeled
+ return (
+ <FormControl
+ component="fieldset"
+ margin={margin}
+ error={touched && !!(error || submitError)}
+ className={classnames(classes.root, className)}
+ {...sanitizeRestProps(rest)}
+ >
+ <FormLabel component="legend" className={classes.label}>
+ <FieldTitle
label={label}
source={source}
resource={resource}
- className={className}
isRequired={isRequired}
- margin={margin}
- >
- <LinearProgress />
- </Labeled>
- );
- }
-
- return (
- <FormControl
- component="fieldset"
- margin={margin}
- error={touched && !!(error || submitError)}
- className={classnames(classes.root, className)}
- {...sanitizeRestProps(rest)}
- >
- <FormLabel component="legend" className={classes.label}>
- <FieldTitle
- label={label}
- source={source}
- resource={resource}
- isRequired={isRequired}
+ />
+ </FormLabel>
+ <FormGroup row={row}>
+ {choices.map(choice => (
+ <CheckboxGroupInputItem
+ key={get(choice, optionValue)}
+ choice={choice}
+ id={id}
+ onChange={handleCheck}
+ options={options}
+ optionText={optionText}
+ optionValue={optionValue}
+ translateChoice={translateChoice}
+ value={value}
/>
- </FormLabel>
- <FormGroup row={row}>
- {choices.map(choice => (
- <CheckboxGroupInputItem
- key={get(choice, optionValue)}
- choice={choice}
- id={id}
- onChange={handleCheck}
- options={options}
- optionText={optionText}
- optionValue={optionValue}
- translateChoice={translateChoice}
- value={value}
- />
- ))}
- </FormGroup>
- <FormHelperText>
- <InputHelperText
- touched={touched}
- error={error || submitError}
- helperText={helperText}
- />
- </FormHelperText>
- </FormControl>
- );
- };
+ ))}
+ </FormGroup>
+ <FormHelperText>
+ <InputHelperText
+ touched={touched}
+ error={error || submitError}
+ helperText={helperText}
+ />
+ </FormHelperText>
+ </FormControl>
+ );
+};
const sanitizeRestProps = ({
refetch,