Replies: 9 comments 2 replies
-
|
For reference from Ruby with the main linter there, Rubocop defaults to 120: https://docs.rubocop.org/rubocop/cops_layout.html#layoutlinelength |
Beta Was this translation helpful? Give feedback.
-
|
Dig it, at 100.
|
Beta Was this translation helpful? Give feedback.
-
|
I support print width of 100 but to be the devil's advocate, most people prompt AI from the sidebar of their IDE and print width of 100 might be too wide when people have sidebar open on both sides. |
Beta Was this translation helpful? Give feedback.
-
|
We always change our defaults to 120. Working at 80 even with 2 sidebars sucks. I even prefer line wrap + 120 to having strict 80. |
Beta Was this translation helpful? Give feedback.
-
|
Keep your compatibility and gain more adoption. |
Beta Was this translation helpful? Give feedback.
-
|
At work, we use 120 in every language (PHP, JS, Dart) and it fits very well. In my experience, meaningful names for variables and methods require space to not break the reading flow. At the same time, something greatest than 120 should be split in more lines because of one of these reasons:
Another reason: today most of the code is TypeScript and writing the type requires space |
Beta Was this translation helpful? Give feedback.
-
|
45–90 characters is the general rule of thumb for line length typographically, so I think 100 makes sense as a good default |
Beta Was this translation helpful? Give feedback.
-
|
80 is great when you use two panels on a 14", if you don't use a sidebar. Also makes 3 panels on a 27" an option. I tend to advocate for using the defaults, especially when they're long established, but if oxfmt diverges from every other js/ts formatter, we'll have to customise that to go back to 80. It's also a non-starter on any project that is using 80 if you don't want your immediate inline git blame to become entirely useless. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
One of my goals for oxfmt is zero configuration.
Across all the repositories I’ve set up, I’ve always had to change
printWidthto 120 because the default of 80 isn’t wide enough.Many projects configure their print width above 80, despite Prettier recommending otherwise (https://prettier.io/docs/options#print-width).
Some reasons include:
It occurred to me that I’ve never set a
printWidthfor Rust, and only discovered today that Rust’s default is 100. Research also shows that newer programming languages use 100.After comparing 100 and 120, I find 100 more pleasant and easier to read. With 120, my eyes have to travel significantly farther across the screen. 120 may also be too wide for IDEs that have left and right sidebars on a 14 inch laptop.
Therefore, I propose changing the default to 100.
I believe this breaking change is acceptable for existing projects because:
printWidth: oxfmt:--migrate prettier#15849.editorconfig’smax_line_lengthwill continue to work as expected: oxfmt: respect.editorconfig#15850printWidth = 100easier to read.Overall, this should remove one line of setting or a configuration file for some projects.
Bonus point: larger
printWidth= less LLM tokens.Github searches:
printWidth: 100: 24.4k https://github.com/search?q=printWidth%3A+100&type=codeprintWidth: 120: 27.3k https://github.com/search?q=printWidth%3A+120&type=codeChatGPT on default width:
printWidth).max_width = 100; chosen for Rust ergonomics.ColumnLimit = 80for LLVM/Google styles.lineLength = 100.maximum-line-length = 80.margin = 80.Beta Was this translation helpful? Give feedback.
All reactions