๐ 1.9.4 formatter regression in comparision to 1.8.3
Closed this issue ยท 13 comments
Environment information
There is a difference in 1.9.4 vs 1.8.3
currently the playground is at 1.8.3 (link below) and formatting is proper:
code sample:
declare module "#shopware" {
export type Schemas = import("@shopware/api-client/store-api-types").components["schemas"];
}
in 1.8.3 formatted to
declare module "#shopware" {
export type Schemas =
import("@shopware/api-client/store-api-types").components["schemas"];
}
but with 1.9.4 (IDE plugin is at that version as well so overriding CLI on save):
declare module "#shopware" {
export type Schemas = import(
"@shopware/api-client/store-api-types",
).components["schemas"];
}
the difference in the syntax tree:
1.8.3
JsExport -> TsTypeAliasDeclaration -> TsIndexedAccessType -> TsImportTypeArguments -> arguments: TsImportTypeArguments โ
1.9.4
JsExport -> TsTypeAliasDeclaration -> TsIndexedAccessType -> TsImportType -> arguments: JsCallArguments โ
the biggest problem is that it causes a Type error (which 1.8.3 detects expected ")" but instead found ","
)
Let me know if you need any more info!
### Configuration
```JSON
{
"formatter": {
"indentStyle": "space"
}
}
Playground link
Code of Conduct
- I agree to follow Biome's Code of Conduct
The playground doesn't show any errors, and it matches Prettier. I am not sure what the error is, but it's not a bug regarding the formatter.
Are you sure that it's Biome formatting your code in the IDE?
@ematipico as I wrote in the issue - playground is on version 1.8.3 so the output is correct! The problem is with the 1.9.4, unfortunately playground does not have "version switcher" so cannot link to that - that's why I posted the outcome and the tree from 1.9.4 (doesn't matter if that's IDE formatting or CLI formatting)
But how do you know it's version 1.8.3? Our playground is a mirror of main
, and it's currently compiled from commit https://github.com/biomejs/biome/tree/d80805762cd1efdeaafd2e9d542270bfced8e8f4
If the playground isn't enough to provide a good reproduction, I suggest you to use our interactive CLI
Hello @patzick, please provide a minimal reproduction. You can use one of the following options:
- Provide a link to our playground, if it's applicable.
- Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via
npm create @biomejs/biome-reproduction
Issues marked with S-Needs repro
will be closed if they have no activity within 3 days.
@ematipico thanks for pointing to the interactive CLI. Here's the reproduction:
https://github.com/patzick/biome-repro-1733240301041
I assumed that the playground is on main, that's why debugging took me a lot of time, but website dependencies points to 1.8.3 so I really believe it's on the older version.
but website dependencies points to 1.8.3 so I really believe it's on the older version.
That's what the repository uses to format and check the source code, it isn't the WASM version used by the playground.
@ematipico understand - still the repo is showing you the difference and the same difference is when you switch between these versions. So playground is working as it would be on the older version. Can you see it now with the additional repo or should I provide something more?
FYI Your repro doesn't have the original snippet you posted here.
When I format your original code with 1.9.4, I do not get what you posted here. I get exactly what shows in the playground (which, as ematipico said, is on main
, not 1.8.3). The current formatting matches prettier, which is correct behavior.
@dyc3 thanks for jumping in!
So just to be clear if we understand each other - you're saying if you:
- checking our reproduction repository
- doing
pnpm i
- replacing the code with input snippet https://github.com/patzick/biome-repro-1733240301041/blob/main/src/index.ts#L11-L14
- running
pnpm run format
- you have different result than this: https://github.com/patzick/biome-repro-1733240301041/blob/main/src/index.ts#L17-L21 ?
I won't argue whether the playground has or has not different version, it's not showing anywhere so I'm not sure - but the reproduction repo is clearly showing that code from step 3. is formatted into code from step 5.
When I change the version in package.json to 1.8.3 - then it works the same as playground -> correctly
I must've done something wrong before because now I'm reproducing the behavior. I believe this is a duplicate of #4426, which has already been fixed. We haven't released another version yet. You could use a nightly release if you need the fix right away.
whether the playground has or has not different version, it's not showing anywhere so I'm not sure
The playground displays the git commit that the playground is currently on here, on the right side in the header above the formatted code:
Thanks @ematipico and @dyc3
Yeah that looks like a fix and in fact duplicated issue - could you point me to the planned release date? It would be nice to also have a working IDE plugin :)
We don't do ETAs, but we're now working towards 2.0 so it will take more time for the next release.
If you're referring to the intellij plugin, you're more than welcome to help, because we don't have the knowledge and manpower to maintain it.