-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
Discussed in #15196
Originally posted by macgyver August 1, 2023
Just wondering if anybody can explain the formatting philosophy of converting a line like
const { section, rubric, authors, tags } = await utils.upsertCommonData(mainData);into this:
const { section, rubric, authors, tags } = await utils.upsertCommonData(
mainData
);vs. this:
const { section, rubric, authors, tags } =
await utils.upsertCommonData(mainData);or even
const { section, rubric, authors, tags }
= await utils.upsertCommonData(mainData);(though I recognize that putting operators at the start of a line is controversial)
it seems like keeping the code on two lines vs. three is more parsimonious in terms of vertical space, and groups the concepts better by dividing the code neatly into variable names, and assigned values. Having mainData dangling by itself at the end there just doesn't read that well (to me at least).
What do other folks think? Is there a bigger concept at play here that prevents this from being the behavior? Thanks for your time and insights.
My guess is that Prettier is trying to produce the longest line it can without exceeding the maximum line length, but in cases like this my feeling is that balancing the length of the lines it produces or trying to reduce the total number of lines produced would be a prettier result.