I am trying Prettier out in a project using React and Typescript. However I am having a problem configuring multi-line if / else statements.
When I write:
if (x >=0) {
// Do something
}
else {
// Do something else
}
Prettier reformats it to:
if (x >=0) {
// Do something
} else {
// Do something else
}
I added this rule to my tslint file: "one-line": false
, but Prettier is still formatting my statements.
Is this a core rule of Prettier that can't be changed through the tslint config or am I doing something wrong?
My tslint.json is:
{
"extends": [
"tslint:recommended",
"tslint-react",
"tslint-config-prettier"
],
"rules": {
"prettier": true,
"interface-name": false,
"no-console": [
true,
"log",
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"one-line": false
},
"rulesDirectory": [
"tslint-plugin-prettier"
]
}
and my .prettierrc file is:
{
"trailingComma": "es5",
"printWidth": 80,
"semi": true,
"tslintIntegration": true,
"eslintIntegration": true,
"jsxSingleQuote": true,
"singleQuote": true
}
tslint
, I could change its configuration and make it go away. – Monandry