Better Prettier pre-commit

This commit is contained in:
Gregory Schier 2018-06-25 16:10:12 -04:00
parent 14fb8a1585
commit f08057a6b8
3 changed files with 51 additions and 10 deletions

42
package-lock.json generated
View File

@ -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",

View File

@ -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": {}
}
}

View File

@ -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);
}