You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using 0.27.1, I feel there could be a minor improvement with how long statements are separated with regards to the placement of the operators. Having all the variables vertically aligned with each other to me seems a little easier to read with the && placed at the end of the previous line rather than the start of the next one. This would be similar behaviour to what prettier does too.
Input:
var theNumberOne = 1;
var theNumberTwo = 2;
var theNumberThree = 3;
var theNumberFour = 4;
var theNumberFive = 5;
var theNumberSix = 6;
if (theNumberOne == 1 && theNumberTwo == 2 && theNumberThree == 3 && theNumberFour == 4 && theNumberFive == 5 && theNumberSix == 6)
{
// They are who they say they are
}
Output:
var theNumberOne = 1;
var theNumberTwo = 2;
var theNumberThree = 3;
var theNumberFour = 4;
var theNumberFive = 5;
var theNumberSix = 6;
if (
theNumberOne == 1
&& theNumberTwo == 2
&& theNumberThree == 3
&& theNumberFour == 4
&& theNumberFive == 5
&& theNumberSix == 6
)
{
// They are who they say they are
}
Expected behavior:
var theNumberOne = 1;
var theNumberTwo = 2;
var theNumberThree = 3;
var theNumberFour = 4;
var theNumberFive = 5;
var theNumberSix = 6;
if (
theNumberOne == 1 &&
theNumberTwo == 2 &&
theNumberThree == 3 &&
theNumberFour == 4 &&
theNumberFive == 5 &&
theNumberSix == 6
)
{
// They are who they say they are
}
The text was updated successfully, but these errors were encountered:
Operators at the beginning of long statements is the widely accepted best practice. If I recall correctly from this super long prettier issue about it, someone just picked putting them at the end and they have been reluctant to finally move them to the beginning. prettier/prettier#3806
There is a lot of discussion in that issue as well about the pros of operators at the beginning.
Using 0.27.1, I feel there could be a minor improvement with how long statements are separated with regards to the placement of the operators. Having all the variables vertically aligned with each other to me seems a little easier to read with the
&&
placed at the end of the previous line rather than the start of the next one. This would be similar behaviour to what prettier does too.Input:
Output:
Expected behavior:
The text was updated successfully, but these errors were encountered: