Skip to content
This repository was archived by the owner on Aug 3, 2023. It is now read-only.

Commit a61c123

Browse files
authored
Merge pull request #135 from jamesplease/bug-fixies
Add ESLint rule to catch unused variable use
2 parents 8b0c812 + 8fe517d commit a61c123

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"rules": {
1212
"no-unused-vars": "error",
13+
"no-use-before-define": "error",
1314
"react/jsx-uses-react": "error",
1415
"react/jsx-uses-vars": "error"
1516
},

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
### v2.0.2 (2018/2/21)
4+
5+
**Bug Fixes**
6+
7+
* Fixes a bug where an Uncaught ReferenceError could be thrown
8+
39
### v2.0.1 (2018/2/17)
410

511
**Bug Fixes**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-request",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"description": "Declarative HTTP requests with React.",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/fetch.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,21 @@ export class Fetch extends React.Component {
179179
const uppercaseMethod = method.toUpperCase();
180180
const shouldCacheResponse = this.shouldCacheResponse();
181181

182+
const init = {
183+
body,
184+
credentials,
185+
headers,
186+
method: uppercaseMethod,
187+
mode,
188+
cache,
189+
redirect,
190+
referrer,
191+
referrerPolicy,
192+
integrity,
193+
keepalive,
194+
signal
195+
};
196+
182197
const responseReceivedInfo = {
183198
url,
184199
init,
@@ -221,20 +236,6 @@ export class Fetch extends React.Component {
221236
return Promise.resolve(cacheError);
222237
}
223238
}
224-
const init = {
225-
body,
226-
credentials,
227-
headers,
228-
method: uppercaseMethod,
229-
mode,
230-
cache,
231-
redirect,
232-
referrer,
233-
referrerPolicy,
234-
integrity,
235-
keepalive,
236-
signal
237-
};
238239

239240
this.setState({
240241
fetching: true,

0 commit comments

Comments
 (0)