The documentation says printWidth. The documentation link is here

printWidth: 120

Probably this should solve the problem.

Answer from Prakash Dahal on Stack Overflow
🌐
Prettier
prettier.io › docs › options
Options · Prettier
Specify the line length that the printer will wrap on. ... In code styleguides, maximum line length rules are often set to 100 or 120. However, when humans write code, they don’t strive to reach the maximum number of columns on every line.
Discussions

[prettier-vscode] max-line-length does not work
When setting tslintIntegration to true, prettier does not take into account its print-width rule anymore, neither it takes the max-line-length rule from tslint for formatting line length. When form... More on github.com
🌐 github.com
9
August 19, 2018
Need help with prettier and vscode
It's a prettier feature: https://prettier.io/docs/en/options.html#print-width Prettier’s printWidth option does not work the same way (as max line length). It is not the hard upper allowed line length limit. It is a way to say to Prettier roughly how long you’d like lines to be. Prettier will make both shorter and longer lines, but generally strive to meet the specified printWidth. Also, in your case, it would be bad if prettier formatted the CLIENTID by inserting newlines thus changing the value. Configuring the IDE to wrap lines visually is the proper solution here. More on reddit.com
🌐 r/vscode
3
2
December 14, 2020
tslintIntegration: max-line-length does not work
When setting tslintIntegration to true, prettier does not take into account its print-width rule anymore, neither it takes the max-line-length rule from tslint for formatting line length. When form... More on github.com
🌐 github.com
2
August 18, 2018
Why does Prettier format code like this?
If you use Git for version control, you will notice that your diffs are based on lines that have changed from one version to another. By breaking your tag attributes onto individual lines, it's much easier to see exactly what changed in a diff at a glance. More on reddit.com
🌐 r/vscode
15
21
June 9, 2019
🌐
GitHub
github.com › prettier › prettier › issues › 12424
Default 80 character line limit is too limiting · Issue #12424 · prettier/prettier
March 9, 2022 - And, we should not write JavaScript like we write C. If I have a variable called permission, I should not rename it to perm just to make sure I do not go beyond the 80 character line limit.
Author: prettier
🌐
GitHub
github.com › azz › prettier-tslint › issues › 15
[prettier-vscode] max-line-length does not work · Issue #15 · azz/prettier-tslint
August 19, 2018 - When setting tslintIntegration to true, prettier does not take into account its print-width rule anymore, neither it takes the max-line-length rule from tslint for formatting line length. When formatting files, it acts as if the print-wi...
Author: azz
🌐
StudyRaid
app.studyraid.com › en › read › 15038 › 520131 › setting-line-length-limitations-in-prettierjs
Understand setting line length limitations in Prettier.js
Prettier reformats code to wrap lines exceeding this limit, prioritizing readability while maintaining the specified constraint. Line length impacts code density and readability. Higher values (e.g., 120) reduce line breaks but may hinder readability on narrower screens.
🌐
GitHub
github.com › prettier › prettier › discussions › 17232
80 characters per line of code in the codebase · prettier/prettier · Discussion #17232
Under normal conditions (no really long strings), 80 really is the hard max though. My finding was that at 80 I would often remove letters from variable names just to make the code format better, so I decided ultimately that 80 was too extreme ...
Author: prettier
Find elsewhere
🌐
Prettier
prettier.io › docs › rationale
Rationale · Prettier
The printWidth option is more of a guideline to Prettier than a hard rule. It is not the upper allowed line length limit. It is a way to say to Prettier roughly how long you’d like lines to be.
🌐
Azz
azz.github.io › prettier › docs › en › options.html
Options · Prettier
Prettier ships with a handful of customizable format options, usable in both the CLI and API. Specify the length of line that the printer will wrap on.
🌐
GitHub
github.com › prettier › prettier-vscode › issues › 557
tslintIntegration: max-line-length does not work · Issue #557 · prettier/prettier-vscode
August 18, 2018 - When setting tslintIntegration to true, prettier does not take into account its print-width rule anymore, neither it takes the max-line-length rule from tslint for formatting line length. When formatting files, it acts as if the print-wi...
Author: prettier
🌐
ESLint
eslint.org › docs › latest › rules › max-len
max-len - ESLint - Pluggable JavaScript Linter
The length of a line is defined as the number of Unicode characters in the line. This rule can have up to two numbers as positional arguments (for code and tabWidth options), followed by an object option (provided positional arguments have priority): "code" (default 80) enforces a maximum line length
🌐
Prettier
prettier.io › docs
What is Prettier? · Prettier
Prettier enforces a consistent code style (i.e. code formatting that won’t affect the AST) across your entire codebase because it disregards the original styling* by parsing it away and re-printing the parsed AST with its own rules that take the maximum line length into account, wrapping code when necessary.
🌐
Hacker News
news.ycombinator.com › item
While it's always great to see performance gains, my largest pain point with pre... | Hacker News
November 28, 2023 - Would it be realistic to expect a solution for this issue now that "prettier needs to step up it's game" · So we'd end up discussing what is the best choice. I bet I'd also end up discussing those things with Anthony Fu. If the limit is 80, then the limit is 80, not 81
🌐
Reddit
reddit.com › r/vscode › why does prettier format code like this?
r/vscode on Reddit: Why does Prettier format code like this?
June 9, 2019 -

I've tried a couple of auto formatters, because I'm always forgetting to format things properly, and just want to make my life easier. However I always seem to run into a weird issue like this one:

<img

alt="My photo goes here"
src="img/user.jpg"
class="user-nav__user-photo"
/>

Why does it format code like this? What's the point? It's not outside my VS code window, it's not even longer than the comment right above it, or even the span two lines above it. So what gives? I've never seen an image tag written this way. In case it doesn't show up, img is one one line, the attributes are all on separate lines, and the ending /> is also on a separate line.

🌐
OpenReplay
blog.openreplay.com › openreplay blog › using prettier with vscode to write javascript
Using Prettier with VSCode to write JavaScript
June 7, 2023 - For example: { "printWidth": 100, "tabWidth": 2, "useTabs": false, "semi": true, "singleQuote": true, "trailingComma": "es5" } This configuration specifies a maximum line length of 100 characters, a tab width of 2 spaces, using spaces instead ...
🌐
GitHub
github.com › azz › prettier-tslint › issues › 25
Translate TSLint max-line-length into Prettier printWidth automatically · Issue #25 · azz/prettier-tslint
December 10, 2018 - Prettier's printWidth defaults to 80, which (if left unchanged) makes TSLint's max-line-length look broken. The reality is that users should be using Prettier options to control the maximum line length. To ease the pain, this package cou...
Author: azz
🌐
GitHub
github.com › prettier › prettier › issues › 15446
Change behavior of `max_line_length = off` to ignore line breaks · Issue #15446 · prettier/prettier
September 23, 2023 - This is relevant: #14514 When I discovered the "max_line_length = off" option, and that Prettier supported it, I expected Prettier to leave newlines alone, and let me add them inn where I thought appropriate. Instead I got super long lin...
Author: prettier
🌐
LogRocket
blog.logrocket.com › home › using prettier and eslint for javascript formatting
Using Prettier and ESLint for JavaScript formatting - LogRocket Blog
October 22, 2024 - Prettier does not have a specific configuration option for maximum line length. Instead, it formats the code according to its own rules.