Replies: 1 comment 1 reply
-
Sounds like a nice suggestion! PRs are welcome 🤗 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Qq: may I request to add the
ignoreRestSiblings: boolean
option intocorrectness/noUnusedVariables
, like ESLint does?Until #1910, Biome was behaving as if this option was always set to
false
. #1910 changed Biome to behave as if this option is alwaystrue
. However, I believe the preferred behavior is different in different codebases, and I’d love the ability to configure this explicitly.More context
A common pattern to omit keys from an object is to spread it like so:
Until 2024, in the code above,
correctness/noUnusedVariables
would (correctly) flagmodel
andyear
as unused variables. #572 and #1910 changed that, disabling the lint for unused spread members. While this addressed the use case from #572, this made other use cases worse. To give a simplified example:Say I refactor this code and move the whole
year
logic intoAudiCar
,TeslaCar
, and so on. However, in the process, I forget to removeyear
from the destructuring on line 2. TypeScript wouldn’t catch this because theyear
prop is allowed be undefined. And as of #1910,correctness/noUnusedVariables
wouldn’t catch this either. This would result in a likely bug.Ultimately, this boils down to preferences. The author of #572 would prefer to omit properties from objects without any extra visual noise. We at Framer would instead prefer correctness; if you’re not using destructured properties because you want to omit them, you better make it explicit (e.g. with an
// biome-ignore
, or by prefixing the destructured var with a_
). So: may I ask to add an explicit option likeignoreRestSiblings
?Beta Was this translation helpful? Give feedback.
All reactions