Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix double export (named and default) in component files #4254

Merged
merged 14 commits into from
Jan 8, 2020
2 changes: 1 addition & 1 deletion packages/ra-core/src/form/FormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface Props
validate?: Validator | Validator[];
}

export const FormField: FunctionComponent<Props> = ({
const FormField: FunctionComponent<Props> = ({
id,
input,
validate,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/detail/SimpleShowLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const sanitizeRestProps = ({
* );
* export default App;
*/
export const SimpleShowLayout = ({
const SimpleShowLayout = ({
basePath,
className,
children,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/ArrayField.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render, cleanup } from '@testing-library/react';

import { ArrayField } from './ArrayField';
import ArrayField from './ArrayField';
import NumberField from './NumberField';
import TextField from './TextField';
import Datagrid from '../list/Datagrid';
Expand Down
5 changes: 1 addition & 4 deletions packages/ra-ui-materialui/src/field/ArrayField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ const initialState = {
* )
* TagsField.defaultProps = { addLabel: true };
*/
export class ArrayField extends Component<
FieldProps & InjectedFieldProps,
State
> {
class ArrayField extends Component<FieldProps & InjectedFieldProps, State> {
constructor(props: FieldProps & InjectedFieldProps) {
super(props);
this.state = props.record
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/BooleanField.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import expect from 'expect';
import { BooleanField } from './BooleanField';
import BooleanField from './BooleanField';
import { render, cleanup } from '@testing-library/react';

const defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/BooleanField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Props extends FieldProps {
valueLabelFalse?: string;
}

export const BooleanField: FunctionComponent<
const BooleanField: FunctionComponent<
Props & InjectedFieldProps & TypographyProps
> = ({
className,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/ChipField.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import expect from 'expect';
import { ChipField } from './ChipField';
import ChipField from './ChipField';
import { render, cleanup } from '@testing-library/react';

describe('<ChipField />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/ChipField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const useStyles = makeStyles(
{ name: 'RaChipField' }
);

export const ChipField: FunctionComponent<
const ChipField: FunctionComponent<
FieldProps & InjectedFieldProps & ChipProps
> = ({ className, classes: classesOverride, source, record = {}, ...rest }) => {
const classes = useStyles({ classes: classesOverride });
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/FileField.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import expect from 'expect';
import { FileField } from './FileField';
import FileField from './FileField';
import { render, cleanup } from '@testing-library/react';

const defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/FileField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Props extends FieldProps {
classes?: object;
}

export const FileField: FunctionComponent<Props & InjectedFieldProps> = ({
const FileField: FunctionComponent<Props & InjectedFieldProps> = ({
className,
classes: classesOverride,
record,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/ImageField.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import expect from 'expect';
import { render, cleanup } from '@testing-library/react';
import { ImageField } from './ImageField';
import ImageField from './ImageField';

const defaultProps = {
classes: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/ImageField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface Props extends FieldProps {
classes?: object;
}

export const ImageField: FunctionComponent<Props & InjectedFieldProps> = ({
const ImageField: FunctionComponent<Props & InjectedFieldProps> = ({
className,
classes: classesOverride,
record,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/ReferenceArrayField.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { fieldPropTypes } from './types';
* </ReferenceArrayField>
*
*/
export const ReferenceArrayField = ({ children, ...props }) => {
const ReferenceArrayField = ({ children, ...props }) => {
if (React.Children.count(children) !== 1) {
throw new Error(
'<ReferenceArrayField> only accepts a single child (like <Datagrid>)'
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/SelectField.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import expect from 'expect';
import { render, cleanup } from '@testing-library/react';

import { TestTranslationProvider, renderWithRedux } from 'ra-core';
import { SelectField } from './SelectField';
import SelectField from './SelectField';

describe('<SelectField />', () => {
afterEach(cleanup);
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/field/SelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import { FieldProps, InjectedFieldProps, fieldPropTypes } from './types';
*
* **Tip**: <ReferenceField> sets `translateChoice` to false by default.
*/
export const SelectField: FunctionComponent<
const SelectField: FunctionComponent<
ChoicesProps & FieldProps & InjectedFieldProps
> = ({
className,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/form/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const useStyles = makeStyles(
{ name: 'RaFormInput' }
);

export const FormInput = ({ input, classes: classesOverride, ...rest }) => {
const FormInput = ({ input, classes: classesOverride, ...rest }) => {
const classes = useStyles({ classes: classesOverride });
return input ? (
<div
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/ArrayInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import sanitizeRestProps from './sanitizeRestProps';
*
* @see https://github.com/final-form/react-final-form-arrays
*/
export const ArrayInput = ({
const ArrayInput = ({
className,
defaultValue,
label,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/DateInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const getStringFromDate = (value: string | Date) => {
return convertDateToString(new Date(value));
};

export const DateInput: FunctionComponent<
const DateInput: FunctionComponent<
InputProps<TextFieldProps> & Omit<TextFieldProps, 'helperText' | 'label'>
> = ({
format = getStringFromDate,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/DateTimeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const parseDateTime = (value: string) => new Date(value);
/**
* Input component for entering a date and a time with timezone, using the browser locale
*/
export const DateTimeInput: FunctionComponent<
const DateTimeInput: FunctionComponent<
InputProps<TextFieldProps> & Omit<TextFieldProps, 'helperText' | 'label'>
> = ({
format = formatDateTime,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/Labeled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ interface Props {
* <FooComponent source="title" />
* </Labeled>
*/
export const Labeled: FunctionComponent<Props> = ({
const Labeled: FunctionComponent<Props> = ({
children,
className,
classes: classesOverride,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const useStyles = makeStyles(
*
* The object passed as `options` props is passed to the material-ui <RadioButtonGroup> component
*/
export const RadioButtonGroupInput: FunctionComponent<
const RadioButtonGroupInput: FunctionComponent<
ChoicesProps & InputProps<RadioGroupProps> & FormControlProps
> = ({
choices = [],
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/ReferenceArrayInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import ReferenceError from './ReferenceError';
* <SelectArrayInput optionText="name" />
* </ReferenceArrayInput>
*/
export const ReferenceArrayInput = ({
const ReferenceArrayInput = ({
children,
id: idOverride,
onBlur,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/ReferenceInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ interface Props {
* <SelectInput optionText="title" />
* </ReferenceInput>
*/
export const ReferenceInput: FunctionComponent<Props & InputProps> = ({
const ReferenceInput: FunctionComponent<Props & InputProps> = ({
format,
onBlur,
onChange,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/input/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type TextInputProps = InputProps<TextFieldProps> &
*
* The object passed as `options` props is passed to the <ResettableTextField> component
*/
export const TextInput: FunctionComponent<TextInputProps> = ({
const TextInput: FunctionComponent<TextInputProps> = ({
label,
format,
helperText,
Expand Down
6 changes: 1 addition & 5 deletions packages/ra-ui-materialui/src/layout/LoadingIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ const useStyles = makeStyles(
{ name: 'RaLoadingIndicator' }
);

export const LoadingIndicator = ({
classes: classesOverride,
className,
...rest
}) => {
const LoadingIndicator = ({ classes: classesOverride, className, ...rest }) => {
const loading = useSelector(state => state.admin.loading > 0);
const classes = useStyles({ classes: classesOverride });
return loading ? (
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/list/DatagridCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const sanitizeRestProps = ({
...rest
}) => rest;

export const DatagridCell = ({
const DatagridCell = ({
className,
field,
record,
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/list/DatagridCell.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { shallow } from 'enzyme';

import { DatagridCell } from './DatagridCell';
import DatagridCell from './DatagridCell';

describe('<DatagridCell />', () => {
const Field = () => <div />;
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/list/DatagridHeaderCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const useStyles = makeStyles(
{ name: 'RaDatagridHeaderCell' }
);

export const DatagridHeaderCell = ({
const DatagridHeaderCell = ({
WiXSL marked this conversation as resolved.
Show resolved Hide resolved
className,
classes: classesOverride,
field,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import expect from 'expect';
import React from 'react';
import { render, cleanup } from '@testing-library/react';

import { DatagridHeaderCell } from './DatagridHeaderCell';
import DatagridHeaderCell from './DatagridHeaderCell';

describe('<DatagridHeaderCell />', () => {
afterEach(cleanup);
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/list/Filter.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { render, cleanup } from '@testing-library/react';
import { TextInput } from '../input/TextInput';
import TextInput from '../input/TextInput';
import Filter from './Filter';

describe('<Filter />', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/list/FilterForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const sanitizeRestProps = ({
...props
}) => props;

export const FilterForm = ({
const FilterForm = ({
WiXSL marked this conversation as resolved.
Show resolved Hide resolved
classes = {},
className,
resource,
Expand Down