camelCase ๐ซ vs kebab-case ๐ฏ for File & Folder Names โ
Naming conventions can shape readability, portability, and dev ergonomics. When it comes to file and folder names, the two common contenders are camelCase and kebab-case. Hereโs a head-to-head breakdown to help you choose the right one for your projects.
๐ฅ๏ธ Cross-Platform Compatibility โ
camelCase
โ Can be risky across case-sensitive systems. For example, MyFile.ts and myfile.ts are treated as different files on macOS/Linux, but the same on Windows.
kebab-case
โ
Lowercase and hyphenated โ no casing ambiguity. It behaves consistently across all operating systems and avoids weird Git diffs.
Verdict: kebab-case is safer and more reliable in team environments.
๐๏ธ Readability โ
camelCase
๐คทโโ๏ธ Acceptable in code, but filenames like myAwesomeComponent.tsx arenโt easy to scan.
kebab-case
โ
Clearly separates words. my-awesome-component.tsx is easier to skim in long directory trees.
Verdict: kebab-case wins for visual clarity.
๐ Web and CLI Friendliness โ
camelCase
โ Not ideal in URLs or shell commands. May require shift key usage and can look awkward in slugs.
kebab-case
โ
Designed for web paths and CLI usage. Works great in /routes/get-started or terminal commands like vite-plugin-name.
Verdict: kebab-case is cleaner for URLs and command-line tools.
๐งฑ Ecosystem Convention โ
camelCase
๐ก Common for JavaScript variables and functions, but rare in file names.
kebab-case
โ
Standard in open-source: npm packages (react-router, eslint-config-prettier), GitHub repos, CLI tools, etc.
Verdict: kebab-case aligns with ecosystem norms.
๐ง Context Clarity โ
camelCase
๐ Might blur the line between code identifiers and files.
kebab-case
โ
Clearly signals โthis is a file or folder,โ not a function or variable.
Verdict: kebab-case offers better contextual separation.
โ Final Take โ
Stick with camelCase for code (variables, functions, props)
Use kebab-case for files and folders
Itโs simpler, safer, easier to type, and aligns with modern tooling.
๐ TL;DR โ
| Aspect | camelCase ๐ซ | kebab-case ๐ฏ | Winner |
|---|---|---|---|
| Cross-platform safety | โ Risky | โ Safe | kebab-case |
| Readability | ๐คทโโ๏ธ Okay | โ Clear | kebab-case |
| CLI/URL friendliness | โ Clunky | โ Smooth | kebab-case |
| Ecosystem alignment | โ Rare | โ Common | kebab-case |
| Code/file distinction | ๐ Mixed | โ Obvious | kebab-case |
