Skip to content

Commit 9be02f2

Browse files
committed
chore(prettier): Format codebase
1 parent 0ffa609 commit 9be02f2

File tree

8 files changed

+107
-23
lines changed

8 files changed

+107
-23
lines changed

src/components/Tab.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ export default class Tab extends Component {
1616
};
1717

1818
static propTypes = {
19-
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object, PropTypes.string]),
20-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]),
19+
children: PropTypes.oneOfType([
20+
PropTypes.array,
21+
PropTypes.object,
22+
PropTypes.string,
23+
]),
24+
className: PropTypes.oneOfType([
25+
PropTypes.string,
26+
PropTypes.array,
27+
PropTypes.object,
28+
]),
2129
disabled: PropTypes.bool,
2230
tabIndex: PropTypes.string,
2331
disabledClassName: PropTypes.string,

src/components/TabPanel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ export default class TabPanel extends Component {
1313

1414
static propTypes = {
1515
children: PropTypes.node,
16-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]),
16+
className: PropTypes.oneOfType([
17+
PropTypes.string,
18+
PropTypes.array,
19+
PropTypes.object,
20+
]),
1721
forceRender: PropTypes.bool,
1822
id: PropTypes.string, // private
1923
selected: PropTypes.bool, // private

src/components/Tabs.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import PropTypes from 'prop-types';
22
import React, { Component } from 'react';
3-
import { childrenPropType, onSelectPropType, selectedIndexPropType } from '../helpers/propTypes';
3+
import {
4+
childrenPropType,
5+
onSelectPropType,
6+
selectedIndexPropType,
7+
} from '../helpers/propTypes';
48
import UncontrolledTabs from './UncontrolledTabs';
59
import { getTabsCount } from '../helpers/count';
610

@@ -14,7 +18,11 @@ export default class Tabs extends Component {
1418

1519
static propTypes = {
1620
children: childrenPropType,
17-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]),
21+
className: PropTypes.oneOfType([
22+
PropTypes.string,
23+
PropTypes.array,
24+
PropTypes.object,
25+
]),
1826
defaultFocus: PropTypes.bool,
1927
defaultIndex: PropTypes.number,
2028
disabledTabClassName: PropTypes.string,

src/components/UncontrolledTabs.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ export default class UncontrolledTabs extends Component {
3939

4040
static propTypes = {
4141
children: childrenPropType,
42-
className: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.object]),
42+
className: PropTypes.oneOfType([
43+
PropTypes.string,
44+
PropTypes.array,
45+
PropTypes.object,
46+
]),
4347
disabledTabClassName: PropTypes.string,
4448
domRef: PropTypes.func,
4549
focus: PropTypes.bool,
@@ -172,8 +176,10 @@ export default class UncontrolledTabs extends Component {
172176
focus: selected && (focus || wasTabFocused),
173177
};
174178

175-
if (selectedTabClassName) props.selectedClassName = selectedTabClassName;
176-
if (disabledTabClassName) props.disabledClassName = disabledTabClassName;
179+
if (selectedTabClassName)
180+
props.selectedClassName = selectedTabClassName;
181+
if (disabledTabClassName)
182+
props.disabledClassName = disabledTabClassName;
177183

178184
listIndex++;
179185

@@ -188,7 +194,8 @@ export default class UncontrolledTabs extends Component {
188194
};
189195

190196
if (forceRenderTabPanel) props.forceRender = forceRenderTabPanel;
191-
if (selectedTabPanelClassName) props.selectedClassName = selectedTabPanelClassName;
197+
if (selectedTabPanelClassName)
198+
props.selectedClassName = selectedTabPanelClassName;
192199

193200
index++;
194201

