Closed lgarron closed 1 year ago
I'll be honest, I think we should actually deprecate this rule and eventually remove it. The rule was created to cover some niche use cases, but it seems to make more harm - as @lgarron demonstrated.
I'll be honest, I think we should actually deprecate this rule and eventually remove it. The rule was created to cover some niche use cases, but it seems to make more harm - as @lgarron demonstrated.
I don't think we have to remove a rule because of one bug and there's also the option to remove it from the recommended set.
I would like to work on this issue! Let me know if you guys have any concerns.
Environment information
What happened?
Rome issues two
style/noShoutyConstants
errors for the following code, based on a real-world use case:Playground link
Specifically, it says:
This reasoning is faulty, because the constants are used several times each. If I apply the suggested fix, then the minified output increases by 50%[^1]. Further, there are additional downsides:
[^1]: 127 bytes vs. 85 bytes using
npx esbuild --minify src.ts
. That's not taking compression into account, though.Expected result
I would expect
style/noShoutyConstants
not to error (using its current reasoning) at most if a constant is used multiple times. Even for a single use: it is common to regularly change the number of uses of such a constant down to a single use and then later back up, so I would still find it undesirable to have any warning at all.So I'd personally like to advocate for
style/noShoutyConstants
not to be included in the default/recommended rules.Code of Conduct