Closed deanrih closed 2 weeks ago
I was expecting "preserve" means preserve any quote around the properties if it has any, but instead biome removes it anyway, or is it intended behaviour? if so, is there a way to "preserve" the quote around object properties?
I think you are mistaken: the formatter doesn't remove them if you enabled set preserve
on quoteProperties
. It is certainly the useLIteralKeys
linter rule that removes them. Try to disable complexity/useLIteralKeys
.
I think you are mistaken: the formatter doesn't remove them if you enabled set
preserve
onquoteProperties
. It is certainly theuseLIteralKeys
linter rule that removes them. Try to disablecomplexity/useLIteralKeys
.
if by disabling you mean setting it to "off"
then I did and it still remove the quote, also I don't think useLiteralKeys
should affect formatting, when useLiteralKeys
is on, it only shows an error on something like
const someObject = {
name: "My Name",
};
console.log(someObject["name"]);
^^^^^^^^
it will show an error under ["name"]
and suggest to use .name
instead, doing format doesn't delete quote, and also when the useLiteralKeys
having
interface Test {
"propOne": string;
}
doesn't show any error like useLiteralKeys
supposed to, and furthermore, it's linter
, it shouldn't remove or affect the decision to remove anything, so I'm not sure if it's really caused by complexity/useLiteralKeys
when useLiteralKeys is on, it only shows an error on something like
Oh yeah, we changed the rule some versions ago to avoid conflicts with qyoteProperties
.
Ignore my previous comment.
Thus, we need a reproduction. The Playground link that you posted has a biome-ignore comment and is not properly set (quotePropeties
is not set to preserve
).
If I remove the biome-ignore-comment and set quotePropeties
to preserve
, then Biome outputs the expected behavior: it preserves the quotes.
Hello @deanrih, please provide a minimal reproduction. You can use one of the following options:
npm create @biomejs/biome-reproduction
Issues marked with S-Needs repro
will be closed if they have no activity within 3 days.
Thus, we need a reproduction.
The playground does actually work, and I forgot to set the quoteProperties
setting there, but I set it in my local machine but the behaviour is differen, it has a good chance that this is a version issue, is there a way to change version in the playground? I'm having a hard time finding it and the only thing that suggest currently used version on the playground is just beneath the Formatter section tab Biome <commit hash>
The Playground uses the main
branch of the Biome repository. We released Biome 1.9.4 yesterday, thus you should get the same behavior with Biome 1.9.4.
well, I'm on 1.9.4
[deanrih@aqua project]$ bunx biome --version
Version: 1.9.4
Thus, we need a reproduction.
The playground does actually work, and I forgot to set the
quoteProperties
setting there, but I set it in my local machine but the behaviour is differen, it has a good chance that this is a version issue, is there a way to change version in the playground? I'm having a hard time finding it and the only thing that suggest currently used version on the playground is just beneath the Formatter section tabBiome <commit hash>
Maybe it's best if you create a minimal reproduction in a repository, so we can have a look. Maybe there's some misconfiguration, or a bug in the CLI that doesn't affect the playground. This message tells you how to create a minimal repository using our CLI
Okay, while I was creating minimal reproduction repository, I found some inconsistencies with my main repo (which is why it took me some time), after fighting through I nailed down the problem, it's most likely the CLI couldn't find the configuration file or I put the configuration file wrong between git rebase or something, probably the reason why I didn't suspect this at start because some of rule worked just fine (probably before the file moved after some git rebase) and then I hit a condition where I require the quoteProperties
feature, so it's safe to say, it's all working as intended. Sorry for the inconvenience.
Environment information
Configuration
Playground link
https://biomejs.dev/playground/?code=LwAvACAAYgBpAG8AbQBlAC0AaQBnAG4AbwByAGUAIABmAG8AcgBtAGEAdAA6ACAALQAKAGkAbgB0AGUAcgBmAGEAYwBlACAASgBXAFQASABlAGEAZABlAHIAUwBwAGUAYwAgAHsACgAJAC8AKgAqAAoACQAgACoAIABBAGwAZwBvAHIAaQB0AGgAbQAKAAkAIAAqAC8ACgAJACIAYQBsAGcAIgA6ACAAIgBIAFMAMgA1ADYAIgAgAHwAIAAiAEgAUwAzADgANAAiACAAfAAgACIASABTADUAMQAyACIAOwAKAAkALwAqACoACgAJACAAKgAgAEoAVwBLACAAUwBlAHQAIABVAFIATAAKAAkAIAAqAC8ACgAJACIAagBrAHUAIgA6ACAAcwB0AHIAaQBuAGcAOwAKAAkAIgBqAHcAawAiADoAIABzAHQAcgBpAG4AZwA7ACAAIAAgACAAIAAgAC8ALwAgACgASgBTAE8ATgAgAFcAZQBiACAASwBlAHkAKQAgAEgAZQBhAGQAZQByACAAUABhAHIAYQBtAGUAdABlAHIACgAJACIAawBpAGQAIgA6ACAAcwB0AHIAaQBuAGcAOwAgACAAIAAgACAAIAAvAC8AIAAoAEsAZQB5ACAASQBEACk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