src/components/__tests__/TabList-test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ describe('<TabList />', () => {
5151

5252
it('should display the custom classnames for selected and disabled tab specified on tabs', () => {
5353
expectToMatchSnapshot(
54-
<Tabs defaultIndex={0} selectedTabClassName="active" disabledTabClassName="disabled">
54+
<Tabs
55+
defaultIndex={0}
56+
selectedTabClassName="active"
57+
disabledTabClassName="disabled"
58+
>
5559
<TabList>
5660
<Tab>Foo</Tab>
5761
<Tab disabled>Bar</Tab>

src/components/__tests__/Tabs-test.js

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import TabList from '../TabList';
99
import TabPanel from '../TabPanel';
1010
import Tabs from '../Tabs';
1111
import { reset as resetIdCounter } from '../../helpers/uuid';
12-
import { TabListWrapper, TabWrapper, TabPanelWrapper } from './helpers/higherOrder';
12+
import {
13+
TabListWrapper,
14+
TabWrapper,
15+
TabPanelWrapper,
16+
} from './helpers/higherOrder';
1317

1418
Enzyme.configure({ adapter: new Adapter() });
1519

@@ -195,7 +199,11 @@ describe('<Tabs />', () => {
195199
);
196200
console.error = oldConsoleError; // eslint-disable-line no-console
197201

198-
const result = Tabs.propTypes.children(wrapper.props(), 'children', 'Tabs');
202+
const result = Tabs.propTypes.children(
203+
wrapper.props(),
204+
'children',
205+
'Tabs',
206+
);
199207
expect(result).toBeInstanceOf(Error);
200208
});
201209

@@ -214,7 +222,11 @@ describe('<Tabs />', () => {
214222
);
215223
console.error = oldConsoleError; // eslint-disable-line no-console
216224

217-
const result = Tabs.propTypes.children(wrapper.props(), 'children', 'Tabs');
225+
const result = Tabs.propTypes.children(
226+
wrapper.props(),
227+
'children',
228+
'Tabs',
229+
);
218230
expect(result).toBeInstanceOf(Error);
219231
});
220232

@@ -235,7 +247,11 @@ describe('<Tabs />', () => {
235247
);
236248
console.error = oldConsoleError; // eslint-disable-line no-console
237249

238-
const result = Tabs.propTypes.children(wrapper.props(), 'children', 'Tabs');
250+
const result = Tabs.propTypes.children(
251+
wrapper.props(),
252+
'children',
253+
'Tabs',
254+
);
239255
expect(result).toBeInstanceOf(Error);
240256
});
241257

@@ -299,7 +315,11 @@ describe('<Tabs />', () => {
299315
);
300316
console.error = oldConsoleError; // eslint-disable-line no-console
301317

302-
const result = Tabs.propTypes.children(wrapper.props(), 'children', 'Tabs');
318+
const result = Tabs.propTypes.children(
319+
wrapper.props(),
320+
'children',
321+
'Tabs',
322+
);
303323
expect(result).toBeInstanceOf(Error);
304324
});
305325

@@ -327,7 +347,11 @@ describe('<Tabs />', () => {
327347
</Tabs>,
328348
);
329349

330-
const result = Tabs.propTypes.children(wrapper.props(), 'children', 'Tabs');
350+
const result = Tabs.propTypes.children(
351+
wrapper.props(),
352+
'children',
353+
'Tabs',
354+
);
331355
expect(result instanceof Error).toBe(false);
332356
});
333357

@@ -484,7 +508,10 @@ describe('<Tabs />', () => {
484508
state = {};
485509
handleSelect = () => this.setState({ foo: 'bar' });
486510
render() {
487-
return createTabs({ onSelect: this.handleSelect, className: this.state.foo });
511+
return createTabs({
512+
onSelect: this.handleSelect,
513+
className: this.state.foo,
514+
});
488515
}
489516
}
490517

src/helpers/childrenDeepMap.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ export function deepMap(children, callback) {
1515
return callback(child);
1616
}
1717

18-
if (child.props && child.props.children && typeof child.props.children === 'object') {
18+
if (
19+
child.props &&
20+
child.props.children &&
21+
typeof child.props.children === 'object'
22+
) {
1923
// Clone the child that has children and map them too
2024
return cloneElement(child, {
2125
...child.props,
@@ -35,7 +39,11 @@ export function deepForEach(children, callback) {
3539

3640
if (isTab(child) || isTabPanel(child)) {
3741
callback(child);
38-
} else if (child.props && child.props.children && typeof child.props.children === 'object') {
42+
} else if (
43+
child.props &&
44+
child.props.children &&
45+
typeof child.props.children === 'object'
46+
) {
3947
if (isTabList(child)) callback(child);
4048
deepForEach(child.props.children, callback);
4149
}

src/helpers/propTypes.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ export function childrenPropType(props, propName, componentName) {
1111

1212
deepForEach(children, child => {
1313
if (isTabList(child)) {
14-
if (child.props && child.props.children && typeof child.props.children === 'object') {
15-
deepForEach(child.props.children, listChild => listTabs.push(listChild));
14+
if (
15+
child.props &&
16+
child.props.children &&
17+
typeof child.props.children === 'object'
18+
) {
19+
deepForEach(child.props.children, listChild =>
20+
listTabs.push(listChild),
21+
);
1622
}
1723

1824
if (tabListFound) {
@@ -45,7 +51,13 @@ export function childrenPropType(props, propName, componentName) {
4551
return error;
4652
}
4753

48-
export function onSelectPropType(props, propName, componentName, location, propFullName) {
54+
export function onSelectPropType(
55+
props,
56+
propName,
57+
componentName,
58+
location,
59+
propFullName,
60+
) {
4961
const prop = props[propName];
5062
const name = propFullName || propName;
5163
let error = null;
@@ -69,7 +81,13 @@ export function onSelectPropType(props, propName, componentName, location, propF
6981
return error;
7082
}
7183

72-
export function selectedIndexPropType(props, propName, componentName, location, propFullName) {
84+
export function selectedIndexPropType(
85+
props,
86+
propName,
87+
componentName,
88+
location,
89+
propFullName,
90+
) {
7391
const prop = props[propName];
7492
const name = propFullName || propName;
7593
let error = null;

0 commit comments

Comments
 (0)