After updating to 3.1.0 with the default ternary formatting, Prettier is sometimes using spaces for indentation even if it's configured to use tabs.
Prettier 3.1.0
Playground link
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"semi": true,
"singleQuote": false,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"trailingComma": "all",
"singleAttributePerLine": false,
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false,
"proseWrap": "preserve",
"insertPragma": false,
"printWidth": 80,
"requirePragma": false,
"tabWidth": 2,
"useTabs": true,
"embeddedLanguageFormatting": "auto"
}
Input:
const Blah = () => {
return (
<a
c={
loooooooooooooooooong
? alsolooooooong
? gaaaaaaaaa
: ggggggggg
? b
: c
: d
}
/>
);
}
Output:
const Blah = () => {
return (
<a
c={
loooooooooooooooooong
? alsolooooooong
? gaaaaaaaaa
: ggggggggg
? b
: c
: d
}
/>
);
};
Expected behavior:
It should always use tabs.
const Blah = () => {
return (
<a
c={
loooooooooooooooooong
? alsolooooooong
? gaaaaaaaaa
: ggggggggg
? b
: c
: d
}
/>
);
};
After updating to 3.1.0 with the default ternary formatting, Prettier is sometimes using spaces for indentation even if it's configured to use tabs.
Prettier 3.1.0
Playground link
{ "arrowParens": "always", "bracketSameLine": false, "bracketSpacing": true, "semi": true, "singleQuote": false, "jsxSingleQuote": false, "quoteProps": "as-needed", "trailingComma": "all", "singleAttributePerLine": false, "htmlWhitespaceSensitivity": "css", "vueIndentScriptAndStyle": false, "proseWrap": "preserve", "insertPragma": false, "printWidth": 80, "requirePragma": false, "tabWidth": 2, "useTabs": true, "embeddedLanguageFormatting": "auto" }Input:
Output:
Expected behavior:
It should always use tabs.