LoginSignup
23
9

More than 5 years have passed since last update.

React(Javascript)でファイルの命名規則をどうするかという問題

Last updated at Posted at 2016-01-03

どっちにするべきか悩んだのでgithubのレポジトリで https://github.com/search?o=desc&p=1&q=react&s=stars&type=Repositories&utf8=%E2%9C%93って感じに「react」「Star多い順」で調べてみた。3pageくらいみたところ、結果は以下。

キャメルケース派

FileName.jsってやつ。

https://github.com/erikras/react-redux-universal-hot-example
react-bootstrap/react-bootstrap
gaearon/react-hot-loader

スネークケース派

file_name.jsってやつ。

https://github.com/ruanyf/react-demos
https://github.com/react-toolbox/react-toolbox
https://github.com/reactjs/react-rails
rackt/react-router

ハイフン派

hoge-huga.jsってやつ。
キャメルケースvsスネークケースかとおもいきや、一定数存在した。

react/examples at master · facebook/react
callemall/material-ui
chenglou/react-motion
radium/computed-well.jsx at master · FormidableLabs/radium

まぜまぜ派

facebook/relay

app.jsとかいたり、FileName.jsと書いたりもうなんなんだろうか。

結論:「好きにすればいい」

明確な結論がでました。ありがとうございました。

統一感さえでればいいと思うのでプロジェクトの好みで。

railsが基本的にスネークケースなのでreactxrailsでいくときはよりそのほうが自然なんじゃないかと思う。react-railsのプロジェクトもスネークケースですし。

23
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
9