mediamonks / frontend-coding-standards

Media.Monks - Frontend Coding Standards
60 stars 23 forks source link

Remove `Globally used constants` from Coding Standards #101

Open ThijsTyZ opened 2 years ago

ThijsTyZ commented 2 years ago

At the moment we have different casing for "Globally used constants", see https://github.com/mediamonks/frontend-coding-standards#globally-used-constants This rule got introduced back in the days when we only had var and there was no way to make something "read only". We no longer need this rule.

Also it's too vague what "global" means. We should avoid having vague rules in our standards.

Do you agree?

ThaNarie commented 2 years ago

I agree that the rule itself doesn't have a proper explanation or examples.

But I don't agree that we should outright remove it. I'd rather replace the name with something like module level constant, and keep them.

IMO there is still value in visually seeing what the intent of a variable is. But maybe that's just something we got used to.

The counter argument is that we almost got rid of almost everything else.

Only classes/types/enums are left with PascalCase, and these CONSTs.

For reference, the AirBnB reasoning: https://github.com/airbnb/javascript#naming--uppercase