cssinjs / styled-jss

Styled Components on top of JSS.
http://cssinjs.org/styled-jss
MIT License
217 stars 25 forks source link

Code Style: express acronyms in capital space #8

Closed DenisIzmaylov closed 7 years ago

DenisIzmaylov commented 7 years ago

Basic requirements:

Current state:

lttb commented 7 years ago

Thanks for watching! And there is also a rule about capitalized acronyms here https://github.com/airbnb/javascript#naming--Acronyms-and-Initialisms

So we have discussed a little with @kof (https://github.com/cssinjs/styled-jss/pull/1#discussion_r112584469, https://github.com/cssinjs/styled-jss/pull/1#discussion_r112573844) about this style too, and I see this way:

DenisIzmaylov commented 7 years ago

This rule ( https://github.com/airbnb/javascript#naming--Acronyms-and-Initialisms ):

Acronyms and initialisms should always be all capitalized, or all lowercased.

Provides a two variants. More variants - more complexity and errors. I'd just like to see less complexity and less errors in our projects.

use lowercase for instances, PascalCase for classes/constructors

This rule is not applying for acronyms according to the rule above.

use strict camelCase for everything except CONSTANTS

As I provided the examples in the original post - native API is not satisfying to this rule.

Generally the developers asking themself in trying to write code at first time:

It means - a new custom rule will add a cognitive complexity:

P.S.

iamstarkov commented 7 years ago

I don't understand the issue

kof commented 7 years ago

Javascript is not consistent with that as well: for e.g. XMLHttpRequest - even in one word 2 different conventions.

Using strict version is easier, we don't need to think how to name it. Less rules apply. Its also a very popular convention, I would rather stick with this.

iamstarkov commented 7 years ago

me too

kof commented 7 years ago

Also with strictCamelCase its possible to convert from snake_case automatically. Which is often important in the applications when dealing with the http API's which are mostly written in snake.

iamstarkov commented 7 years ago

lets not change anything for now and re-iterate in a few months