I'm using VSCode with prettier plugin and typescript and also tslint.
Leaving aside the convenience to use this configuration, I get a
[tslint] Exceeds maximum line length of 120 (max-line-length)
For a line like this:
import { MyComponent } from "../../some_very_long_path";
I've prettier configured with a print-width of 100, so I was expecting that on Format Document
this line would be refactored into something like this:
import { MyComponent }
from "../../some_very_long_path";
or like this:
import {
MyComponent
} from "../../some_very_long_path";
But it is not. Any ideas why?
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 is not breaking down imports and the best thing you can do is to remove all the stylistic errors (including the max-line-length) from tslint rules and let Prettier to handle those and tslint the code related ones.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With