The documentation says printWidth. The documentation link is here
printWidth: 120
Probably this should solve the problem.
Answer from Prakash Dahal on Stack OverflowThe documentation says printWidth. The documentation link is here
printWidth: 120
Probably this should solve the problem.
You can add exception for specific regex. Prettier will have the lead for managing imports and exports, since it has a special way to deal with them.
// edit your tslint.json
"max-line-length": [
true,
{
"limit": 140,
"ignore-pattern": "^import |^export {(.*?)}"
}
],
[prettier-vscode] max-line-length does not work
Need help with prettier and vscode
tslintIntegration: max-line-length does not work
Why does Prettier format code like this?
Hello, I am using
"prettier.printWidth": 80 but is not working correctly
The only way to fix it is by is using
"editor.wordWrap": "wordWrapColumn", and then I am getting
Is this a prettier bug ?
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.
Based on ESLint's docs, anything you include in rules take precedence over the rules inherited from extends, meaning you can change the rule's behavior partially or completely.
That means the max-len rule you specified is picked up over the max-len rule from eslint-config-prettier. You have to delete this rule from your config file and ESLint will stop complaining.
I didn't have such a rule in place, but experienced a similar issue, and found adding the following rule to .eslintrc.json did make the annoying line-length error go away:
"rules": { "@typescript-eslint/max-len": "ignore" }