Playground
Originally posted here: rome/tools#3734
Consider the following code:
export function supported(): boolean {
return !!(
// biome-ignore lint/complexity/useOptionalChain: optional chaining creates more complicated ES2019 code
navigator.credentials &&
navigator.credentials.create &&
navigator.credentials.get &&
window.PublicKeyCredential
);
}
The biome-ignore
comment works as intended.
However, as the playground shows, the formatter introduces parentheses around the &&
logic:
export function supported(): boolean {
return !!(
// biome-ignore lint/complexity/useOptionalChain: optional chaining creates more complicated ES2019 code
(
navigator.credentials &&
navigator.credentials.create &&
navigator.credentials.get &&
window.PublicKeyCredential
)
);
}
This disconnects the biome-ignore
comment, which in turn causes the linter to error again.
The suppression comment should be taken into account after the code is formatted.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too