You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+27-2Lines changed: 27 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,16 +240,19 @@ This is a TypeScript implementation of the Package URL (purl) specification for
240
240
-**Array destructuring**: Use object notation `{ 0: key, 1: data }` instead of array destructuring `[key, data]`
241
241
-**Dynamic imports**: 🚨 FORBIDDEN - Never use dynamic imports (`await import()`). Always use static imports at the top of the file
242
242
-**Comment formatting**: 🚨 MANDATORY - ALL comments MUST follow these rules:
243
+
-**Single-line preference**: Prefer single-line comments (`//`) over multiline comments (`/* */`) unless for method headers, module headers, or copyright notices. Use single-line comments for property descriptions, inline explanations, and general code comments.
243
244
-**Periods required**: Every comment MUST end with a period, except ESLint disable comments and URLs which are directives/references. This includes single-line, multi-line, inline, and c8 ignore comments.
244
245
-**Sentence structure**: Comments should be complete sentences with proper capitalization and grammar.
245
246
-**Placement**: Place comments on their own line above the code they describe, not trailing to the right of code.
246
247
-**Style**: Use fewer hyphens/dashes and prefer commas, colons, or semicolons for better readability.
247
248
-**Examples**:
248
-
- ✅ CORRECT: `// This function validates user input.`
249
-
- ✅ CORRECT: `/* This is a multi-line comment that explains the complex logic below. */`
249
+
- ✅ CORRECT: `// This function validates user input.` (single-line preferred)
- ❌ WRONG: `// this validates input` (no period, not capitalized)
254
257
- ❌ WRONG: `const x = 5 // some value` (trailing comment)
255
258
-**JSDoc comments**: 🚨 SIMPLIFIED - Only use @throws for error documentation. Avoid @param and @returns tags - function signatures and good function names should be self-documenting.
@@ -268,6 +271,28 @@ This is a TypeScript implementation of the Package URL (purl) specification for
268
271
-**Number formatting**: 🚨 REQUIRED - Use underscore separators (e.g., `20_000`) for large numeric literals. 🚨 FORBIDDEN - Do NOT modify number values inside strings
269
272
-**Node.js fs imports**: 🚨 MANDATORY pattern - `import { someSyncThing, promises as fs } from 'node:fs'`
270
273
-**Process spawning**: 🚨 FORBIDDEN to use Node.js built-in `child_process.spawn` - MUST use `spawn` from `@socketsecurity/registry/lib/spawn`
274
+
-**JSDoc function documentation**: 🚨 MANDATORY - Function JSDoc comments MUST follow this exact pattern:
275
+
-**Format**: Description only, with optional `@throws` - NO `@param` or `@returns` tags
276
+
-**Order**: Description paragraph, then `@throws` tag (if needed)
277
+
-**Closure**: End with `*/` immediately after the last JSDoc tag
278
+
-**Examples**:
279
+
- ✅ CORRECT:
280
+
```javascript
281
+
/**
282
+
* Check if a string contains a trusted domain using proper URL parsing.
283
+
*/
284
+
```
285
+
- ✅ CORRECT (with throws):
286
+
```javascript
287
+
/**
288
+
* Parse a configuration file and validate its contents.
289
+
* @throws {Error} When file cannot be read or parsed.
290
+
*/
291
+
```
292
+
- ❌ FORBIDDEN: Adding `@param` or `@returns` tags
293
+
- ❌ FORBIDDEN: Adding extra tags like `@author`, `@since`, `@example`, etc.
294
+
- ❌ FORBIDDEN: Adding empty lines between JSDoc tags
295
+
- ❌ FORBIDDEN: Adding extra content after the last JSDoc tag
271
296
272
297
### 🗑️ Safe FileOperations (SECURITYCRITICAL)
273
298
-**Script usage only**: Use `trash`packageONLYin scripts, build files, and utilities -NOTin`/src/` files
0 commit comments