Skip to content

Commit 971247a

Browse files
committed
Prettify
1 parent f8b7bdc commit 971247a

Some content is hidden

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

75 files changed

+299
-267
lines changed

.changeset/getChangelogEntry.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ const { getInfo } = require('@changesets/get-github-info');
44
const getReleaseLine = async (changeset, type) => {
55
const [firstLine, ...futureLines] = changeset.summary
66
.split('\n')
7-
.map(l => l.trimRight());
7+
.map((l) => l.trimRight());
88
let { links } = await getInfo({
99
repo: 'JedWatson/react-select',
1010
commit: changeset.commit,
1111
});
1212
return `- ${links.commit}${links.pull === null ? '' : ` ${links.pull}`}${
1313
links.user === null ? '' : ` Thanks ${links.user}!`
14-
} - ${firstLine}\n${futureLines.map(l => ` ${l}`).join('\n')}`;
14+
} - ${firstLine}\n${futureLines.map((l) => ` ${l}`).join('\n')}`;
1515
};
1616

1717
const getDependencyReleaseLine = async (changesets, dependenciesUpdated) => {
1818
if (dependenciesUpdated.length === 0) return '';
1919

2020
const changesetLinks = changesets.map(
21-
changeset => `- Updated dependencies [${changeset.commit}]:`
21+
(changeset) => `- Updated dependencies [${changeset.commit}]:`
2222
);
2323

2424
const updatedDepenenciesList = dependenciesUpdated.map(
25-
dependency => ` - ${dependency.name}@${dependency.version}`
25+
(dependency) => ` - ${dependency.name}@${dependency.version}`
2626
);
2727

2828
return [...changesetLinks, ...updatedDepenenciesList].join('\n');

.codesandbox/ci.json

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
2-
31
{
42
"buildCommand": "build",
53
"packages": ["packages/*"],
64
"sandboxes": ["nfmxw"]
75
}
8-

.coveralls.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
service-name: travis-ci
2-
repo_token: itdMRdBNgDK8Gb5nIA63zVMEryaxTQxkR
2+
repo_token: itdMRdBNgDK8Gb5nIA63zVMEryaxTQxkR

.github/CONTRIBUTING.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ welcome, from issue reports to PRs and documentation / write-ups.
55

66
Before you open a PR:
77

8-
* In development, run `yarn start` to build (+watch) the project source, and run
9-
the [development server](http://localhost:8000).
10-
* Please ensure all the examples work correctly after your change. If you're
11-
adding a major new use-case, add a new example demonstrating its use.
12-
* Be careful to follow the code style of the project. Run `yarn lint` after
13-
your changes and ensure you do not introduce any new errors or warnings.
14-
* This repository uses TypeScript, please run `yarn type-check` after your changes to ensure
15-
that you do not introduce any new type errors.
8+
- In development, run `yarn start` to build (+watch) the project source, and run
9+
the [development server](http://localhost:8000).
10+
- Please ensure all the examples work correctly after your change. If you're
11+
adding a major new use-case, add a new example demonstrating its use.
12+
- Be careful to follow the code style of the project. Run `yarn lint` after
13+
your changes and ensure you do not introduce any new errors or warnings.
14+
- This repository uses TypeScript, please run `yarn type-check` after your changes to ensure
15+
that you do not introduce any new type errors.
1616

17-
* Ensure that your effort is aligned with the project's roadmap by talking to
18-
the maintainers, especially if you are going to spend a lot of time on it.
19-
* Make sure there's an issue open for any work you take on and intend to submit
20-
as a pull request - it helps core members review your concept and direction
21-
early and is a good way to discuss what you're planning to do.
22-
* If you open an issue and are interested in working on a fix, please let us
23-
know. We'll help you get started, rather than adding it to the queue.
24-
* Make sure you do not add regressions by running `yarn test`.
25-
* Where possible, include tests with your changes, either that demonstrates the
26-
bug, or tests the new functionality. If you're not sure how to test your
27-
changes, feel free to ping @gwyneplaine or @JedWatson
28-
* Run `yarn coveralls` to check that the coverage hasn't dropped, and look at the
29-
report (under the generated `coverage` directory) to check that your changes are
30-
covered
17+
- Ensure that your effort is aligned with the project's roadmap by talking to
18+
the maintainers, especially if you are going to spend a lot of time on it.
19+
- Make sure there's an issue open for any work you take on and intend to submit
20+
as a pull request - it helps core members review your concept and direction
21+
early and is a good way to discuss what you're planning to do.
22+
- If you open an issue and are interested in working on a fix, please let us
23+
know. We'll help you get started, rather than adding it to the queue.
24+
- Make sure you do not add regressions by running `yarn test`.
25+
- Where possible, include tests with your changes, either that demonstrates the
26+
bug, or tests the new functionality. If you're not sure how to test your
27+
changes, feel free to ping @gwyneplaine or @JedWatson
28+
- Run `yarn coveralls` to check that the coverage hasn't dropped, and look at the
29+
report (under the generated `coverage` directory) to check that your changes are
30+
covered

.github/ISSUE_TEMPLATE.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
Before creating an issue...
44

55
# Are you asking a question?
6-
Please don't file GitHub issues to ask questions. Use Stack Overflow with a [#react-select](http://stackoverflow.com/questions/tagged/react-select) tag.
76

7+
Please don't file GitHub issues to ask questions. Use Stack Overflow with a [#react-select](http://stackoverflow.com/questions/tagged/react-select) tag.
88

99
# Are you reporting a bug or runtime error?
10+
1011
Please include a test case that demonstrates the issue you're reporting!
1112

1213
This is very helpful to maintainers in order to help us see the issue you're seeing.
@@ -26,10 +27,10 @@ https://codesandbox.io/s/n34mq0743j
2627

2728
You may also find the [online Babel tool](https://babeljs.io/repl/) quite helpful if you wish to use ES6/ES7 syntax not yet supported by the browser you are using.
2829

29-
3030
# Are you making a feature request?
31+
3132
Provide as much information as possible about your requested feature. Here are a few questions you may consider answering:
3233

33-
* What's your use case? (Tell us about your application and what problem you're trying to solve.)
34-
* What interface do you have in mind? (What new properties or methods do you think might be helpful?)
35-
* Can you point to similar functionality with any existing libraries or components? (Working demos can be helpful.)
34+
- What's your use case? (Tell us about your application and what problem you're trying to solve.)
35+
- What interface do you have in mind? (What new properties or methods do you think might be helpful?)
36+
- Can you point to similar functionality with any existing libraries or components? (Working demos can be helpful.)

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Checkout Repo
1414
uses: actions/checkout@master
1515
with:
16-
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
16+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
1717
fetch-depth: 0
1818

1919
- name: Setup Node.js 10.x

CONTRIBUTING.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ welcome, from issue reports to PRs and documentation / write-ups.
55

66
Before you open a PR:
77

8-
* In development, run `yarn start` to build (and watch) the project source, and run
9-
the [development server](http://localhost:8000).
10-
* Please ensure all the examples work correctly after your change. If you're
11-
adding a major new use-case, add a new example `/docs/examples` and subsequent documentation demonstrating its use `/docs/pages`.
12-
* Ensure that your effort is aligned with the project's roadmap by talking to
13-
the maintainers, especially if you are going to spend a lot of time on it.
14-
* Make sure there's an issue open for any work you take on and intend to submit
15-
as a pull request - it helps core members review your concept and direction
16-
early and is a good way to discuss what you're planning to do.
17-
* If you open an issue and are interested in working on a fix, please let us
18-
know. We'll help you get started, rather than inadvertently doubling up on your hard work.
19-
* Make sure you do not add regressions by running `yarn test`.
20-
* Where possible, include tests with your changes, either that demonstrates the
21-
bug, or tests the new functionality. If you're not sure how to test your
22-
changes, feel free to ping @gwyneplaine
23-
* Please [follow our established coding conventions](https://github.com/keystonejs/keystone/wiki/Coding-Standards)
24-
(with regards to formatting, etc)
25-
* All new features and changes need documentation.
8+
- In development, run `yarn start` to build (and watch) the project source, and run
9+
the [development server](http://localhost:8000).
10+
- Please ensure all the examples work correctly after your change. If you're
11+
adding a major new use-case, add a new example `/docs/examples` and subsequent documentation demonstrating its use `/docs/pages`.
12+
- Ensure that your effort is aligned with the project's roadmap by talking to
13+
the maintainers, especially if you are going to spend a lot of time on it.
14+
- Make sure there's an issue open for any work you take on and intend to submit
15+
as a pull request - it helps core members review your concept and direction
16+
early and is a good way to discuss what you're planning to do.
17+
- If you open an issue and are interested in working on a fix, please let us
18+
know. We'll help you get started, rather than inadvertently doubling up on your hard work.
19+
- Make sure you do not add regressions by running `yarn test`.
20+
- Where possible, include tests with your changes, either that demonstrates the
21+
bug, or tests the new functionality. If you're not sure how to test your
22+
changes, feel free to ping @gwyneplaine
23+
- Please [follow our established coding conventions](https://github.com/keystonejs/keystone/wiki/Coding-Standards)
24+
(with regards to formatting, etc)
25+
- All new features and changes need documentation.

README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ yarn add react-select
3636
```
3737

