Skip to content

Commit 9dc98fe

Browse files
committed
style(Eslint): Style code due eslint errors
1 parent 8421bfd commit 9dc98fe

File tree

12 files changed

+34
-23
lines changed

12 files changed

+34
-23
lines changed

.eslintrc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,25 @@
33
"parser": "babel-eslint",
44
"rules": {
55
"no-underscore-dangle": 0,
6-
"arrow-body-style": 0
6+
"arrow-body-style": 0,
7+
"arrow-parens": 0,
8+
"prefer-template": 0,
9+
"no-use-before-define": 0,
10+
"no-else-return": 0,
11+
"comma-dangle": ["error", {
12+
"arrays": "always-multiline",
13+
"objects": "always-multiline",
14+
"imports": "always-multiline",
15+
"exports": "always-multiline",
16+
"functions": "ignore",
17+
}],
18+
"no-plusplus": 0
719
},
820
"env": {
921
"mocha": true
22+
},
23+
"globals": {
24+
"fetch": true,
25+
"FormData": true
1026
}
1127
}

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,6 @@ Recommended modules
221221
==========
222222
- **[babel-plugin-transform-relay-hot](https://github.com/nodkz/babel-plugin-transform-relay-hot)** - Babel 6 plugin for transforming `Relay.QL` tagged templates via the GraphQL json schema file. Each time when schema file was changed, the wrapper updates instance of standard `babelRelayPlugin` with new schema without completely restarting dev server.
223223

224-
TODO
225-
====
226-
- [ ] Add support for graphql subscriptions. But firstly need [graphql-compose](https://github.com/nodkz/graphql-compose) for schema building, which is in heavy development right now (**planned for version 2.0.0**)
227-
- [ ] Add tests and cover by flowtype
228-
- [ ] Rewrite `batching` as middleware, keep in mind principles of how works [DataLoader](https://github.com/facebook/dataloader) via eventLoop (`process.nextTick()`) (**planned for version 2.0.0**)
229-
- [ ] Support `defer`, see [relay/issues/288](https://github.com/facebook/relay/issues/288)
230-
- [ ] Find brave peoples
231-
- who made fixes and remove misspelling and misunderstanding in readme.MD
232-
233224

234225
Contribute
235226
==========

src/fetchWrapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable no-use-before-define, no-else-return, prefer-const, no-param-reassign */
1+
/* eslint-disable no-param-reassign */
22

33
export default function fetchWrapper(reqFromRelay, middlewares) {
44
const fetchAfterAllWrappers = (req) => {
@@ -24,7 +24,7 @@ export default function fetchWrapper(reqFromRelay, middlewares) {
2424
console.warn('error parsing response json', e); // eslint-disable-line no-console
2525
res.json = {};
2626
return res;
27-
})
27+
}),
2828
);
2929
};
3030

src/formatRequestErrors.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable prefer-template */
2-
31
/**
42
* Formats an error response from GraphQL server request.
53
*/

src/middleware/defer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-unused-vars */
2+
13
export default function deferMiddleware(opts = {}) {
24
const middleware = next => req => next(req);
35

src/middleware/gqErrors.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable no-console no-use-before-define */
1+
/* eslint-disable no-console */
22

33
export default function gqErrorsMiddleware(opts = {}) {
44
const logger = opts.logger || console.error.bind(console);
@@ -48,10 +48,8 @@ export default function gqErrorsMiddleware(opts = {}) {
4848
displayErrors(batchItem.payload.errors, { query, req, res });
4949
}
5050
});
51-
} else {
52-
if (res.json.errors) {
53-
displayErrors(res.json.errors, { query, req, res });
54-
}
51+
} else if (res.json.errors) {
52+
displayErrors(res.json.errors, { query, req, res });
5553
}
5654
}
5755
return res;

src/middleware/retry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-console */
22

3-
const timeoutError = new Error("fetch timeout");
3+
const timeoutError = new Error('fetch timeout');
44

55
function isFunction(value) {
66
return !!(value && value.constructor && value.call && value.apply);

src/relay/_query.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ export function queryPre(relayRequest) {
2525

2626
export function queryPost(relayRequest, fetchPromise) {
2727
return fetchPromise.then(payload => {
28-
if (payload.hasOwnProperty('errors')) {
28+
if ({}.hasOwnProperty.call(payload, 'errors')) {
2929
const error = new Error(
3030
'Server request for query `' + relayRequest.getDebugName() + '` ' +
3131
'failed for the following reasons:\n\n' +
3232
formatRequestErrors(relayRequest, payload.errors)
3333
);
3434
error.source = payload;
3535
relayRequest.reject(error);
36-
} else if (!payload.hasOwnProperty('data')) {
36+
} else if (!{}.hasOwnProperty.call(payload, 'data')) {
3737
relayRequest.reject(new Error(
3838
'Server response was missing for query `' + relayRequest.getDebugName() +
3939
'`.'

src/relay/mutation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function mutation(relayRequest, fetchWithMiddleware) {
1818

1919
return fetchWithMiddleware(req)
2020
.then(payload => {
21-
if (payload.hasOwnProperty('errors')) {
21+
if ({}.hasOwnProperty.call(payload, 'errors')) {
2222
const error = new Error(
2323
'Server request for mutation `' + relayRequest.getDebugName() + '` ' +
2424
'failed for the following reasons:\n\n' +

src/utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable */
2+
13
export function isFunction(obj) {
24
return !!(obj && obj.constructor && obj.call && obj.apply);
35
}

0 commit comments

Comments
 (0)