ITADN

`prefer-minimal-ternary` does ignore `this` binding expressions and other similar when prefix is the same

#3273OpenSimonSchick 创建于 2026-06-16
bug
S
SimonSchickcommented
<!-- ✨ Thanks for reporting a bug! ➡️ Please don't ignore this template --> The rule seems to be incorrectly flagging some code that should not be `minimalized`. Example 1: `const font = node.fontFamily === 'custom' ? node.customFontFamily : node.fontFamily;` `const diffRatio = Math.abs(diff.value) / (diff.axis === 'x' ? this.maxWidth : this.maxHeight);` etc. This is especially problematic for expressions such as `const a = b ? c.a() : c.b()` where there is no real alternative other than `const a = c[b ? 'a' : 'b']()` which imo is arguably worse. I'm not sure if this is expected but this makes the rule generally pretty noisy and useless.
0 条评论