-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📝 Mixed Tab/Space on ternary #1661
Comments
hum, sorry for the noise, it' doesn't seems to showup in the playground but export const StoryNativeCreate = {
name: 'StoryNativeCreate',
path: 'mobile/editor',
prepareVariables: (_: any, { location }: { location: { query?: { schemaId?: string } } }) =>
location.query?.schemaId
? {
schemaId: location.query.schemaId,
}
: {},
getComponent: () => import(/* webpackChunkName: "native" */ './StoryNativeCreate').then(mod => mod.default),
} seems to be reformated with a double space before the closing |
This isn't a bug, but it's the expected behaviour. Ternaries are indented with spaces, regardless. |
@ematipico thanks for the quick review :) you can see that ternary use tabs without spaces 🤔 |
Ternaries are weird in prettier. The initial indentation is done using the indentation style configured in the options. That indentation is done until the ternary operator starts. Then the formatter adds two spaces for each level of nested condition . Try to add multiple nested conditions and you'll see the difference. Our formatter matches prettier's, so it's consistent. |
ok, i believe you ... but if i run prettier & biome on the same code the result is different ... |
Thank you, that wasn't very clear to me. Can you please provide two playground links, one from biome and one from prettier? We will take a look |
but strangely the biome playground above thinks prettier insert spaces indeed, but it does not ... |
You may be using a different version of prettier. Our playground uses an outdated version of Prettier, but Prettier's Playground uses its latest version. Still, I don't think it's a bug unless we wait for prettier to fix their issue. |
Biome as it is now didn't work out for us 😢 Summary for posterity: * it IS much, much faster, fast enough to skip any sort of caching * we couldn't fully replace Prettier just yet. We use Prettier programmatically to format code in docs, and Biome's JS interface is officially alpha and [had legacy peer deps set](biomejs/biome#1756) (which would fail our CI build as we don't allow installation warnings) * ternary formatting differs from Prettier, leading to a large diff biomejs/biome#1661 * import sorting differs from Prettier's `prettier-plugin-organize-imports`, making the diff even bigger * the deal breaker is a multi-second delay on saving large files (for us it's [Editor.ts](https://github.com/tldraw/tldraw/blob/main/packages/editor/src/lib/editor/Editor.ts)) in VSCode when import sorting is enabled. There is a seemingly relevant Biome issue where I posted a small summary of our findings: biomejs/biome#1569 (comment) Further actions: * reevaluate in a few months as Biome matures ### Change Type - [x] `internal` — Any other changes that don't affect the published package
this awesome! i'll thanks for your work :) i'll let you know when this is testable :) |
Environment information
Configuration
Playground link
https://biomejs.dev/playground/?lineWidth=120"eStyle=single&semicolons=as-needed&arrowParentheses=as-needed&unsafeParameterDecoratorsEnabled=false&code=ZQB4AHAAbwByAHQAIABjAG8AbgBzAHQAIABTAHQAbwByAHkATgBhAHQAaQB2AGUAQwByAGUAYQB0AGUAIAA9ACAAewAKAAkAbgBhAG0AZQA6ACAAJwBTAHQAbwByAHkATgBhAHQAaQB2AGUAQwByAGUAYQB0AGUAJwAsAAoACQBwAGEAdABoADoAIAAnAG0AbwBiAGkAbABlAC8AZQBkAGkAdABvAHIAJwAsAAoACQBwAHIAZQBwAGEAcgBlAFYAYQByAGkAYQBiAGwAZQBzADoAIAAoAF8AOgAgAHMAdAByAGkAbgBnACwAIAB7ACAAbABvAGMAYQB0AGkAbwBuACAAfQA6ACAAewAgAGwAbwBjAGEAdABpAG8AbgA6ACAAewAgAHEAdQBlAHIAeQA%2FADoAIAB7ACAAcwBjAGgAZQBtAGEASQBkAD8AOgAgAHMAdAByAGkAbgBnACAAfQAgAH0AIAB9ACkAIAA9AD4ACgAJAAkAbABvAGMAYQB0AGkAbwBuAC4AcQB1AGUAcgB5AD8ALgBzAGMAaABlAG0AYQBJAGQACgAJAAkACQA%2FACAAewAKAAkACQAJAAkACQBzAGMAaABlAG0AYQBJAGQAOgAgAGwAbwBjAGEAdABpAG8AbgAuAHEAdQBlAHIAeQAuAHMAYwBoAGUAbQBhAEkAZAAsAAoACQAJAAkACQB9AAoACQAJAAkAOgAgAHsAfQAsAAoACQBnAGUAdABDAG8AbQBwAG8AbgBlAG4AdAA6ACAAKAApACAAPQA%2BACAAaQBtAHAAbwByAHQAKAAvACoAIAB3AGUAYgBwAGEAYwBrAEMAaAB1AG4AawBOAGEAbQBlADoAIAAiAG4AYQB0AGkAdgBlACIAIAAqAC8AIAAnAC4ALwBTAHQAbwByAHkATgBhAHQAaQB2AGUAQwByAGUAYQB0AGUAJwApAC4AdABoAGUAbgAoAG0AbwBkACAAPQA%2BACAAbQBvAGQALgBkAGUAZgBhAHUAbAB0ACkALAAKAH0A
Code of Conduct
The text was updated successfully, but these errors were encountered: