mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 23:04:59 +08:00
rename to deprecated
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
---
|
||||
description: Enforces a consistent naming convention for directories across the project.
|
||||
globs: **/*
|
||||
---
|
||||
- Use lowercase with dashes for directories (components/auth-wizard)
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
---
|
||||
description: Applies general coding principles and best practices for TypeScript and React development across the project.
|
||||
globs: **/*.{ts,tsx}
|
||||
---
|
||||
- Write concise, readable TypeScript code.
|
||||
- Use functional and declarative programming patterns.
|
||||
- Follow DRY (Don't Repeat Yourself) principle.
|
||||
- Implement early returns for better readability.
|
||||
- Structure components logically: exports, subcomponents, helpers, types.
|
||||
- Use descriptive names with auxiliary verbs (isLoading, hasError).
|
||||
- Prefix event handlers with 'handle' (handleClick, handleSubmit).
|
||||
- Use TypeScript for all code.
|
||||
- Prefer interfaces over types.
|
||||
- Avoid enums; use const maps instead.
|
||||
- Implement proper type safety and inference.
|
||||
- Use `satisfies` operator for type validation.
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
---
|
||||
description: Dictates how asynchronous requests should be handled within Next.js 15, specifically concerning runtime APIs.
|
||||
globs: app/**/*
|
||||
---
|
||||
- Always use async versions of runtime APIs:
|
||||
typescript
|
||||
const cookieStore = await cookies()
|
||||
const headersList = await headers()
|
||||
const { isEnabled } = await draftMode()
|
||||
|
||||
- Handle async params in layouts/pages:
|
||||
typescript
|
||||
const params = await props.params
|
||||
const searchParams = await props.searchParams
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
---
|
||||
description: Specifies the best practices for building React components within the Next.js 15 App Router structure.
|
||||
globs: app/**/*
|
||||
---
|
||||
- Favor React Server Components (RSC) where possible.
|
||||
- Minimize 'use client' directives.
|
||||
- Implement proper error boundaries.
|
||||
- Use Suspense for async operations.
|
||||
- Optimize for performance and Web Vitals.
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
---
|
||||
description: Defines the recommended state management strategies for Next.js 15 applications, including server and client contexts.
|
||||
globs: app/**/*
|
||||
---
|
||||
- Use `useActionState` instead of deprecated `useFormState`.
|
||||
- Leverage enhanced `useFormStatus` with new properties (data, method, action).
|
||||
- Implement URL state management with 'nuqs'.
|
||||
- Minimize client-side state.
|
||||
Reference in New Issue
Block a user