Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code corrupted by format a white-spaces only changes #21

Open
medved-nsk opened this issue Jul 17, 2018 · 0 comments
Open

Code corrupted by format a white-spaces only changes #21

medved-nsk opened this issue Jul 17, 2018 · 0 comments

Comments

@medved-nsk
Copy link

Hi.
I faced a code corruption on white-space changes. Cannot say for sure it's caused by precise-commits (the setup include a prettier precise-commits and husky as suggested). Though applying prettier directly on the whole file does work properly.

I made a simple project with example.
Basically it reproduced by with the following:

  1. Original snippet
function func01(arg1: number) {
if ( arg1  >  32)  {
   console.log("test3");
     }
    //return (arg1-32);
  }
  1. Then apply patch
 function func01(arg1: number) {
-if ( arg1  >  32)  {
-   console.log("test3");
-     }
+if ( arg1 >  32)  {
+    console.log("test3");
+      }
     //return (arg1-32);
-  }
+    }
  1. Which then make the snippet
function func01(arg1: number) {
if ( arg1 >  32)  {
    console.log("test3");
      }
    //return (arg1-32);
    }
  1. Commit
git add test01.ts
git commit -m "test01 format"
  1. The result
cat test01.ts
function func01(arg1: number) {
                                if (rg1 > 3) {
 c                              onsole.log("test3");
                           }
    //re                            turn (arg1-32);
                              }

Please advise if I missed something in my setup?
What else could be checked on my side?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant