-
-
Notifications
You must be signed in to change notification settings - Fork 78.5k
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
Add Prettier (Fixes #22919) #24323
Add Prettier (Fixes #22919) #24323
Conversation
@@ -33,6 +33,7 @@ | |||
"js": "npm-run-all js-lint* js-compile* js-minify*", | |||
"js-main": "npm-run-all js-lint js-compile js-minify", | |||
"js-docs": "npm-run-all js-lint-docs js-minify-docs", | |||
"js-lint-fix": "eslint --fix js/ && eslint --fix --config js/tests/.eslintrc.json --env node build/", |
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.
I'm open for suggestions on how to name the command and if we can do some optimisations here.
First of all, thanks for the PR! There are many things I personally don't like in this config. I think we are better off just tweaking our rules.
That being said, I still think we should first tweak our ESLint rules. And perhaps change the location of /CC @Johann-S for feedback |
dist/css/bootstrap.css
Outdated
} | ||
|
||
.font-weight-bold { | ||
font-weight: bold !important; | ||
font-weight: 700 !important; |
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.
Unexpected !important declaration-no-important
dist/css/bootstrap.css
Outdated
@@ -8232,11 +8258,11 @@ a.bg-dark:focus, a.bg-dark:hover { | |||
} | |||
|
|||
.font-weight-normal { | |||
font-weight: normal !important; | |||
font-weight: 400 !important; |
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.
Unexpected !important declaration-no-important
dist/css/bootstrap.css
Outdated
@@ -4194,16 +4220,16 @@ tbody.collapse.show { | |||
.card-group .card:last-child .card-img-bottom { | |||
border-bottom-left-radius: 0; | |||
} | |||
.card-group .card:only-child { | |||
border-radius: 0.25rem; |
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.
Unexpected leading zero number-leading-zero
dist/css/bootstrap.css
Outdated
|
||
.card > .list-group:last-child .list-group-item:last-child { | ||
border-bottom-right-radius: 0.25rem; | ||
border-bottom-left-radius: 0.25rem; |
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.
Unexpected leading zero number-leading-zero
dist/css/bootstrap.css
Outdated
} | ||
|
||
.card > .list-group:last-child .list-group-item:last-child { | ||
border-bottom-right-radius: 0.25rem; |
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.
Unexpected leading zero number-leading-zero
dist/css/bootstrap.css
Outdated
@@ -2753,15 +2758,15 @@ fieldset[disabled] a.btn { | |||
background-color: transparent; | |||
} | |||
|
|||
.btn-outline-dark:active, .btn-outline-dark.active, | |||
.btn-outline-dark:not([disabled]):not(.disabled):active, .btn-outline-dark:not([disabled]):not(.disabled).active, |
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.
Expected newline after "," selector-list-comma-newline-after
dist/css/bootstrap.css
Outdated
@@ -2724,7 +2729,7 @@ fieldset[disabled] a.btn { | |||
background-color: transparent; | |||
} | |||
|
|||
.btn-outline-light:active, .btn-outline-light.active, | |||
.btn-outline-light:not([disabled]):not(.disabled):active, .btn-outline-light:not([disabled]):not(.disabled).active, |
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.
Expected newline after "," selector-list-comma-newline-after
dist/css/bootstrap.css
Outdated
@@ -2695,7 +2700,7 @@ fieldset[disabled] a.btn { | |||
background-color: transparent; | |||
} | |||
|
|||
.btn-outline-danger:active, .btn-outline-danger.active, | |||
.btn-outline-danger:not([disabled]):not(.disabled):active, .btn-outline-danger:not([disabled]):not(.disabled).active, |
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.
Expected newline after "," selector-list-comma-newline-after
dist/css/bootstrap.css
Outdated
@@ -2666,7 +2671,7 @@ fieldset[disabled] a.btn { | |||
background-color: transparent; | |||
} | |||
|
|||
.btn-outline-warning:active, .btn-outline-warning.active, | |||
.btn-outline-warning:not([disabled]):not(.disabled):active, .btn-outline-warning:not([disabled]):not(.disabled).active, |
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.
Expected newline after "," selector-list-comma-newline-after
dist/css/bootstrap.css
Outdated
@@ -2637,7 +2642,7 @@ fieldset[disabled] a.btn { | |||
background-color: transparent; | |||
} | |||
|
|||
.btn-outline-info:active, .btn-outline-info.active, | |||
.btn-outline-info:not([disabled]):not(.disabled):active, .btn-outline-info:not([disabled]):not(.disabled).active, |
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.
Expected newline after "," selector-list-comma-newline-after
Also, don't commit dist files. Although Hound should ignore those, I'll have a look at this. |
As you might know already.. Prettier doesn't have many options and that's why we have to ignore/comply with how Prettier is doing it (point 5 and 7 - not much we can do here).
|
That is why the points I made above are mostly so that we tweak our existent ESLint config and drop the whole idea of prettier. |
You may use prettier-eslint to get the best of both worlds |
Also, I think it would help the review process if you splitted the PR in two commits: 1 about the Prettier integration, 1 about the Prettier formatting of the files. |
I'll do that.. with the commits, because at the moment I'm using the the eslint and Prettier.. |
I think we are better off with using https://standardjs.com/ even though it's not a formatter. Personally I don't like the changes prettier makes here judging from the files committed. /CC @Johann-S |
Of course it's an opinionated code formatter and if there are some things that we don't like there is not much we can do, as earlier stated. Having said that I have two commits in this PR now to separate the config from formatting. |
@XhmikosR try to look beyond the formatting changes, think that you will never have to think about how your code looks like and you will never have to manually format a line of code in your life. That's liberating, and boosts productivity. Apart from that, all the contributions will already follow the "convention" because Prettier will take care of it for you guys. On Popper.js I use it because I don't give a **** about how my code is formatted as long it's consistent and readable, Prettier gives me exactly this. https://medium.freecodecamp.org/why-robots-should-format-our-code-159fd06d17f7 |
Like I said, I don't like the style it's enforcing. Like, a lot. It's a matter of personal taste. That being said, wait for Johann to chime in too. |
Sorry for the waiting 😄 I understand how it's convenient to not have to think how to format your code, that being said as @XhmikosR they are few rules I don't like...
But that's a matter of preferences, here finally I'm not sure about adding prettier to our workflow or standard js too. |
@Johann-S all your points can be covered by some custom eslint rule ran after Prettier. Except for the chaining methods, because they don't just break on multi line always, but only when they are too long to live in a single line. ESlint can't cover all the cases covered by Prettier, on the other hand. |
Plus Bootstrap will be featured here as well.. as the most starred library using Prettier :) hehe |
Channing methods it is not the best solution, because it will be hard also for the editor to figure out what's the correct way to format things...! We either go full Prettier or not at all.. and rely on other things for the formatting. |
@FezVrasta What are the cases (for JS & JSX code formatting) that ESLint can not handle? |
The only precise example in that issue is doing auto formatting for code that exceeds the maximum limit of characters per line. That's something modern IDEs have already built in. I am also not convinced by the "Gives you an integrated experience" (prettier/prettier-eslint#101 (comment)) claim. I would argue that the integrated experience of ESLint in WebStorm is much more mature. |
Yeah I mean, I'm not paid to convince you, whatever 😅 |
WebStorm costs some 💶 💵 |
@FezVrasta No offense! I don't want you to be a sales person. 😀 I am just looking for hard facts what makes Prettier better than ESLint (for JS & JSX code formatting) and thought that I can maybe find the answers here. 😃 |
Thank you all for your feedbacks and @lipis for your PR but we will pass on adding prettier to our workflow. But we will tweak our Eslint rules and a git hook which will run |
Fair enough.. see you in a few months.. :) |
Fixes #22919
I removed bunch of styling rules.. so feel free to comment if we can remove more stylistic rules since most of them are covered by Prettier.
/cc @XhmikosR