From f08057a6b8b58b5970eb24d75b602120744178c3 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Mon, 25 Jun 2018 16:10:12 -0400 Subject: [PATCH] Better Prettier pre-commit --- package-lock.json | 42 +++++++++++++++++++ package.json | 6 +-- .../insomnia-app/app/ui/containers/app.js | 13 +++--- 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 900a9f3d3..9998d7706 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4352,6 +4352,12 @@ "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", "dev": true }, + "ignore": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", + "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "dev": true + }, "import-local": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", @@ -6058,6 +6064,12 @@ "run-queue": "1.0.3" } }, + "mri": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.1.tgz", + "integrity": "sha1-haom09ru7t+A3FmEr5XMXKXK2fE=", + "dev": true + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -6668,6 +6680,36 @@ } } }, + "pretty-quick": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-1.6.0.tgz", + "integrity": "sha512-bnCmsPy98ERD7VWBO+0y1OGWLfx/DPUjNFN2ZRVyxuGBiic1BXAGgjHsTKgBIbPISdqpP6KBEmRV0Lir4xu/BA==", + "dev": true, + "requires": { + "chalk": "2.3.0", + "execa": "0.8.0", + "find-up": "2.1.0", + "ignore": "3.3.10", + "mri": "1.1.1" + }, + "dependencies": { + "execa": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz", + "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + } + } + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", diff --git a/package.json b/package.json index 36df6d4f9..069c5f64c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "husky": { "hooks": { - "pre-commit": "npm run format-code" + "pre-commit": "pretty-quick --staged" } }, "devDependencies": { @@ -27,7 +27,7 @@ "jest": "^22.1.1", "lerna": "^2.7.1", "prettier": "^1.13.6", + "pretty-quick": "^1.6.0", "webpack": "^4.8.3" - }, - "dependencies": {} + } } diff --git a/packages/insomnia-app/app/ui/containers/app.js b/packages/insomnia-app/app/ui/containers/app.js index 19c9a1b97..baeb5e06c 100644 --- a/packages/insomnia-app/app/ui/containers/app.js +++ b/packages/insomnia-app/app/ui/containers/app.js @@ -282,13 +282,12 @@ class App extends PureComponent { async _fetchRenderContext() { const { activeEnvironment, activeRequest, activeWorkspace } = this.props; const environmentId = activeEnvironment ? activeEnvironment._id : null; - const ancestors = activeRequest - ? await db.withAncestors(activeRequest, [ - models.request.type, - models.requestGroup.type, - models.workspace.type - ]) - : await [activeWorkspace]; + + const ancestors = await db.withAncestors(activeRequest || activeWorkspace, [ + models.request.type, + models.requestGroup.type, + models.workspace.type + ]); return render.getRenderContext(activeRequest, environmentId, ancestors); }