Now that prettier-java is available, it should be possible to integrate it the generator-jhipster project.
As @jdubois said in a similar issue (see #6379):
In the end, we would win a lot of time: no need to worry anymore about formatting everything so that the end-result is good. We could focus on having some clean code inside the template, instead. Too often, our templates are unreadable because of the output we want to have.
Supporting Java would benefit a lot of users, make it easier to merge PRs and standardize code.
Continuing the discussion from #6379.
I didn't follow closely the work done by the crazy prettier team but it will be done when it's ready
I'll let @clement26695 doing an official answer
What could easily done without big impact:
What do you think @clement26695 ?
I would really like to use prettier-java in JHipster (and on other projects) too, and that's the reason I reported a few issues on prettier-java resulting from tests on real code coming from JHipster, and also had a nice discussion with @clement26695 on the subject.
I think I would use a different strategy:
client to common subgenerator)Sure, step 1 might have some small impacts (we're only talking about formatting here), but this is how we'll move forward I think.
If we agree, I can work on a PR.
For the record, I just did new tests with prettier-java 0.4.0, and I've identified at least 3 issues blocking (to my opinion) issues, related to:
Sorry, I was not available this weekend to answer to this thread.
As @murdos said, there are still a few bugs that are blocking IMO, particularly the first one. I am working on this, and we should find a solution soon, but it is a bit too soon to integrate prettier-java in the repo for the moment, IMO.
I have been working on a project with prettier-java for 3 months so I want to share my experience using it.
We have quite a large code base: ~40k lines from an app initially generated with JHipster. We are using a pre-commit hook to run prettier. We are very happy with it: it helps a lot our team (10 devs on the same app) to be consistent in our code (as we are used to in JavaScript projects).
I just checked, we only have 2 prettier-ignore in our code: one for comment block on enum entries and one for SecurityConfiguration rules definition. I just tried to upgrade from our current prettier-java version from 0.3.2 to 0.5.1. The issue we have with the enum entries is fixed and the one for SecurityConfiguration class is much better (but maybe perfectible? I don't now).
For me, prettier-java is mature enough to be integrated inside generated projects. It could lead to a lot of contribution to prettier-java.
Anyway, thanks a lot the prettier-java team for your awesome work :)
Following this: https://github.com/jhipster/generator-jhipster/pull/11645
I think it can be closed
cc @murdos : if you think it should be reopened, just tell me
cc @murdos : if you think it should be reopened, just tell me
That's fine, you're right 馃槈
In V7 we'll just need to remove the --prettier-java option, but it will be easy.
Most helpful comment
I have been working on a project with prettier-java for 3 months so I want to share my experience using it.
We have quite a large code base: ~40k lines from an app initially generated with JHipster. We are using a pre-commit hook to run prettier. We are very happy with it: it helps a lot our team (10 devs on the same app) to be consistent in our code (as we are used to in JavaScript projects).
I just checked, we only have 2
prettier-ignorein our code: one for comment block on enum entries and one for SecurityConfiguration rules definition. I just tried to upgrade from our current prettier-java version from0.3.2to0.5.1. The issue we have with the enum entries is fixed and the one for SecurityConfiguration class is much better (but maybe perfectible? I don't now).For me, prettier-java is mature enough to be integrated inside generated projects. It could lead to a lot of contribution to prettier-java.
Anyway, thanks a lot the prettier-java team for your awesome work :)