-
I don't use Prettier in a specific project, but I do want some formatting rules (brake spacing, etc), for which I've been using ESLint. Is it possible to use Biome as a formatter (JS) without enforcing a specific line width? I tried using |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I agree, this is why I am looking for a new formatter. I need a formatter that lets the writer decide where to break the code. Prettier closed the discussion on this. Syntax-highlighted code isn't read like paragraphs in a book, from left to right, top to bottom. People jump around looking for keywords and symbols. Sometimes the keywords and symbols are predictable and can be hidden off the page, but other times you might want to call attention to them. I wish I could break the format intentionally: const boilerplateStuff = ["dont", "worry", "about", "these"]
const moreBoilerplate = ["more", "stuff", "you", "don't", "need", "to", "focus", "on"]
const extraBoilerplateStuff = ["extra", "boilerplate", "that", "is", "not", "important"]
const importantStuff = [
"gee",
"these",
"seem",
"important"
] Other times, I want to apply a consistent format, but the line length enforcement doesn't allow: { orderId: 1, customerName: "John Doe", orderTotal: 99.99, status: "Delivered" },
{ orderId: 2, customerName: "Jane Smith", orderTotal: 99.99, status: "Delivered" },
{
orderId: 3,
customerName: "AnUnfortunately LongName",
orderTotal: 99.99,
status: "Delivered"
},
{ orderId: 4, customerName: "Bob Brown", orderTotal: 99.99, status: "Delivered" }, |
Beta Was this translation helpful? Give feedback.
-
FYI, we have a page that talks about the Biome formatter option philosophy: https://biomejs.dev/formatter/option-philosophy/ |
Beta Was this translation helpful? Give feedback.
-
It would be great to have the Please see the examples here: https://eslint.org/docs/latest/rules/array-element-newline#consistent There are a lot of existing discussions around this issue in the prettier ecosystem:
Edit: When the developer decides to wrap every array item on an own line usually this is on purpose and Biome shouldn't revert this decision of the developer. Wrapping each item on an own line improves readability, quicker reordering of items and when working in a team it leads to less complex merge conflicts, when multiple developers change the same array. |
Beta Was this translation helpful? Give feedback.
Have you tried dprint? I think it could fulfill your needs.
Personally, I like the idea of a way to turn off auto-wrapping. However, this could be a significant change to the way Biome works. Also, it is not a high priority change, as it is already a lot of work to adjust Prettier.