RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/nowtec/nowCRM

Cursor rule

.cursor/rules/typescript-guidelines.mdc

TypeScript best practices and conventions for the NOWCRM codebase

Cursor rules

Quality

58/100

Scores the file, not the repository.

Length

488 words

16 headings · 9 code blocks

Repository

26

— · pushed 116 days ago

Last changed

3 days ago

First indexed 3 days ago.
nowtec/nowCRM/.cursor/rules/typescript-guidelines.mdcRawGitHub
1---
2description: TypeScript best practices and conventions for the NOWCRM codebase
3globs: ["**/*.ts", "**/*.tsx"]
4alwaysApply: false
5---
6 
7# TypeScript Guidelines
8 
9## Core TypeScript Principles
10NOWCRM enforces strict TypeScript usage to ensure type safety and maintainable code. This document outlines our TypeScript conventions and best practices.
11 
12## Type Safety
13 
14### Strict Typing
15- **No 'any' type allowed**
16- TypeScript strict mode enabled
17- noImplicitAny enabled
18```typescript
19 // ✅ Correct
20 function processUser(user: User) {
21 return user.name;
22 }
23 
24 // ❌ Incorrect
25 function processUser(user: any) {
26 return user.name;
27 }
28```
29 
30### Type Definitions
31 
32#### Types over Interfaces
33- Use `type` for all type definitions
34- Exception: When extending third-party interfaces
35```typescript
36 // ✅ Correct
37 type User = {
38 id: string;
39 name: string;
40 email: string;
41 };
42 
43 // ❌ Incorrect
44 interface User {
45 id: string;
46 name: string;
47 email: string;
48 }
49```
50 
51### String Literals over Enums
52- Use string literal unions instead of enums
53- Exception: GraphQL enums
54```typescript
55 // ✅ Correct
56 type UserRole = 'admin' | 'user' | 'guest';
57 
58 // ❌ Incorrect
59 enum UserRole {
60 Admin = 'admin',
61 User = 'user',
62 Guest = 'guest',
63 }
64```
65 
66## Naming Conventions
67 
68### Component Props
69- Suffix component prop types with 'Props'
70- Keep props focused and single-purpose
71```typescript
72 // ✅ Correct
73 type ButtonProps = {
74 label: string;
75 onClick: () => void;
76 variant?: 'primary' | 'secondary';
77 };
78 
79 // ❌ Incorrect
80 type ButtonParameters = {
81 label: string;
82 onClick: () => void;
83 variant?: 'primary' | 'secondary';
84 };
85```
86 
87## Type Inference
88 
89### Leverage TypeScript Inference
90- Use type inference when types are clear
91- Explicitly type when inference is ambiguous
92```typescript
93 // ✅ Correct - Clear inference
94 const users = ['John', 'Jane']; // inferred as string[]
95 
96 // ✅ Correct - Explicit typing needed
97 const processUser = (user: User): UserResponse => {
98 // Complex processing
99 return response;
100 };
101 
102 // ❌ Incorrect - Unnecessary explicit typing
103 const users: string[] = ['John', 'Jane'];
104```
105 
106## Best Practices
107 
108### Type Guards
109- Use type guards for runtime type checking
110- Prefer discriminated unions
111```typescript
112 // ✅ Correct
113 type Success = {
114 type: 'success';
115 data: User;
116 };
117 
118 type Error = {
119 type: 'error';
120 message: string;
121 };
122 
123 type Result = Success | Error;
124 
125 function handleResult(result: Result) {
126 if (result.type === 'success') {
127 // TypeScript knows result.data exists
128 console.log(result.data);
129 }
130 }
131```
132 
133### Generics
134- Use generics for reusable type patterns
135- Keep generic names descriptive
136```typescript
137 // ✅ Correct
138 type ApiResponse<TData> = {
139 data: TData;
140 status: number;
141 message: string;
142 };
143 
144 // ❌ Incorrect
145 type ApiResponse<T> = {
146 data: T;
147 status: number;
148 message: string;
149 };
150```
151 
152### Type Exports
153- Export types when they're used across files
154- Keep type definitions close to their usage
155```typescript
156 // types.ts
157 export type User = {
158 id: string;
159 name: string;
160 };
161 
162 // UserComponent.tsx
163 import { type User } from './types';
164```
165 
166### Utility Types
167- Leverage TypeScript utility types
168- Create custom utility types for repeated patterns
169```typescript
170 // Built-in utility types
171 type UserPartial = Partial<User>;
172 type UserReadonly = Readonly<User>;
173 
174 // Custom utility types
175 type NonNullableProperties<T> = {
176 [P in keyof T]: NonNullable<T[P]>;
177 };
178```

Sections

  • TypeScript Guidelines
  • Core TypeScript Principles
  • Type Safety
  • Strict Typing
  • Type Definitions
  • String Literals over Enums
  • Naming Conventions
  • Component Props
  • Type Inference
  • Leverage TypeScript Inference
  • Best Practices
  • Type Guards
  • Generics
  • Type Exports
  • Utility Types

What it covers

code-styletypesui

Stack — with the evidence

typescript

(1.00)

langchain

(1.00)

biome

(1.00)

node

(0.70)

react

(0.70)

nextjs

(0.70)

express

(0.70)

postgres

(0.70)

redis

(0.70)

tailwind

(0.70)

vite

(0.70)

vitest

(0.70)

playwright

(0.70)

eslint

(0.70)

aws

(0.70)

javascript

(0.60)

monorepo

(0.60)

pnpm

(0.60)

github-actions

(0.60)

Glob targeting

  • **/*.ts
  • **/*.tsx

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
nowtec
Language
—
License
—
Archived
no

All configs in this repo

Also in nowtec/nowCRM

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
nowtec/nowCRM.cursor/rules/architecture.mdc · 26Cursor rulestypescriptlangchain+17arch54/1003 days ago
nowtec/nowCRM.cursor/rules/code-style.mdc · 26Cursor rulestypescriptlangchain+17lint-formatstylearchdocs62/1003 days ago
nowtec/nowCRM.cursor/rules/file-structure.mdc · 26Cursor rulestypescriptlangchain+17buildstylearch70/1003 days ago
nowtec/nowCRM.cursor/rules/react-general-guidelines.mdc · 26Cursor rulestypescriptlangchain+17archuiperformancedo-not61/1003 days ago
nowtec/nowCRM.cursor/rules/readme.mdc · 26Cursor rulestypescriptlangchain+17testlint-formatarchtypes+273/1003 days ago
nowtec/nowCRM.cursor/rules/testing-guidelines.mdc · 26Cursor rulestypescriptlangchain+17setupteststylearch+373/1003 days ago
nowtec/nowCRM.cursor/rules/translations.mdc · 26Cursor rulestypescriptlangchain+17stylearchagent-behaviour62/1003 days ago
nowtec/nowCRMCLAUDE.md · 26CLAUDE.mdtypescriptlangchain+17buildstyledeployment21/1003 days ago
Diff against .cursor/rules/architecture.mdc Diff against .cursor/rules/code-style.mdc Diff against .cursor/rules/file-structure.mdc Diff against .cursor/rules/react-general-guidelines.mdc Diff against .cursor/rules/readme.mdc Diff against .cursor/rules/testing-guidelines.mdc Diff against .cursor/rules/translations.mdc Diff against CLAUDE.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack