Giter VIP home page Giter VIP logo

Comments (27)

azz avatar azz commented on May 19, 2024 4

1.5.1 will fix the issue https://github.com/azz/pretty-quick/releases/tag/v1.5.1

from pretty-quick.

mpareja avatar mpareja commented on May 19, 2024 4

Okay, I have a reproduction and I think I have line-of-sight on the issue. I'll keep you posted.

from pretty-quick.

danielmeyer-cn avatar danielmeyer-cn commented on May 19, 2024 3

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.

mpareja avatar mpareja commented on May 19, 2024 2

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.

mpareja avatar mpareja commented on May 19, 2024 2

The new version is out. Can you give that a go @MatthewMi11er, @marc1404 and @rdiazv ?

from pretty-quick.

JonathanDCohen avatar JonathanDCohen commented on May 19, 2024 2

I'm getting this error in v2.0.1 when I have no partially staged files, just one file in staging

from pretty-quick.

rdiazv avatar rdiazv commented on May 19, 2024 1

I have the same issue.

from pretty-quick.

marc1404 avatar marc1404 commented on May 19, 2024 1

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.

marc1404 avatar marc1404 commented on May 19, 2024 1

Maybe something like isomorphic git could be used for git integration tests?
Thanks for the PR @mpareja !

from pretty-quick.

azz avatar azz commented on May 19, 2024 1

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.

rdiazv avatar rdiazv commented on May 19, 2024 1

It works great! 🎉
Thanks for fixing this so quickly 👏

from pretty-quick.

azz avatar azz commented on May 19, 2024

Sounds like a bug, cc. @mpareja.

from pretty-quick.

azz avatar azz commented on May 19, 2024

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.

marc1404 avatar marc1404 commented on May 19, 2024

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.

azz avatar azz commented on May 19, 2024

Multiple reports, reverting last change in #32. Will diagnose further once the release (1.5.1) is out.

from pretty-quick.

azz avatar azz commented on May 19, 2024

@marc1404 what was the status of package.json before you committed?

from pretty-quick.

azz avatar azz commented on May 19, 2024

If anyone is able to describe reproduction steps we should be able to fix this one and re-add the feature.

from pretty-quick.

marc1404 avatar marc1404 commented on May 19, 2024

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.

azz avatar azz commented on May 19, 2024

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.

azz avatar azz commented on May 19, 2024

Thanks for investigating!

from pretty-quick.

marc1404 avatar marc1404 commented on May 19, 2024

@mpareja Working out perfectly so far on 1.6.0!
Thank you all :)

from pretty-quick.

MatthewMi11er avatar MatthewMi11er commented on May 19, 2024

1.6.0 seems to work correctly for me! Thanks for fixing that!

from pretty-quick.

sultanassi95 avatar sultanassi95 commented on May 19, 2024

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.

SudoPlz avatar SudoPlz commented on May 19, 2024

Same on 2.0.1

from pretty-quick.

AllanOricil avatar AllanOricil commented on May 19, 2024

Im facing the same problem with 2.0.1

from pretty-quick.

AllanOricil avatar AllanOricil commented on May 19, 2024

After updating to 3.1.0 the issue is gone

from pretty-quick.

AntonGrekov avatar AntonGrekov commented on May 19, 2024

Same problem on 3.1.3

from pretty-quick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.