Re:JavaScript variables: var and let and const
by _bxg1 on Friday March 06, 2020 @03:38PM
(#22507101)
And in TypeScript you can at least pair it with Readonly<...>, though that unfortunately still isn't recursive
[ Parent
| on HN ]
Re:JavaScript variables: var and let and const
by ht85 on Friday March 06, 2020 @04:36PM
(#22507557)
Nice plugin to make sure you never mutate: https://github.com/jonaskello/tslint-immutable/tree/master/t...
You can add a rule based on the name of the variable to allow mutating (e.g. naming it `mutableSomething`)
Re:JavaScript variables: var and let and const
by _bxg1 on Friday March 06, 2020 @05:10PM
(#22507812)
Interesting, but not really tractable if you have to manually add every single variable to the rules config.
Re:JavaScript variables: var and let and const
by chaorace on Friday March 06, 2020 @06:04PM
(#22508205)
The plugin allows pattern-based exceptions.
For example, if your rule excluded variables with a "mutable" prefix, you could name your variable mutableSomething and it will be automatically ignored by the linter