Naming Conventions#
Main Principals#
- See Clean Code > Names Rules
- Use descriptive names that are easy to understand.
- Variable names should clearly convey what they are for.
- Use names that are easy to search for.
- Use names that are distinct from other names.
Naming Convention Usage#
The follow examples illustrate how “Lorem’s Ipsum Dalor for ACME!” would be output in each scenario.
Pascal Case#
Example: LoremsIpsumDalorForAcme
- JavaScript class names & class files.
- Key Global Miva Variables
Camel Case#
Example: loremsIpsumDalorForAcme
- JavaScript
- Files
- Functions
- Methods
- Parameters
- Variables
Kebab Case#
Example: lorems-ipsum-dalor-for-acme
- Markdown Files
- CSS ids, classes, file-names, animation/keyframe names
- SASS variable & mixins
- npm package names
- Directories
- Repos
Snake Case#
Example: lorems_ipsum_dalor_for_acme
- Miva Variables
- HTML Input names (ex.
<input name="foo_bar">
)
Constant Case#
(Snake Case & All Caps)
Example: LOREMS_IPSUM_DALOR_FOR_ACME
- Constant Variables (MVT, JS, PHP, etc.)
BEM#
- CSS classes - See CSS > BEM Naming Convention
Filenames#
- Filenames should be descriptive and easy to understand what they are for.
- Try to avoid long image names when possible.