Skip to content

Commit 78a33b7

Browse files
BatDroidsatya164
authored andcommitted
refactor: update prettier to 2.0.5 and refactor the whole project for it
1 parent 9b74586 commit 78a33b7

File tree

79 files changed

+200
-348
lines changed

Some content is hidden

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

79 files changed

+200
-348
lines changed

docs/assets/snack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function appendSnackLink() {
5454

5555
appendSnackLink();
5656

57-
var mutationObserver = new MutationObserver(mutations => {
57+
var mutationObserver = new MutationObserver((mutations) => {
5858
mutations.forEach(appendSnackLink);
5959
});
6060

docs/assets/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function appendVersionBanner() {
152152

153153
appendVersionBanner();
154154

155-
var mutationObserver = new MutationObserver(mutations => {
155+
var mutationObserver = new MutationObserver((mutations) => {
156156
mutations.forEach(appendVersionBanner);
157157
});
158158

docs/component-docs.config.js

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,17 @@ function getPages() {
3939
.readFileSync(path.join(__dirname, '../src/index.tsx'))
4040
.toString()
4141
.split('\n')
42-
.map(line =>
43-
line
44-
.split(' ')
45-
.pop()
46-
.replace(/('|;)/g, '')
47-
)
48-
.filter(line => line.startsWith('./components/'))
49-
.map(line => {
42+
.map((line) => line.split(' ').pop().replace(/('|;)/g, ''))
43+
.filter((line) => line.startsWith('./components/'))
44+
.map((line) => {
5045
const file = require.resolve(path.join(__dirname, '../src', line));
5146
if (/\/index\.(js|tsx?)$/.test(file)) {
5247
const matches = fs
5348
.readFileSync(file)
5449
.toString()
5550
.match(/export \{ default \} from .+/);
5651
if (matches && matches.length) {
57-
const name = matches[0]
58-
.split(' ')
59-
.pop()
60-
.replace(/('|;)/g, '');
52+
const name = matches[0].split(' ').pop().replace(/('|;)/g, '');
6153
return require.resolve(path.join(__dirname, '../src', line, name));
6254
}
6355
}
@@ -75,18 +67,12 @@ function getPages() {
7567
const match = content.match(/\/\/ @component (.\/\w+\.(js|tsx?))/gm);
7668

7769
if (match && match.length) {
78-
const componentFiles = match.map(line => {
70+
const componentFiles = match.map((line) => {
7971
const fileName = line.split(' ')[2];
8072
return {
8173
group,
8274
file: require.resolve(
83-
path.join(
84-
file
85-
.split('/')
86-
.slice(0, -1)
87-
.join('/'),
88-
fileName
89-
)
75+
path.join(file.split('/').slice(0, -1).join('/'), fileName)
9076
),
9177
};
9278
});
@@ -98,7 +84,7 @@ function getPages() {
9884
}, [])
9985
.filter(
10086
(info, index, self) =>
101-
index === self.findIndex(other => info.file === other.file)
87+
index === self.findIndex((other) => info.file === other.file)
10288
)
10389
.sort((a, b) => {
10490
const nameA = a.file.split('/').pop();
@@ -110,12 +96,12 @@ function getPages() {
11096
const nameB = (b.group || b.file).split('/').pop();
11197
return nameA.localeCompare(nameB);
11298
})
113-
.map(info => ({ ...info, type: 'component' }));
99+
.map((info) => ({ ...info, type: 'component' }));
114100

115101
const docs = fs
116102
.readdirSync(path.join(__dirname, 'pages'))
117-
.filter(file => file.includes('.'))
118-
.map(file => ({
103+
.filter((file) => file.includes('.'))
104+
.map((file) => ({
119105
file: path.join(__dirname, 'pages', file),
120106
type: getType(file),
121107
}));

docs/pages/src/Showcase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default class Showcase extends React.Component<{}> {
9595
to add your app to this list.
9696
</p>
9797
<Gallery>
98-
{data.map(item => {
98+
{data.map((item) => {
9999
const tintColor = color(item.color).isLight()
100100
? '#000000'
101101
: '#FFFFFF';

docs/pages/src/components/IconsList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class IconsList extends React.Component<{}, State> {
2020
const query = this.state.query.toLowerCase();
2121

2222
return iconNames.filter(
23-
item =>
23+
(item) =>
2424
item.includes(query.replace(/\s/g, '-')) ||
2525
item.replace(/-/g, '').includes(query)
2626
);
@@ -54,7 +54,7 @@ export default class IconsList extends React.Component<{}, State> {
5454
/>
5555
{searchResults.length ? (
5656
<Results>
57-
{searchResults.map(name => (
57+
{searchResults.map((name) => (
5858
<IconContainer
5959
key={name}
6060
type="button"

example/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const path = require('path');
22
const pak = require('../package.json');
33

4-
module.exports = function(api) {
4+
module.exports = function (api) {
55
api.cache(true);
66

77
return {

example/metro.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ module.exports = {
1818
resolver: {
1919
blacklistRE: blacklist(
2020
modules.map(
21-
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
21+
(m) =>
22+
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
2223
)
2324
),
2425

example/src/Examples/BadgeExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const BadgeExample = () => {
2222
<Paragraph style={styles.label}>Show badges</Paragraph>
2323
<Switch
2424
value={visible}
25-
onValueChange={visible => setVisible(visible)}
25+
onValueChange={(visible) => setVisible(visible)}
2626
/>
2727
</View>
2828
<List.Section title="Text">

example/src/Examples/BannerExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const BannerExample = () => {
4141
on mobile.
4242
</Banner>
4343
<View style={styles.grid}>
44-
{PHOTOS.map(uri => (
44+
{PHOTOS.map((uri) => (
4545
<View key={uri} style={styles.item}>
4646
<Image source={{ uri }} style={styles.photo} />
4747
</View>

example/src/Examples/BottomNavigationExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const PhotoGallery = ({ route }: Route) => {
2828

2929
return (
3030
<ScrollView contentContainerStyle={styles.content}>
31-
{PHOTOS.map(uri => (
31+
{PHOTOS.map((uri) => (
3232
<View key={uri} style={styles.item}>
3333
<Image source={{ uri }} style={styles.photo} />
3434
</View>

example/src/Examples/CardExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const CardExample = () => {
9090
<Card.Cover source={require('../../assets/images/city.jpg')} />
9191
<Card.Title
9292
title="Long Pressable City"
93-
left={props => <Avatar.Icon {...props} icon="city" />}
93+
left={(props) => <Avatar.Icon {...props} icon="city" />}
9494
/>
9595
<Card.Content>
9696
<Paragraph>

example/src/Examples/DataTableExample.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ const DataTableExample = () => {
5656
const sortedItems = items
5757
.slice()
5858
.sort((item1, item2) =>
59-
(sortAscending
60-
? item1.name < item2.name
61-
: item2.name < item1.name)
59+
(sortAscending ? item1.name < item2.name : item2.name < item1.name)
6260
? 1
6361
: -1
6462
);
@@ -85,7 +83,7 @@ const DataTableExample = () => {
8583
<DataTable.Title numeric>Fat (g)</DataTable.Title>
8684
</DataTable.Header>
8785

88-
{sortedItems.slice(from, to).map(item => (
86+
{sortedItems.slice(from, to).map((item) => (
8987
<DataTable.Row key={item.key}>
9088
<DataTable.Cell style={styles.first}>{item.name}</DataTable.Cell>
9189
<DataTable.Cell numeric>{item.calories}</DataTable.Cell>
@@ -96,7 +94,7 @@ const DataTableExample = () => {
9694
<DataTable.Pagination
9795
page={page}
9896
numberOfPages={Math.floor(sortedItems.length / itemsPerPage)}
99-
onPageChange={page => setPage(page)}
97+
onPageChange={(page) => setPage(page)}
10098
label={`${from + 1}-${to} of ${sortedItems.length}`}
10199
/>
102100
</DataTable>

example/src/Examples/DividerExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const DividerExample = () => {
1313
<FlatList
1414
style={{ backgroundColor: background }}
1515
renderItem={({ item }) => <List.Item title={item} />}
16-
keyExtractor={item => item}
16+
keyExtractor={(item) => item}
1717
ItemSeparatorComponent={Divider}
1818
data={items}
1919
/>

example/src/Examples/ListAccordionExample.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ const ListAccordionExample = () => {
1717
<ScrollView style={[styles.container, { backgroundColor: background }]}>
1818
<List.Section title="Expandable list item">
1919
<List.Accordion
20-
left={props => <List.Icon {...props} icon="folder" />}
20+
left={(props) => <List.Icon {...props} icon="folder" />}
2121
title="Expandable list item"
2222
>
2323
<List.Item title="List item 1" />
2424
<List.Item title="List item 2" />
2525
</List.Accordion>
2626
<List.Accordion
27-
left={props => <List.Icon {...props} icon="folder" />}
27+
left={(props) => <List.Icon {...props} icon="folder" />}
2828
title="Start expanded"
2929
expanded={expanded}
3030
onPress={_handlePress}
@@ -45,15 +45,15 @@ const ListAccordionExample = () => {
4545
<Divider />
4646
<List.Section title="Expandable list with icons">
4747
<List.Accordion
48-
left={props => <List.Icon {...props} icon="star" />}
48+
left={(props) => <List.Icon {...props} icon="star" />}
4949
title="Accordion item 1"
5050
>
5151
<List.Item
52-
left={props => <List.Icon {...props} icon="thumb-up" />}
52+
left={(props) => <List.Icon {...props} icon="thumb-up" />}
5353
title="List item 1"
5454
/>
5555
<List.Item
56-
left={props => <List.Icon {...props} icon="thumb-down" />}
56+
left={(props) => <List.Icon {...props} icon="thumb-down" />}
5757
title="List item 2"
5858
/>
5959
</List.Accordion>

example/src/Examples/ListAccordionGroupExample.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ const ListAccordionGroupExample = () => {
2121
<List.AccordionGroup>
2222
<List.Section title="Uncontrolled Accordion Group example">
2323
<List.Accordion
24-
left={props => <List.Icon {...props} icon="folder" />}
24+
left={(props) => <List.Icon {...props} icon="folder" />}
2525
title="Expandable list item"
2626
id="1"
2727
>
2828
<List.Item title="List item 1" />
2929
<List.Item title="List item 2" />
3030
</List.Accordion>
3131
<List.Accordion
32-
left={props => <List.Icon {...props} icon="folder" />}
32+
left={(props) => <List.Icon {...props} icon="folder" />}
3333
title="Expandable list item 2"
3434
id="2"
3535
>
3636
<List.Item title="List item 1" />
3737
</List.Accordion>
3838
<List.Accordion
39-
left={props => <List.Icon {...props} icon="folder" />}
39+
left={(props) => <List.Icon {...props} icon="folder" />}
4040
title="Expandable list item 2"
4141
id="3"
4242
>
@@ -50,22 +50,22 @@ const ListAccordionGroupExample = () => {
5050
>
5151
<List.Section title="Controlled Accordion Group example">
5252
<List.Accordion
53-
left={props => <List.Icon {...props} icon="folder" />}
53+
left={(props) => <List.Icon {...props} icon="folder" />}
5454
title="Expandable list item"
5555
id="1"
5656
>
5757
<List.Item title="List item 1" />
5858
<List.Item title="List item 2" />
5959
</List.Accordion>
6060
<List.Accordion
61-
left={props => <List.Icon {...props} icon="folder" />}
61+
left={(props) => <List.Icon {...props} icon="folder" />}
6262
title="Expandable list item 2"
6363
id="2"
6464
>
6565
<List.Item title="List item 1" />
6666
</List.Accordion>
6767
<List.Accordion
68-
left={props => <List.Icon {...props} icon="folder" />}
68+
left={(props) => <List.Icon {...props} icon="folder" />}
6969
title="Expandable list item 2"
7070
id="3"
7171
>

example/src/Examples/ListSectionExample.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ const ListSectionExample = () => {
1212
<List.Section>
1313
<List.Subheader>Single line</List.Subheader>
1414
<List.Item
15-
left={props => <List.Icon {...props} icon="calendar" />}
15+
left={(props) => <List.Icon {...props} icon="calendar" />}
1616
title="List item 1"
1717
/>
1818
<List.Item
19-
left={props => <List.Icon {...props} icon="wallet-giftcard" />}
19+
left={(props) => <List.Icon {...props} icon="wallet-giftcard" />}
2020
title="List item 2"
2121
/>
2222
<List.Item
2323
title="List item 3"
24-
left={props => <List.Icon {...props} icon="folder" />}
25-
right={props => <List.Icon {...props} icon="equal" />}
24+
left={(props) => <List.Icon {...props} icon="folder" />}
25+
right={(props) => <List.Icon {...props} icon="equal" />}
2626
/>
2727
</List.Section>
2828
<Divider />
@@ -45,7 +45,7 @@ const ListSectionExample = () => {
4545
style={styles.image}
4646
/>
4747
)}
48-
right={props => <List.Icon {...props} icon="information" />}
48+
right={(props) => <List.Icon {...props} icon="information" />}
4949
title="List item 2"
5050
description="Describes item 2"
5151
/>
@@ -70,7 +70,7 @@ const ListSectionExample = () => {
7070
style={styles.image}
7171
/>
7272
)}
73-
right={props => <List.Icon {...props} icon="star-outline" />}
73+
right={(props) => <List.Icon {...props} icon="star-outline" />}
7474
title="List item 2"
7575
description="Describes item 2. Example of a very very long description."
7676
/>
@@ -85,7 +85,7 @@ const ListSectionExample = () => {
8585
style={styles.image}
8686
/>
8787
)}
88-
right={props => <List.Icon {...props} icon="star-outline" />}
88+
right={(props) => <List.Icon {...props} icon="star-outline" />}
8989
title="List Item 1"
9090
description={({
9191
ellipsizeMode,

example/src/Examples/SurfaceExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const SurfaceExample = () => {
1212
style={[styles.container, { backgroundColor: background }]}
1313
contentContainerStyle={styles.content}
1414
>
15-
{[1, 2, 4, 6, 12].map(i => (
15+
{[1, 2, 4, 6, 12].map((i) => (
1616
<Surface key={i} style={[styles.surface, { elevation: i }]}>
1717
<Text>{i}</Text>
1818
</Surface>

0 commit comments

Comments
 (0)