Strict React + TypeScript Rules
These rules enforce enterprise-level type safety, maintainability, and predictable React architecture.
Install via CLI
$ npx @airuleshub/cli@latest add strict-react-typescript-rulesRule Content
1️⃣ Strict tsconfig.json
2️⃣ Never Use any
Use unknown and narrow types safely.
3️⃣ Always Type Component Props
4️⃣ Always Define Component Return Types
5️⃣ Do NOT Use React.FC
Prefer explicit function components with typed props.
6️⃣ Properly Type useState
7️⃣ Strict Event Typing
8️⃣ Use Discriminated Unions for State
9️⃣ Never Use Non-Null Assertion (!)
Always check for null explicitly.
🔟 Always Type useRef
1️⃣1️⃣ Strict Context Typing
🏆 Golden Enterprise Rules
- ❌ No
any - ❌ No implicit return types
- ❌ No
React.FC - ❌ No non-null assertion
- ❌ No unsafe casting
- ✅ Discriminated unions
- ✅ Explicit typing everywhere
- ✅ Strict ESLint + tsconfig
