Skip to content

Commit 9f51fd2

Browse files
kesneJordan Gensler
authored andcommitted
[guide] Add notes on acronyms and initialisms to naming
1 parent c4a9d28 commit 9f51fd2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,6 +2761,36 @@ Other Style Guides
27612761
export default AirbnbStyleGuide;
27622762
```
27632763
2764+
<a name="naming--Acronyms-and-Initialisms"></a>
2765+
- [22.9](#naming--Acronyms-and-Initialisms) Acronyms and initialisms should always be all capitalized, or all lowercased.
2766+
2767+
> Why? Names are for readability, not to appease a computer algorithm.
2768+
2769+
```javascript
2770+
// bad
2771+
import SmsContainer from './containers/SmsContainer';
2772+
2773+
// bad
2774+
const HttpRequests = [
2775+
// ...
2776+
];
2777+
2778+
// good
2779+
import SMSContainer from './containers/SMSContainer';
2780+
2781+
// good
2782+
const HTTPRequests = [
2783+
// ...
2784+
];
2785+
2786+
// best
2787+
import TextMessageContainer from './containers/TextMessageContainer';
2788+
2789+
// best
2790+
const Requests = [
2791+
// ...
2792+
];
2793+
```
27642794
27652795
**[⬆ back to top](#table-of-contents)**
27662796

0 commit comments

Comments
 (0)