Skip to content

Commit

Permalink
style(Eslint): Style code due eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Mar 4, 2017
1 parent 8421bfd commit 9dc98fe
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 23 deletions.
18 changes: 17 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@
"parser": "babel-eslint",
"rules": {
"no-underscore-dangle": 0,
"arrow-body-style": 0
"arrow-body-style": 0,
"arrow-parens": 0,
"prefer-template": 0,
"no-use-before-define": 0,
"no-else-return": 0,
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore",
}],
"no-plusplus": 0
},
"env": {
"mocha": true
},
"globals": {
"fetch": true,
"FormData": true
}
}
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,6 @@ Recommended modules
==========
- **[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.

TODO
====
- [ ] 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**)
- [ ] Add tests and cover by flowtype
- [ ] 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**)
- [ ] Support `defer`, see [relay/issues/288](https://github.com/facebook/relay/issues/288)
- [ ] Find brave peoples
- who made fixes and remove misspelling and misunderstanding in readme.MD


Contribute
==========
Expand Down
4 changes: 2 additions & 2 deletions src/fetchWrapper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-use-before-define, no-else-return, prefer-const, no-param-reassign */
/* eslint-disable no-param-reassign */

export default function fetchWrapper(reqFromRelay, middlewares) {
const fetchAfterAllWrappers = (req) => {
Expand All @@ -24,7 +24,7 @@ export default function fetchWrapper(reqFromRelay, middlewares) {
console.warn('error parsing response json', e); // eslint-disable-line no-console
res.json = {};
return res;
})
}),
);
};

Expand Down
2 changes: 0 additions & 2 deletions src/formatRequestErrors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable prefer-template */

/**
* Formats an error response from GraphQL server request.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/middleware/defer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-unused-vars */

export default function deferMiddleware(opts = {}) {
const middleware = next => req => next(req);

Expand Down
8 changes: 3 additions & 5 deletions src/middleware/gqErrors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-console no-use-before-define */
/* eslint-disable no-console */

export default function gqErrorsMiddleware(opts = {}) {
const logger = opts.logger || console.error.bind(console);
Expand Down Expand Up @@ -48,10 +48,8 @@ export default function gqErrorsMiddleware(opts = {}) {
displayErrors(batchItem.payload.errors, { query, req, res });
}
});
} else {
if (res.json.errors) {
displayErrors(res.json.errors, { query, req, res });
}
} else if (res.json.errors) {
displayErrors(res.json.errors, { query, req, res });
}
}
return res;
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/retry.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */

const timeoutError = new Error("fetch timeout");
const timeoutError = new Error('fetch timeout');

function isFunction(value) {
return !!(value && value.constructor && value.call && value.apply);
Expand Down
4 changes: 2 additions & 2 deletions src/relay/_query.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export function queryPre(relayRequest) {

export function queryPost(relayRequest, fetchPromise) {
return fetchPromise.then(payload => {
if (payload.hasOwnProperty('errors')) {
if ({}.hasOwnProperty.call(payload, 'errors')) {
const error = new Error(
'Server request for query `' + relayRequest.getDebugName() + '` ' +
'failed for the following reasons:\n\n' +
formatRequestErrors(relayRequest, payload.errors)
);
error.source = payload;
relayRequest.reject(error);
} else if (!payload.hasOwnProperty('data')) {
} else if (!{}.hasOwnProperty.call(payload, 'data')) {
relayRequest.reject(new Error(
'Server response was missing for query `' + relayRequest.getDebugName() +
'`.'
Expand Down
2 changes: 1 addition & 1 deletion src/relay/mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function mutation(relayRequest, fetchWithMiddleware) {

return fetchWithMiddleware(req)
.then(payload => {
if (payload.hasOwnProperty('errors')) {
if ({}.hasOwnProperty.call(payload, 'errors')) {
const error = new Error(
'Server request for mutation `' + relayRequest.getDebugName() + '` ' +
'failed for the following reasons:\n\n' +
Expand Down
2 changes: 2 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable */

export function isFunction(obj) {
return !!(obj && obj.constructor && obj.call && obj.apply);
}
2 changes: 2 additions & 0 deletions test/mocha-bootload.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable */

var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
Expand Down
2 changes: 2 additions & 0 deletions test/testutils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable import/prefer-default-export */

export const mockReq = (reqid) => {
return {
getID() {
Expand Down

0 comments on commit 9dc98fe

Please sign in to comment.