Skip to content

Commit

Permalink
yarn format. Added format to precommit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Cassidy committed Aug 16, 2018
1 parent d3c01f9 commit 83b4dfa
Show file tree
Hide file tree
Showing 14 changed files with 2,450 additions and 5,040 deletions.
4,286 changes: 0 additions & 4,286 deletions package-lock.json

This file was deleted.

65 changes: 33 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
{
"private": true,
"license": "MIT",
"devDependencies": {
"@arago/eslint-config-arago": "github:arago/eslint-config-arago",
"babel-eslint": "^8.2.6",
"eslint": "^5.3.0",
"husky": "^0.14.3",
"lerna": "^3.0.6",
"lint-staged": "^7.2.2",
"prettier": "1.14.2"
},
"scripts": {
"lerna": "lerna",
"test": "lerna bootstrap --concurrency 1 && npm run lint && lerna run test",
"publish": "lerna publish",
"format": "prettier --tab-width=4 'packages/*/*.js' 'packages/*/!(node_modules|lib)/**/*.js' --write",
"lint-prettier": "prettier --tab-width=4 'packages/*/*.js' 'packages/*/!(node_modules|lib)/**/*.js' --list-different",
"lint-eslint": "eslint packages/",
"lint": "npm run lint-prettier && npm run lint-eslint",
"start-again": "rm -rf package-lock.json node_modules/* && lerna exec 'rm -rf package-lock.json node_modules/*' && lerna bootstrap --concurrency 1"
},
"lint-staged": {
"*.js": [
"prettier --tab-width=4 --write",
"git add"
]
},
"eslintConfig": {
"extends": "@arago/eslint-config-arago",
"globals": {
"__DEV__": true
"private": true,
"license": "MIT",
"devDependencies": {
"@arago/eslint-config-arago": "github:arago/eslint-config-arago",
"babel-eslint": "^8.2.6",
"eslint": "^5.3.0",
"husky": "^0.14.3",
"lerna": "^3.0.6",
"lint-staged": "^7.2.2",
"prettier": "1.14.2"
},
"scripts": {
"lerna": "lerna",
"test": "lerna bootstrap --concurrency 1 && npm run lint && lerna run test",
"publish": "lerna publish",
"format": "prettier --tab-width=4 'packages/*/*.js' 'packages/*/!(node_modules|lib)/**/*.js' --write",
"lint-prettier": "prettier --tab-width=4 'packages/*/*.js' 'packages/*/!(node_modules|lib)/**/*.js' --list-different",
"lint-eslint": "eslint packages/",
"lint": "npm run lint-prettier && npm run lint-eslint",
"start-again": "rm -rf package-lock.json node_modules/* && lerna exec 'rm -rf package-lock.json node_modules/*' && lerna bootstrap --concurrency 1",
"precommit": "yarn format"
},
"lint-staged": {
"*.js": [
"prettier --tab-width=4 --write",
"git add"
]
},
"eslintConfig": {
"extends": "@arago/eslint-config-arago",
"globals": {
"__DEV__": true
}
}
}
}
7 changes: 6 additions & 1 deletion packages/hiro-graph-client/__mocks__/client-test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ export default client => [
},
{
name: "connect",
fn: () => client.connect("some-verb", "the-in-id", "the-out-id")
fn: () =>
client.connect(
"some-verb",
"the-in-id",
"the-out-id"
)
},
{
name: "disconnect",
Expand Down
16 changes: 12 additions & 4 deletions packages/hiro-graph-client/__tests__/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,19 @@ describe("Client Response handling", () => {
const forbidden = errors.forbidden();
client.enqueueMockResponse(conflict, forbidden);
await expect(
client.connect("foo", "bar", "baz")
client.connect(
"foo",
"bar",
"baz"
)
).resolves.toBeUndefined(); // connect returns nothing on success
await expect(client.connect("foo", "bar", "baz")).rejects.toBe(
forbidden
);
await expect(
client.connect(
"foo",
"bar",
"baz"
)
).rejects.toBe(forbidden);
});

it("should handle `conflict` and `not found` as OK for disconnect", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ describe("transport-websocket", () => {
// this is a setup pain, but without it we couldn't easily use this transport in many tests
// with making them reliant on each other.
captureNextConnection();
await transport.connect(fakeToken, log);
await transport.connect(
fakeToken,
log
);
// now we have a connection.
});

Expand Down
5 changes: 4 additions & 1 deletion packages/hiro-graph-client/src/transport-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export default class WebSocketTransport {
*/
request(token, { type, headers = {}, body = {} }, reqOptions = {}) {
//the connect call ensures the websocket is connected before continuing.
return this.connect(token, reqOptions.emit).then(client =>
return this.connect(
token,
reqOptions.emit
).then(client =>
client.send(token, { type, headers, body }, reqOptions)
);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/hiro-graph-implicit-oauth/src/popup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ const createPopup = (url, popWidth, popHeight) => {
const winWidth = window.innerWidth //eslint-disable-line no-nested-ternary
? window.innerWidth
: document.documentElement.clientWidth
? document.documentElement.clientWidth
: screen.width;
? document.documentElement.clientWidth
: screen.width;
const winHeight = window.innerHeight //eslint-disable-line no-nested-ternary
? window.innerHeight
: document.documentElement.clientHeight
? document.documentElement.clientHeight
: screen.height;
? document.documentElement.clientHeight
: screen.height;

const left = winWidth / 2 - popWidth / 2 + dualScreenLeft;
const top = winHeight / 2 - popHeight / 2 + dualScreenTop;
Expand Down
7 changes: 6 additions & 1 deletion packages/hiro-graph-orm/__tests__/context.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ describe("mock transport test", () => {
expect(res.plain()._rel[relation + "Ids"]).toEqual([]);
return res;
})
.then(res => res.connect(relation, "node-2"))
.then(res =>
res.connect(
relation,
"node-2"
)
)
.then(res => {
expect(res.plain()._rel[relation + "Ids"]).toEqual(["node-3"]);
return res;
Expand Down
7 changes: 6 additions & 1 deletion packages/hiro-graph-orm/src/context/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,12 @@ export function connect(
const { verb, direction } = relationDef.hops[0];
const [inId, outId] =
direction === "in" ? [source, target] : [target, source];
return ctx.getClient().connect(verb, inId, outId, options);
return ctx.getClient().connect(
verb,
inId,
outId,
options
);
}

/**
Expand Down
7 changes: 6 additions & 1 deletion packages/hiro-graph-orm/src/context/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,12 @@ const mixinMethods = {
create: (ctx, entity) => (data, options = {}) =>
create(ctx, entity, data, options),
connect: (ctx, entity) => (relation, source, target, options = {}) =>
connect(ctx, entity, { relation, source, target }, options),
connect(
ctx,
entity,
{ relation, source, target },
options
),
disconnect: (ctx, entity) => (relation, source, target, options = {}) =>
disconnect(ctx, entity, { relation, source, target }, options),
update: (ctx, entity) => (vertexId, appData, options = {}) =>
Expand Down
6 changes: 5 additions & 1 deletion packages/hiro-graph-orm/src/vertex/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export default class GraphVertex extends Vertex {
*/
connect(relation, vertexOrId) {
return this._db
.connect(relation, this._id, vertexOrId)
.connect(
relation,
this._id,
vertexOrId
)
.then(refetchRelationData(this, relation));
}

Expand Down
7 changes: 6 additions & 1 deletion packages/hiro-graph-redux/__tests__/middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ describe("testing test setup", () => {
{}, // it is actually irrelevant as long as it isn't an error.
[createPerson("person3")] // this one is the new "relation" query result
);
return orm.me().then(me => me.connect(rel, "person3"));
return orm.me().then(me =>
me.connect(
rel,
"person3"
)
);
});

let res, v;
Expand Down
5 changes: 4 additions & 1 deletion packages/hiro-graph-redux/src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ function middleware(ctxArgs, { dispatch: next, getState, subscribe }) {
invalidationHooks.forEach(fn => fn());
};
//connect our token to redux
token.connect({ dispatch, getState, subscribe }, onInvalidate);
token.connect(
{ dispatch, getState, subscribe },
onInvalidate
);

//here we cache the promises of inflight tasks
const taskToPromise = new Map();
Expand Down
Loading

0 comments on commit 83b4dfa

Please sign in to comment.