backbone-express-spa icon indicating copy to clipboard operation
backbone-express-spa copied to clipboard

File naming conventions

Open joafeldmann opened this issue 11 years ago • 2 comments

Files should be named consistent (e.g. /public/js/apps/home/app.js and /public/js/apps/home ... MainView.js). Further I would suggest using dashes ("main-view.js") instead of using camelcase notation for file names.

joafeldmann avatar May 10 '13 10:05 joafeldmann

My rule of thumb is - the name of file, corresponds to the name of exported entity.

  • If file defines a module (js object), like viewManager, filename - viewManager.js.
  • If file defines a constructor-function, like MainView, filename MainView.js.

I could agree, it's not that consistent as it should be (router.js as example).

Thinking about idea with dashes. I never used that conventions in my projects.. and in terms of consitency with source code, it looks a bit contradictory. But camelCase, does not work better either.

alexbeletsky avatar May 10 '13 13:05 alexbeletsky

Here I can see 'flat' convetion style. So, files are simply views/mainview.js, models/task.js, collections\contacts.js etc. It makes sense to me, actually.

What do you think?

alexbeletsky avatar May 10 '13 14:05 alexbeletsky