Why? Creates a predictable, lintable codebase.
Consistent naming removes “how should I call this?” friction, lets grep-based searches find references instantly, and keeps Git diffs readable. A predictable pattern also helps static analysis tools catch mistakes sooner and improves onboarding for new engineers.
// File: features/auth/login-form.tsx (kebab-case)
import { useState } from "react";
import { useAuth } from "@/features/auth/use-auth"; // hook in camelCase
export function LoginForm() {
// PascalCase component
const { signIn } = useAuth();
const [email, setEmail] = useState("");
const [pwd, setPwd] = useState("");
return (
<form
onSubmit={(e) => {
e.preventDefault();
signIn(email, pwd);
}}
className="flex flex-col gap-4"
>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="input"
/>
<input
type="password"
value={pwd}
onChange={(e) => setPwd(e.target.value)}
className="input"
/>
<button className="btn-primary">Log In</button>
</form>
);
}
// File: Features/Auth/LoginForm.jsx (pascal + uppercase folder)
import { UseAuth } from "@/features/auth/UseAuth"; // ❌ hook in PascalCase
export function login_form() {
// ❌ component in snake_case
const { SignIn } = UseAuth(); // ❌ variable in PascalCase
// …
}
UserMenu
, ProfileCard
.useFetch
, isLoading
.user-menu.tsx
, use-fetch.ts
.