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
feat(lint): add prettier formatter to assert LESS files whitespaces #2611
feat(lint): add prettier formatter to assert LESS files whitespaces #2611
Conversation
d47a5c4
to
d368a93
Compare
57f31d9
to
da9a4f9
Compare
342bde2
to
d302347
Compare
PR is done, Prettier fixes with patches looks reasonable. Compiled |
Please resolve conflicts |
Seriously? This is really hacky. You want to use a tool, which does not do what we need... Why not fork prettier.io instead and use that? |
d302347
to
c3915f3
Compare
I sent you an invite for Admin access to https://github.com/fomantic/prettier, so you can freely maintain it 🙂 |
7fb93b0
to
c63b74d
Compare
c63b74d
to
3909716
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally LGTM 👍🏼
I would like to thank you very much for this and especially for your patience and understanding for all the (critical) feedback i gave 😉
@mvorisek It seems prettier has merged all of your PRs 🙂 |
@lubber-de all except the one which adds new lines when comma is present - fomantic/prettier@d9c5a04 and fomantic/prettier@ca814b7 I can try to propose it to Prettier as well, but I am not sure if it will be accepted |
Yes, please 😊 they seem to trust you |
I have about 1500 contributions / year in GH. But it is not only about personal credit, the previous PRs were bugfixes, this one is feature request about styling. AFAK such FR should not be accepted, I will do my best to stress the importance of increased readability with a an example, but I cannot promise anything. |
@lubber-de I have crafter 14208 prettier PR. Currently we enforce NL based on the original presence - fomantic/prettier@edb343f - but such behaviour is not possible in prettier offcially (it rebuilds AST into one stable format). So the 14208 prettier PR is designed to enforce line break in all CSS values when comma is present. See https://github.com/mvorisek/prettier/commit/da28053ff997aa259ee41046a7377bcfc35a7ee9 . Is such format ok with you or do you have any idea of better prettier formatting? |
TBH, no, or, "depends". Forcing a NL always will bloat the view for example in site.variables where the unicode ranges for the Lato font is given. -> comma list in one line is ok There still exists "prettier-ignore", but i fear we would make use of that too often in all the files. |
fix #2611 (comment) prettier PR: prettier/prettier#14208
Compared to Stylelint, Prettier is very simple tool and I am quite supprised Stylelint is deprecating the whitespace rules in favor of Prettier. For LESS it seems ok, for JS, we should never enable Prettier as formatting is part of a code and improves readability.
As Prettier is an opinionated formatter instead of an linter, we need to satisfy it everywhere without exceptions.
When I was crafting this PR, I found several Prettier issues and proposed changes to Prettier:
In this PR, these changes are contained and Prettier is patched before it is run. Once the changes are merged in prettier and stable release is made, they can be removed.
This PR fixes minor whitespaces unfixed/undetected in GH-2610.
And also asserts:
Prettier has no built in support to dump the diff - prettier/prettier#6885 - so we dump it in the CI using git.