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

How about recommending the use of 'prettier' in contribution guide? #53

Closed
dc7303 opened this issue Aug 9, 2020 · 3 comments · Fixed by #78
Closed

How about recommending the use of 'prettier' in contribution guide? #53

dc7303 opened this issue Aug 9, 2020 · 3 comments · Fixed by #78
Projects

Comments

@dc7303
Copy link
Member

dc7303 commented Aug 9, 2020

I found the modified code without prettier applied in some files during code modification.
And it can include changes that are independent of the commit.
I sent a pull request for prevent this. (#52)

If the contributor modifies the code without using prettier, this problem will occur again.
So how about recommending the use of 'prettier' in contribution guide?

@hackerwins
Copy link
Member

Yes. It would be nice to describe Prettier in Contribution.md. I thought it would be nice to have Prettier run automatically before commit using a tool like husky.

However, it could not be introduced due to the line break issue below. Do you have any idea about ​​this issue?
#44 (comment)

@dc7303
Copy link
Member Author

dc7303 commented Aug 10, 2020

@hackerwins Thank you for providing usable information.
In my opinion, newline per chain call are not the problem, it seems to be affected by the printWidth option of prettier.
In 1.x versions, if there were more than 3 calls, a newline occurred. In the current 2.x version this has been fixed, we are using version 2.0.5.

(reference)
version 1.x playground
version 2.x playground

So I tested it with the code of the part in problem.

printWidth: 80

    if (logger.isEnabled(LogLevel.Trivial)) {
      logger.trivial(
        changes
          .map(
            (change) =>
              `${change
                .getID()
                .getAnnotatedString()}\t${change.getAnnotatedString()}`,
          )
          .join('\n'),
      );
    }

printWidth: 90

    if (logger.isEnabled(LogLevel.Trivial)) {
      logger.trivial(
        changes
          .map(
            (change) =>
              `${change.getID().getAnnotatedString()}\t${change.getAnnotatedString()}`,
          )
          .join('\n'),
      );
    }

printWidth: 100

    if (logger.isEnabled(LogLevel.Trivial)) {
      logger.trivial(
        changes
          .map((change) => `${change.getID().getAnnotatedString()}\t${change.getAnnotatedString()}`)
          .join('\n'),
      );
    }

However, if we modify it and use it, it affects other parts as well.
For example

-    pbSetOperation.setParentCreatedAt(
-      toTimeTicket(setOperation.getParentCreatedAt()),
-    );
+    pbSetOperation.setParentCreatedAt(toTimeTicket(setOperation.getParentCreatedAt()));

Looking at this, I think there is a part that we have to give up in order for use prettier.
Let me know what you think.

@hackerwins
Copy link
Member

For now, it would be nice to leave this issue open and wait for an update on Prettier.

@hackerwins hackerwins mentioned this issue Sep 4, 2020
2 tasks
@hackerwins hackerwins added this to Done in v0.1 Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
v0.1
Done
Development

Successfully merging a pull request may close this issue.

2 participants