Skip to content

Commit d64a486

Browse files
committed
style: apply Prettier formatting
Apply consistent formatting across source files following updated ESLint React 18 configuration. Refs inveniosoftware/rfcs#112
1 parent a1a70c9 commit d64a486

46 files changed

Lines changed: 399 additions & 106 deletions

Some content is hidden

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

src/demos/App.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,26 @@
77
*/
88

99
import { Component } from "react";
10-
import { Button, Container, Divider, Header, Menu, Segment } from "semantic-ui-react";
10+
import {
11+
Button,
12+
Container,
13+
Divider,
14+
Header,
15+
Menu,
16+
Segment,
17+
} from "semantic-ui-react";
1118
import { CERNVideosReactSearchKit } from "./cern-videos";
1219
import NamespacedExample from "./cern-videos-namespaced/app";
1320
import { OSReactSearchKit } from "./opensearch";
1421
import { ZenodoReactSearchKit } from "./zenodo";
1522

1623
const demos = {
17-
"os2": {
24+
os2: {
1825
label: "OpenSearch 2",
1926
text: "You Know, for Search",
2027
cmp: <OSReactSearchKit />,
2128
},
22-
"zenodo": {
29+
zenodo: {
2330
label: "zenodo.org",
2431
text: "(All) Research. Shared.",
2532
cmp: <ZenodoReactSearchKit />,
@@ -29,7 +36,7 @@ const demos = {
2936
text: "The CERN official platform for videos.",
3037
cmp: <CERNVideosReactSearchKit />,
3138
},
32-
"namespaced_example": {
39+
namespaced_example: {
3340
label: "video.cern.ch namespaced",
3441
text: "Example of multiple React-SearchKit instances rendered at same time, namespaced by their appName, with different overridden components.",
3542
cmp: <NamespacedExample />,
@@ -108,7 +115,8 @@ export default class App extends Component {
108115
{links}
109116
</Container>
110117
);
111-
const cmp = activeDemo && activeDemo in demos ? demos[activeDemo].cmp : defaultCmp;
118+
const cmp =
119+
activeDemo && activeDemo in demos ? demos[activeDemo].cmp : defaultCmp;
112120

113121
return <Container>{cmp}</Container>;
114122
};

src/demos/cern-videos-namespaced/Results.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export class Results extends Component {
4242
<Grid.Column width={8}>
4343
<span style={({ marginLeft: "0.5em" }, { marginRight: "0.5em" })}>
4444
<Count label={(cmp) => <> Found {cmp} results</>} />
45-
<Sort values={this.sortValues} label={(cmp) => <> sorted by {cmp}</>} />
45+
<Sort
46+
values={this.sortValues}
47+
label={(cmp) => <> sorted by {cmp}</>}
48+
/>
4649
</span>
4750
</Grid.Column>
4851
<Grid.Column width={8} textAlign="right">

src/demos/cern-videos-namespaced/cern-videos-2/App.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ export const App = () => (
7676
<ResultsLoader>
7777
<EmptyResults />
7878
<Error />
79-
<OnResults sortValues={sortValues} resultsPerPageValues={resultsPerPageValues} />
79+
<OnResults
80+
sortValues={sortValues}
81+
resultsPerPageValues={resultsPerPageValues}
82+
/>
8083
</ResultsLoader>
8184
</ReactSearchKit>
8285
);

src/demos/cern-videos-namespaced/cern-videos-3/App.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ export const App = () => (
7676
<ResultsLoader>
7777
<EmptyResults />
7878
<Error />
79-
<OnResults sortValues={sortValues} resultsPerPageValues={resultsPerPageValues} />
79+
<OnResults
80+
sortValues={sortValues}
81+
resultsPerPageValues={resultsPerPageValues}
82+
/>
8083
</ResultsLoader>
8184
</ReactSearchKit>
8285
);

src/demos/cern-videos/App.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import _truncate from "lodash/truncate";
1010
import PropTypes from "prop-types";
1111
import { Component } from "react";
1212
import { OverridableContext } from "react-overridable";
13-
import { Accordion, Card, Container, Grid, Image, Item, Menu } from "semantic-ui-react";
13+
import {
14+
Accordion,
15+
Card,
16+
Container,
17+
Grid,
18+
Image,
19+
Item,
20+
Menu,
21+
} from "semantic-ui-react";
1422
import { InvenioSearchApi } from "../../lib/api/contrib/invenio";
1523
import {
1624
BucketAggregation,
@@ -74,7 +82,10 @@ const CERNVideosResultsListItem = ({ result, index }) => {
7482
const metadata = result.metadata;
7583
return (
7684
<Item key={index} href={`#${metadata.recid}`}>
77-
<Item.Image size="small" src={result.imageSrc || "https://placehold.co/200"} />
85+
<Item.Image
86+
size="small"
87+
src={result.imageSrc || "https://placehold.co/200"}
88+
/>
7889
<Item.Content>
7990
<Item.Header>{metadata.title.title}</Item.Header>
8091
<Item.Description>

src/demos/cern-videos/Results.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export class Results extends Component {
4242
<Grid.Column width={8}>
4343
<span style={({ marginLeft: "0.5em" }, { marginRight: "0.5em" })}>
4444
<Count label={(cmp) => <> Found {cmp} results</>} />
45-
<Sort values={this.sortValues} label={(cmp) => <> sorted by {cmp}</>} />
45+
<Sort
46+
values={this.sortValues}
47+
label={(cmp) => <> sorted by {cmp}</>}
48+
/>
4649
</span>
4750
</Grid.Column>
4851
<Grid.Column width={8} textAlign="right">

src/demos/opensearch/App.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,16 @@ const initialState = {
5252
size: 10,
5353
};
5454

55-
const customAggValuesContainerCmp = (valuesCmp) => <Menu.Menu>{valuesCmp}</Menu.Menu>;
55+
const customAggValuesContainerCmp = (valuesCmp) => (
56+
<Menu.Menu>{valuesCmp}</Menu.Menu>
57+
);
5658

57-
const customAggValueCmp = (bucket, isSelected, onFilterClicked, getChildAggCmps) => {
59+
const customAggValueCmp = (
60+
bucket,
61+
isSelected,
62+
onFilterClicked,
63+
getChildAggCmps
64+
) => {
5865
const childAggCmps = getChildAggCmps(bucket);
5966
return (
6067
<Menu.Item
@@ -82,7 +89,11 @@ class Tags extends Component {
8289
const { tags } = this.props;
8390
return tags.map((tag, index) => (
8491
// eslint-disable-next-line react/no-array-index-key
85-
<Button key={index} size="mini" onClick={(event) => this.onClick(event, tag)}>
92+
<Button
93+
key={index}
94+
size="mini"
95+
onClick={(event) => this.onClick(event, tag)}
96+
>
8697
{tag}
8798
</Button>
8899
));
@@ -96,12 +107,17 @@ Tags.propTypes = {
96107
const OpenSearchResultsListItem = ({ result, index }) => {
97108
return (
98109
<Item key={index} href="#">
99-
<Item.Image size="small" src={result.picture || "https://placehold.co/200"} />
110+
<Item.Image
111+
size="small"
112+
src={result.picture || "https://placehold.co/200"}
113+
/>
100114
<Item.Content>
101115
<Item.Header>
102116
{result.first_name} {result.last_name}
103117
</Item.Header>
104-
<Item.Description>{_truncate(result.about, { length: 200 })}</Item.Description>
118+
<Item.Description>
119+
{_truncate(result.about, { length: 200 })}
120+
</Item.Description>
105121
<Item.Extra>
106122
<Tags tags={result.tags} />
107123
</Item.Extra>
@@ -123,7 +139,9 @@ const OpenSearchResultsGridItem = ({ result, index }) => {
123139
<Card.Header>
124140
{result.first_name} {result.last_name}
125141
</Card.Header>
126-
<Card.Description>{_truncate(result.about, { length: 200 })}</Card.Description>
142+
<Card.Description>
143+
{_truncate(result.about, { length: 200 })}
144+
</Card.Description>
127145
</Card.Content>
128146
<Card.Content extra>
129147
<Tags tags={result.tags} />

src/demos/zenodo/App.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import _truncate from "lodash/truncate";
1010
import PropTypes from "prop-types";
1111
import { Component } from "react";
1212
import { OverridableContext } from "react-overridable";
13-
import { Accordion, Card, Container, Grid, Image, Item, Menu } from "semantic-ui-react";
13+
import {
14+
Accordion,
15+
Card,
16+
Container,
17+
Grid,
18+
Image,
19+
Item,
20+
Menu,
21+
} from "semantic-ui-react";
1422
import { InvenioSearchApi } from "../../lib/api/contrib/invenio";
1523
import {
1624
BucketAggregation,
@@ -88,7 +96,10 @@ export const ZenodoResultsListItem = ({ result, index }) => {
8896
const metadata = result.metadata;
8997
return (
9098
<Item key={index} href="#">
91-
<Item.Image size="small" src={result.imageSrc || "https://placehold.co/200"} />
99+
<Item.Image
100+
size="small"
101+
src={result.imageSrc || "https://placehold.co/200"}
102+
/>
92103
<Item.Content>
93104
<Item.Header>{metadata.title}</Item.Header>
94105
<Item.Description>

src/demos/zenodo/Results.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ export class Results extends Component {
4242
<Grid.Column width={8}>
4343
<span style={({ marginLeft: "0.5em" }, { marginRight: "0.5em" })}>
4444
<Count label={(cmp) => <>Found {cmp} results</>} />
45-
<Sort values={this.sortValues} label={(cmp) => <> sorted by {cmp}</>} />
45+
<Sort
46+
values={this.sortValues}
47+
label={(cmp) => <> sorted by {cmp}</>}
48+
/>
4649
</span>
4750
</Grid.Column>
4851
<Grid.Column width={8} textAlign="right">

src/lib/api/UrlHandlerApi.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ export class UrlHandlerApi {
8282
hiddenParams: "hp",
8383
};
8484

85-
this.keepHistory = config.keepHistory !== undefined ? config.keepHistory : true;
85+
this.keepHistory =
86+
config.keepHistory !== undefined ? config.keepHistory : true;
8687
if (!_isBoolean(this.keepHistory)) {
8788
throw new Error(
8889
`"keepHistory configuration must be a boolean, ${this.keepHistory} provided.`
@@ -97,7 +98,8 @@ export class UrlHandlerApi {
9798
);
9899
}
99100

100-
this.urlParamValidator = config.urlParamValidator || new UrlParamValidator();
101+
this.urlParamValidator =
102+
config.urlParamValidator || new UrlParamValidator();
101103
this.urlParser = config.urlParser || new UrlParser();
102104
this.urlParser.urlParamsMapping = this.urlParamsMapping;
103105

@@ -133,7 +135,10 @@ export class UrlHandlerApi {
133135
.filter((stateKey) => stateKey in this.urlParamsMapping)
134136
.filter((stateKey) => {
135137
// filter out negative or null values
136-
if ((stateKey === "page" || stateKey === "size") && queryState[stateKey] <= 0) {
138+
if (
139+
(stateKey === "page" || stateKey === "size") &&
140+
queryState[stateKey] <= 0
141+
) {
137142
return false;
138143
}
139144
if (stateKey === "hiddenParams") {
@@ -203,7 +208,13 @@ export class UrlHandlerApi {
203208
const result = {};
204209
Object.keys(urlParamsObj).forEach((paramKey) => {
205210
const queryStateKey = this.fromUrlParamsMapping[paramKey];
206-
if (this.urlParamValidator.isValid(this, queryStateKey, urlParamsObj[paramKey])) {
211+
if (
212+
this.urlParamValidator.isValid(
213+
this,
214+
queryStateKey,
215+
urlParamsObj[paramKey]
216+
)
217+
) {
207218
result[queryStateKey] = urlParamsObj[paramKey];
208219
// custom transformation for filters
209220
if (queryStateKey === "filters") {

0 commit comments

Comments
 (0)