LoginSignup
5
0
この記事誰得? 私しか得しないニッチな技術で記事投稿!

言語によって、ファイルの命名にルールがあるのが面倒なのでまとめてみた

Last updated at Posted at 2023-07-02

はじめに

※プロジェクトによってのルールがある場合もあります
言語によってファイルの命名規則がちがい、何にどんな命名をすればいいのかわからなくなったので、一度まとめます。

そもそもの命名について

命名規則 由来
キャメルケース camelCase "ラクダ"のこぶに由来
パスカルケース PascalCase "パスカル"というプログラミング言語に由来
スネークケース snake_case "蛇"が這うような形状に由来
ケバブケース kebab-case "ケバブ"の串刺しに見える形状に由来

各言語の命名規則表

ディレクトリ/ファイル 変数 関数 定数 クラス
JavaScript ケバブケース (user-profile) キャメルケース (userName) キャメルケース (getUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
Python スネークケース (user_profile) スネークケース (user_name) スネークケース (get_user_name()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
Java パスカルケース (UserProfile) キャメルケース (userName) キャメルケース (getUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
Ruby スネークケース (user_profile) スネークケース (user_name) スネークケース (get_user_name()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
PHP パスカルケース (UserProfile) スネークケース (user_name) スネークケース (get_user_name()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
C# パスカルケース (UserProfile) キャメルケース (userName) パスカルケース (GetUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)

JavaScriptフレームワークごとの命名規則表

フレームワーク ディレクトリ/ファイル 変数 関数 定数 クラス
JavaScript (Vanilla) ケバブケース (user-profile) キャメルケース (userName) キャメルケース (getUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
React.js パスカルケース (UserProfile) キャメルケース (userName) キャメルケース (getUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
Vue.js パスカルケース (UserProfile) キャメルケース (userName) キャメルケース (getUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
Angular ケバブケース (user-profile) キャメルケース (userName) キャメルケース (getUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)
Ember.js ケバブケース (user-profile) キャメルケース (userName) キャメルケース (getUserName()) 大文字スネークケース (MAX_COUNT) パスカルケース (UserProfile)

注意
GPT4.0にて作成してます。正確な情報が欲しい場合は検索してください。

最後に

迷ったら、この記事を見ます。

5
0
1

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
5
0