3838
Then use it in your app:
39+
3940
#### With React Component
41+
4042
```js
4143
import React from 'react';
4244
import Select from 'react-select';
@@ -51,10 +53,9 @@ class App extends React.Component {
5153
state = {
5254
selectedOption: null,
5355
};
54-
handleChange = selectedOption => {
55-
this.setState(
56-
{ selectedOption },
57-
() => console.log(`Option selected:`, this.state.selectedOption)
56+
handleChange = (selectedOption) => {
57+
this.setState({ selectedOption }, () =>
58+
console.log(`Option selected:`, this.state.selectedOption)
5859
);
5960
};
6061
render() {
@@ -72,9 +73,10 @@ class App extends React.Component {
7273
```
7374

7475
#### With React Hooks
76+
7577
```js
76-
import React, { useState } from "react";
77-
import Select from "react-select";
78+
import React, { useState } from 'react';
79+
import Select from 'react-select';
7880

7981
const options = [
8082
{ value: 'chocolate', label: 'Chocolate' },
@@ -84,7 +86,7 @@ const options = [
8486

8587
export default function App() {
8688
const [selectedOption, setSelectedOption] = useState(null);
87-
89+
8890
return (
8991
<div className="App">
9092
<Select

cypress/integration/multi-select.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Multi Select', () => {
2020
for (let config of setup) {
2121
const { viewport } = config;
2222
it(`Should display several default values that can be removed in view: ${viewport}`, () => {
23-
cy.get(selector.multiSelectDefaultValues).then(function($defaultValue) {
23+
cy.get(selector.multiSelectDefaultValues).then(function ($defaultValue) {
2424
expect($defaultValue).to.have.length(2);
2525
expect($defaultValue.eq(0)).to.contain('Purple');
2626
expect($defaultValue.eq(1)).to.contain('Red');
@@ -29,7 +29,7 @@ describe('Multi Select', () => {
2929
cy.get(selector.firstMultiValueRemove)
3030
.click()
3131
.get(selector.multiSelectDefaultValues)
32-
.then(function($defaultValue) {
32+
.then(function ($defaultValue) {
3333
expect($defaultValue).to.have.length(1);
3434
expect($defaultValue.eq(0)).to.contain('Red');
3535
})
@@ -42,7 +42,7 @@ describe('Multi Select', () => {
4242
.click()
4343
.type('{backspace}', { force: true })
4444
.get(selector.multiSelectDefaultValues)
45-
.then(function($defaultValue) {
45+
.then(function ($defaultValue) {
4646
expect($defaultValue).to.have.length(1);
4747
expect($defaultValue.eq(0)).to.contain('Purple');
4848
})
@@ -74,7 +74,7 @@ describe('Multi Select', () => {
7474
.type('Slate', { force: true })
7575
.type('{enter}', { force: true })
7676
.get(selector.multiSelectDefaultValues)
77-
.then(function($defaultValue) {
77+
.then(function ($defaultValue) {
7878
expect($defaultValue).to.have.length(5);
7979
expect($defaultValue.eq(0)).to.contain('Purple');
8080
expect($defaultValue.eq(1)).to.contain('Red');

docs/App/Header.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ const headerSelectStyles: StylesConfig<Change, boolean> = {
6666
borderColor: 'rgba(0,0,0,0.2)',
6767
},
6868
}),
69-
option: base => ({
69+
option: (base) => ({
7070
...base,
7171
padding: '4px 12px',
7272
}),
73-
placeholder: base => ({
73+
placeholder: (base) => ({
7474
...base,
7575
color: 'black',
7676
}),
@@ -125,20 +125,20 @@ class Header extends Component<RouteComponentProps, HeaderState> {
125125
}
126126
getStarCount = () => {
127127
fetch(apiUrl)
128-
.then(res => res.json())
129-
.then(data => {
128+
.then((res) => res.json())
129+
.then((data) => {
130130
const stars = data.stargazers_count;
131131
this.setState({ stars });
132132
})
133-
.catch(err => {
133+
.catch((err) => {
134134
console.error('Error retrieving data', err);
135135
});
136136
};
137137
isHome = (props = this.props) => {
138138
const valid = ['/', '/home'];
139139
return valid.includes(props.location.pathname);
140140
};
141-
setContentRef: RefCallback<HTMLDivElement> = ref => {
141+
setContentRef: RefCallback<HTMLDivElement> = (ref) => {
142142
if (!ref) return;
143143
this.content = ref;
144144
};
@@ -181,7 +181,7 @@ class Header extends Component<RouteComponentProps, HeaderState> {
181181
</h1>
182182
<Content
183183
stars={stars}
184-
onChange={opt => {
184+
onChange={(opt) => {
185185
history.push(opt.value);
186186
}}
187187
/>
@@ -263,7 +263,7 @@ const Content = ({ onChange, stars }: ContentProps) => (
263263
formatOptionLabel={getLabel}
264264
isSearchable={false}
265265
options={changes}
266-
onChange={option => {
266+
onChange={(option) => {
267267
if (option && !isArray(option)) {
268268
onChange(option);
269269
}

docs/App/PageNav.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const NavSection: FunctionComponent<RouteComponentProps> = () => {
2020
const routeKeys = Object.keys(routes);
2121
return (
2222
<Switch>
23-
{routeKeys.map(r => (
24-
<Route key={r} path={r} render={p => <PageNav {...p} />} />
23+
{routeKeys.map((r) => (
24+
<Route key={r} path={r} render={(p) => <PageNav {...p} />} />
2525
))}
2626
</Switch>
2727
);
@@ -56,7 +56,7 @@ class PageNav extends Component<RouteComponentProps, NavState> {
5656
this.setState({ activeId });
5757
}
5858
};
59-
getScrollSpy: RefCallback<ScrollSpy> = ref => {
59+
getScrollSpy: RefCallback<ScrollSpy> = (ref) => {
6060
if (!ref) return;
6161
this.scrollSpy = ref;
6262
};
@@ -85,7 +85,7 @@ class PageNav extends Component<RouteComponentProps, NavState> {
8585
<Sticky preserveHeight={isSmallDevice}>
8686
<ScrollSpy ref={this.getScrollSpy} onChange={this.getSelected}>
8787
<Nav>
88-
{links.map(l => {
88+
{links.map((l) => {
8989
const hash = l.path.slice(1);
9090
const selected = hash === activeId;
9191

@@ -95,7 +95,7 @@ class PageNav extends Component<RouteComponentProps, NavState> {
9595
key={hash}
9696
selected={selected}
9797
level={l.level}
98-
onClick={event => {
98+
onClick={(event) => {
9999
this.handleItemClick({ event, hash });
100100
}}
101101
>

docs/App/ScrollSpy.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ export default class ScrollSpy extends Component<Props, State> {
4545
const { elements } = this.state;
4646
if (!elements.length) return;
4747

48-
const idsInView = elements.filter(isInView).map(i => i.getAttribute('id'));
48+
const idsInView = elements
49+
.filter(isInView)
50+
.map((i) => i.getAttribute('id'));
4951
if (idsInView.length) {
5052
onChange(idsInView);
5153
}
5254
});
53-
getElements: RefCallback<HTMLElement> = ref => {
55+
getElements: RefCallback<HTMLElement> = (ref) => {
5456
if (!ref) return;
5557
this.nav = ref;
5658
};
@@ -59,7 +61,7 @@ export default class ScrollSpy extends Component<Props, State> {
5961

6062
const anchorList = this.nav.querySelectorAll<HTMLElement>('[data-hash]');
6163
const elements = Array.from(anchorList).map(
62-
i => document.querySelector<HTMLElement>(`#${i.dataset.hash}`)!
64+
(i) => document.querySelector<HTMLElement>(`#${i.dataset.hash}`)!
6365
);
6466

6567
this.setState({ elements });

docs/App/Section.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const Section: FunctionComponent<RouteComponentProps> = () => {
77
const routeKeys = Object.keys(routes);
88
return (
99
<Switch>
10-
{routeKeys.map(r => (
11-
<Route key={r} path={r} render={p => <Content {...p} />} />
10+
{routeKeys.map((r) => (
11+
<Route key={r} path={r} render={(p) => <Content {...p} />} />
1212
))}
1313
<Redirect from="/" to="/home" />
1414
</Switch>

docs/App/Sticky.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ export default class Sticky extends Component<Props, State> {
5656
this.setState({ overScroll: 0 });
5757
}
5858
});
59-
getOuterEl: RefCallback<HTMLDivElement> = ref => {
59+
getOuterEl: RefCallback<HTMLDivElement> = (ref) => {
6060
if (!ref) return;
6161

6262
this.outerEl = ref;
6363
};
64-
getInnerEl: RefCallback<HTMLDivElement> = ref => {
64+
getInnerEl: RefCallback<HTMLDivElement> = (ref) => {
6565
if (!ref) return;
6666

6767
this.innerEl = ref;

0 commit comments

Comments
 (0)