Closed epreston closed 1 year ago
Issue reported on 29.3.0
Retesting for 29.4.0 update.
It is related to:
Do you have ideas how to fix?
The way I would fix is by excluding property accessors from this rule.
I've only given it 10 minutes thought but, I can't think of how these would can be made constant.
Even a typescript enum gets boiled down to a mutable object.
Typescript example:
enum Direction {
Up,
Down,
Left,
Right
}
Gets converted to this javascript
const Direction = {
Up: 'Up',
Down: 'Down',
Left: 'Left',
Right: 'Right'
};
Only things know of is:
compute
tries to determine value of AST node, you can change the code and check if it affects all 🐊Putout tests, if not we can change implementation.
But better to start from #139, it is much simpler.
Sounds good. I'll start from there.
Fixed with 20f19c8, landed in @putout/operate@8.10.0
🎉 . Please re-install 🐊Putout.
Is it works for you?
Package: conditions/convert-comparison-to-boolean Issue: non constant members are seen as constant by this rule
Example:
I am guessing that this rule sees the constant declaration of the reference to the object and treats all members as constant.