Node.js project naming conventions for files & folders

后端 未结 7 1601
清酒与你
清酒与你 2020-12-04 04:41

What are the naming conventions for files and folders in a large Node.js project?

Should I capitalize, camelCase, or under-score?

Ie. is this considered vali

相关标签:
7条回答
  • 2020-12-04 05:27

    Use kebab-case for all package, folder and file names.

    Why?

    You should imagine that any folder or file might be extracted to its own package some day. Packages cannot contain uppercase letters.

    New packages must not have uppercase letters in the name. https://docs.npmjs.com/files/package.json#name

    Therefore, camelCase should never be used. This leaves snake_case and kebab-case.

    kebab-case is by far the most common convention today. The only use of underscores is for internal node packages, and this is simply a convention from the early days.

    0 讨论(0)
提交回复
热议问题