Skip to content

Commit 3314e16

Browse files
fix: Add react/no-multi-comp lint rule (#451)
* Make all components default exports * Rename file * Rename temp * Restore original * Make docs components default exports * Rename file * Rename temp * Restore original * Rename file * Rename temp * Restore original * Rename file * Rename temp * Restore original * Rename file * Rename temp * Restore original * Rename to private files * Separate Properties components * Implement lint rule
1 parent 93a8af0 commit 3314e16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+493
-385
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ rules:
129129
react/jsx-wrap-multilines: 2
130130
react/no-did-mount-set-state: 2
131131
react/no-did-update-set-state: 2
132-
#react/no-multi-comp: 2
132+
react/no-multi-comp: 2
133133
react/no-unknown-property: 2
134134
react/prop-types: 2
135135
react/react-in-jsx-scope: 2

src/Alert/Alert.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import classnames from 'classnames';
33
import PropTypes from 'prop-types';
44
import React, { Component } from 'react';
55

6-
export class Alert extends Component {
6+
class Alert extends Component {
77
constructor(props) {
88
super(props);
99
this.state = {
@@ -70,6 +70,7 @@ export class Alert extends Component {
7070
);
7171
}
7272
}
73+
7374
Alert.displayName = 'Alert';
7475

7576
Alert.propTypes = {
@@ -88,3 +89,5 @@ Alert.propDescriptions = {
8889
linkProps: 'Additional props to be spread to the link\'s `<a>` element.',
8990
linkText: 'Localized display text of the link.'
9091
};
92+
93+
export default Alert;

src/Alert/Alert.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Alert } from './Alert';
1+
import Alert from './Alert';
22
import React from 'react';
33
import renderer from 'react-test-renderer';
44
import { mount, shallow } from 'enzyme';

src/Calendar/Calendar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import classnames from 'classnames';
22
import PropTypes from 'prop-types';
33
import React, { Component } from 'react';
44

5-
export class Calendar extends Component {
5+
class Calendar extends Component {
66

77
constructor(props) {
88
super(props);
@@ -547,6 +547,7 @@ export class Calendar extends Component {
547547
}
548548

549549
}
550+
550551
Calendar.displayName = 'Calendar';
551552

552553
Calendar.basePropTypes = {
@@ -590,3 +591,5 @@ Calendar.propDescriptions = {
590591
tableProps: 'Additional props to be spread to the `<table>` element.',
591592
yearListProps: 'Additional props to be spread to the year\'s `<ul>` element.'
592593
};
594+
595+
export default Calendar;

src/Calendar/Calendar.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Calendar } from '../Calendar/Calendar';
1+
import Calendar from '../Calendar/Calendar';
22
import { mount } from 'enzyme';
33
import React from 'react';
44

src/ComboboxInput/ComboboxInput.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import classnames from 'classnames';
2-
import { Popover } from '../Popover/Popover';
2+
import Popover from '../Popover/Popover';
33
import PropTypes from 'prop-types';
44
import React from 'react';
55

6-
// ------------------------------------------- Combobox Input ------------------------------------------
7-
export const ComboboxInput = ({ placeholder, menu, compact, className, popoverProps, inputProps, buttonProps, ...props }) => {
6+
const ComboboxInput = ({ placeholder, menu, compact, className, popoverProps, inputProps, buttonProps, ...props }) => {
87
const comboboxInputClasses = classnames(
98
'fd-combobox-input',
109
className
@@ -49,6 +48,7 @@ export const ComboboxInput = ({ placeholder, menu, compact, className, popoverPr
4948
</div>
5049
);
5150
};
51+
5252
ComboboxInput.displayName = 'ComboboxInput';
5353

5454
ComboboxInput.propTypes = {
@@ -64,3 +64,5 @@ ComboboxInput.propTypes = {
6464
ComboboxInput.propDescriptions = {
6565
menu: 'An object containing a `Menu` component.'
6666
};
67+
68+
export default ComboboxInput;

src/ComboboxInput/ComboboxInput.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ComboboxInput } from './ComboboxInput';
1+
import ComboboxInput from './ComboboxInput';
22
import Menu from '../Menu/Menu';
33
import { mount } from 'enzyme';
44
import React from 'react';

src/DatePicker/DatePicker.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { Calendar } from '../Calendar/Calendar';
1+
import Calendar from '../Calendar/Calendar';
22
import classnames from 'classnames';
33
import PropTypes from 'prop-types';
44
import React, { Component } from 'react';
55

6-
export class DatePicker extends Component {
6+
class DatePicker extends Component {
77
constructor(props) {
88
super(props);
99

@@ -342,6 +342,7 @@ export class DatePicker extends Component {
342342
);
343343
}
344344
}
345+
345346
DatePicker.displayName = 'DatePicker';
346347

347348
DatePicker.propTypes = {
@@ -356,3 +357,5 @@ DatePicker.propDescriptions = {
356357
...Calendar.propDescriptions,
357358
enableRangeSelection: 'Set to **true** to enable the selection of a date range (begin and end).'
358359
};
360+
361+
export default DatePicker;

src/DatePicker/DatePicker.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DatePicker } from '../DatePicker/DatePicker';
1+
import DatePicker from '../DatePicker/DatePicker';
22
import { mount } from 'enzyme';
33
import React from 'react';
44

src/Dropdown/Dropdown.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import classnames from 'classnames';
22
import PropTypes from 'prop-types';
33
import React from 'react';
44

5-
export const Dropdown = props => {
5+
const Dropdown = props => {
66
const { standard, children, className, ...rest } = props;
77

88
const dropdownClasses = classnames(
@@ -19,6 +19,7 @@ export const Dropdown = props => {
1919
</div>
2020
);
2121
};
22+
2223
Dropdown.displayName = 'Dropdown';
2324

2425
Dropdown.propTypes = {
@@ -30,3 +31,5 @@ Dropdown.propTypes = {
3031
Dropdown.propDescriptions = {
3132
standard: 'Set to **true** to enable a dropdown for toolbar.'
3233
};
34+
35+
export default Dropdown;

0 commit comments

Comments
 (0)