Comments (27)
1.5.1 will fix the issue https://github.com/azz/pretty-quick/releases/tag/v1.5.1
from pretty-quick.
Okay, I have a reproduction and I think I have line-of-sight on the issue. I'll keep you posted.
from pretty-quick.
Same for me. In v2.0.1 I'm getting this error om some random files. If i change to v1.5.1 it's working.
from pretty-quick.
Okay, I pushed a PR to resolve the issue. A couple of learnings coming out of this experience:
- It would be great if someone had an idea for how to easily stand-up git integration tests. Mocking out the SCM didn't help catch this one.
- It looks like I was burned by not running an
npm run build
in between local integration testing 😢. Sorry for putting up a broken PR!
from pretty-quick.
The new version is out. Can you give that a go @MatthewMi11er, @marc1404 and @rdiazv ?
from pretty-quick.
I'm getting this error in v2.0.1 when I have no partially staged files, just one file in staging
from pretty-quick.
I have the same issue.
from pretty-quick.
Okay, I reverted back to v1.5.0
and did the second test again (I staged all changed files):
$ git diff
$ git diff --staged
diff --git a/layouts/default.vue b/layouts/default.vue
index d493edc..e07165e 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -28,6 +28,8 @@
<script>
import { Navbar, Sidebar, sidebarService } from '~/src/layout';
+ const test = '';
+
export default {
name: 'DefaultLayout',
components: {
diff --git a/package.json b/package.json
index a5ad677..2bbe73d 100644
--- a/package.json
+++ b/package.json
@@ -71,7 +71,7 @@
"minimist": "1.2.0",
"node-notifier": "5.2.1",
"prettier": "1.12.1",
- "pretty-quick": "1.5.1"
+ "pretty-quick": "1.5.0"
},
"engines": {
"node": ">=9.0.0",
diff --git a/yarn.lock b/yarn.lock
index 3123e2d..a0ba45b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4491,9 +4491,9 @@ [email protected]:
parse-ms "^1.0.0"
plur "^2.1.2"
[email protected]:
- version "1.5.1"
- resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.5.1.tgz#b36bb4fe7cdb04ed5f4ba4ba530d609cb3be4ac2"
[email protected]:
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.5.0.tgz#304853ece7f8cb56bec74ba3ccd978037e7f2117"
dependencies:
chalk "^2.3.0"
execa "^0.8.0"
$ git commit -m "test"
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 018df2d.
🎯 Found 2 changed files.
✍️ Fixing up layouts/default.vue.
✗ Found partially staged file layouts/default.vue.
✗ Partially staged files were fixed up. Please update stage before committing.
husky > pre-commit hook failed (add --no-verify to bypass)
from pretty-quick.
Maybe something like isomorphic git could be used for git integration tests?
Thanks for the PR @mpareja !
from pretty-quick.
Thank you @mpareja. Reason I couldn't repro is I tried from a fresh git repo, whose revision
is null
.
1.6.0 will re-introduce this feature.
from pretty-quick.
It works great! 🎉
Thanks for fixing this so quickly 👏
from pretty-quick.
Sounds like a bug, cc. @mpareja.
from pretty-quick.
Can't immediately reproduce this. Tried:
$ yarn init -y
$ yarn add -D prettier [email protected]
$ git init
$ echo 'var formatted = true;' > x.js
$ echo 'var unformatted = true ;' > y.js
$ git add x.js y.js
$ yarn pretty-quick --staged
yarn run v1.3.2
$ /Users/azz/code/pretty-quick-issue-30/node_modules/.bin/pretty-quick --staged
🔍 Finding changed files since git revision null.
🎯 Found 2 changed files.
✍️ Fixing up y.js.
✅ Everything is awesome!
✨ Done in 0.51s.
from pretty-quick.
I'm using [email protected]
and I have the same problem.
error Command failed.
Exit code: 1
Command: git
Arguments: commit -m v0.0.108
Directory: ...
Output:
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 6c06227.
🎯 Found 1 changed file.
✍️ Fixing up package.json.
✗ Found partially staged file package.json.
✗ Partially staged files were fixed up. Please update stage before committing.
husky > pre-commit hook failed (add --no-verify to bypass)
info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
from pretty-quick.
Multiple reports, reverting last change in #32. Will diagnose further once the release (1.5.1) is out.
from pretty-quick.
@marc1404 what was the status of package.json
before you committed?
from pretty-quick.
If anyone is able to describe reproduction steps we should be able to fix this one and re-add the feature.
from pretty-quick.
Thanks for reacting so quickly on this issue!
I can reproduce it on v1.5.0
by running only pretty-quick
(everything working) or pretty-quick --staged
in the precommit-hook.
Here is my test without* the --staged
flag:
$ git diff
diff --git a/layouts/default.vue b/layouts/default.vue
index 29290c1..4b73e9d 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -29,6 +29,7 @@
import { Navbar, Sidebar, sidebarService } from '~/src/layout';
const test = '';
+ const test2 = '';
export default {
name: 'DefaultLayout',
diff --git a/package.json b/package.json
index e23dd53..cf38a12 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"scripts": {
- "precommit": "pretty-quick --staged",
+ "precommit": "pretty-quick",
$ git commit -m "test"
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 4d90c6c.
🎯 Found 1 changed file.
✍️ Fixing up layouts/default.vue.
✅ Everything is awesome!
Here is the output with the --staged
flag:
$ git diff
diff --git a/layouts/default.vue b/layouts/default.vue
index 29290c1..4b73e9d 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -29,6 +29,7 @@
import { Navbar, Sidebar, sidebarService } from '~/src/layout';
const test = '';
+ const test2 = '';
export default {
name: 'DefaultLayout',
$ git add .
$ git commit -m "test"
husky > npm run -s precommit (node v10.1.0)
🔍 Finding changed files since git revision 50d4fcf.
🎯 Found 1 changed file.
✍️ Fixing up layouts/default.vue.
✗ Found partially staged file layouts/default.vue.
✗ Partially staged files were fixed up. Please update stage before committing.
husky > pre-commit hook failed (add --no-verify to bypass)
from pretty-quick.
git diff
only shows unstaged files. Could you repeat the second test above but run both git diff
and git diff --staged
?
from pretty-quick.
Thanks for investigating!
from pretty-quick.
@mpareja Working out perfectly so far on 1.6.0
!
Thank you all :)
from pretty-quick.
1.6.0
seems to work correctly for me! Thanks for fixing that!
from pretty-quick.
Removing yarn.lock
and running yarn install
solved my problem.
Error Message:
✖ pretty-quick --staged found some errors. Please fix them and try committing again.
🔍 Finding changed files since git revision 871be03.
🎯 Found 32 changed files.
✍️ Fixing up src/actions/index.ts.
/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/node_modules/execa/index.js:201
throw error;
^
Error: Command failed with exit code 128 (Unknown system error -128): git add src/actions/index.ts
at makeError (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/node_modules/execa/lib/error.js:59:11)
at Function.module.exports.sync (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/node_modules/execa/index.js:187:17)
at runGit (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/dist/scms/git.js:42:52)
at Object.stageFile (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/dist/scms/git.js:79:3)
at onWriteFile (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/dist/index.js:70:15)
at _default (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/dist/processFiles.js:46:22)
at _default (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/dist/index.js:58:29)
at Object.<anonymous> (/home/sultan/Desktop/masterworks/pplus-admin-panel/node_modules/pretty-quick/bin/pretty-quick.js:12:27)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
husky > pre-commit hook failed (add --no-verify to bypass)
from pretty-quick.
Same on 2.0.1
from pretty-quick.
Im facing the same problem with 2.0.1
from pretty-quick.
After updating to 3.1.0 the issue is gone
from pretty-quick.
Same problem on 3.1.3
from pretty-quick.
Related Issues (20)
- git diff causing error in github action HOT 1
- Fix Readme for Husky 6.0.0 HOT 2
- pretty-quick does not work when "type": "module" is declared in package.json in a TypeScript project HOT 1
- Use newest prettier
- Executing pretty-quick in git worktree cannot detect scm HOT 2
- Ignore errors with husky precommit hook HOT 4
- Ignoring lines in html files doesnt work <!-- prettier-ignore --> HOT 1
- How to format all file?
- Format single quote to double when I commit HOT 1
- I would like to see the fixes applied using pretty-quick
- Bug: an invalid branch name does not produce a failure
- SyntaxError: Unexpected token (11:16) HOT 1
- Not working with npx & husky pre-commit hook HOT 1
- pretty-quick will break with prettier v3 HOT 31
- SyntaxError: Unexpected token ? HOT 3
- prettier.resolveConfig.sync is not a function HOT 6
- -c
- feat!: drop Mercurial support HOT 4
- Breaking on npm install with new 3.1.4 version HOT 4
- "Unable to detect a source control manager." HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pretty-quick.