-
-
Notifications
You must be signed in to change notification settings - Fork 541
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
📝 Output is different based on initial formatting of input #3766
Comments
As seen in the playground, prettier gives consistent results with both of the functions with different initial formatting, but biome has 2 different outputs. Shouldn't this be the same? since the output should always be consistent after formatting. Also while locally testing, in some cases if I formatted the code more than once repeatedly, the output would change. i.e the line in the playground: return `Lectures: ${doneCount}/${totalCount} | Mins: ${(
doneSecs / 60
).toFixed(2)}/${(totalSecs / 60).toFixed(2)}| Hours: ${(
doneSecs / 3600
).toFixed(2)}/${(totalSecs / 3600).toFixed(2)}`; would become return `Lectures: ${doneCount}/${totalCount} | Mins: ${(
doneSecs / 60
).toFixed(2)}/${(totalSecs / 60).toFixed(2)}| Hours: ${(doneSecs / 3600).toFixed(2)}/${(totalSecs / 3600).toFixed(2)}`; and then return `Lectures: ${doneCount}/${totalCount} | Mins: ${(doneSecs / 60).toFixed(2)}/${(totalSecs / 60).toFixed(2)}| Hours: ${(doneSecs / 3600).toFixed(2)}/${(totalSecs / 3600).toFixed(2)}`; |
This problem is caused by the line width configuration. When the two sides are configured to 120, the behive of the two sides is consistent, and when the two sides are configured to 1000, they start to differ. biome Max line width = 320 will use the default 80 when it is greater than 320 and all the configurations will use the default configuration (for example, semicolons always configuration will also be broken), so the difference is caused |
Hi! The different I am talking about is between the different output of string a and b. I am not comparing with prettier, I am comparing the string a with string b when formatted by biome. The strings are the same, I just manually formatted string a in a different way than b which results in a different output. I see that even prettier has the same output as biome, but i believe if the strings are the same just with different whitespaces, the end result should be same. Biome seems to agree with me since when I copy the output of the first iteration and format it again, it makes both string a and b the same, the only problem being that it violates the line width of 80 and places everything in a single line when the line can be broken down. Prettier does not change its output (the 2 strings are not formatted the same, but the number of runs does not change its output). This is weird now since the output also depends on how many times biome is run. This might be a weird edge case and is problematic since now I have to be aware of the initial whitespace placement as well and if anything changes after multiple runs |
Thank you for your reply, I probably found the problem location, let me see how to fix it |
Environment information
Configuration
Playground link
original
refined thanks @suxin2017!
Code of Conduct
The text was updated successfully, but these errors were encountered: