solhint icon indicating copy to clipboard operation
solhint copied to clipboard

Remove immutable state vars from var-name-mixedcase

Open gitpusha opened this issue 5 years ago • 4 comments

Like constant state vars I also like to snake-case my immutable state vars because it makes it easier to spot in my code where I am relying on immutable values.

image

However, currently this clashes with two rules I also use:

  1. var-name-mixedcase forces me to also make immutable mixed-case

  2. const-name-snakecase does not force me to make immutable snake-case

I would like to propose one of the following alterantives as feature requests:

Alternative 1: New rule: immutable-name-snakecase that when turned on overrides the var-name-mixedcase rules.

Alternative 2: strict option for var-name-mixedcase which when false does not include immutable vars && strict option for const-name-snakecase that when true also forces immutable vars to be snakecase

gitpusha avatar Nov 05 '20 10:11 gitpusha

I ran into this as well.

I would actually suggest that immutable variables should be treated exactly like constant variables as far as these rules are concerned (var-name-mixedcase and const-name-snakecase).

I don't think new rules or options are necessary.

frangio avatar Nov 20 '20 22:11 frangio

I guess some people still like to make immutable vars mixed-case because they do not have to be initialized like constant vars and that sort of sets them apart.

So I think having the extra immutable-name-snakecase rule would be benificial for both groups.

gitpusha avatar Nov 23 '20 06:11 gitpusha

yes please!

hellwolf avatar Nov 23 '20 17:11 hellwolf

How are we on this? I had this issue too, and I also support the idea of having immutable-name-snakecase.

BravoNatalie avatar Jun 08 '22 17:06 BravoNatalie