Skip to content

Commit 35e70d4

Browse files
authored
docs(claude): always existsSync; forbid async fileExists (#1228)
Strengthen the File Organization rules: - Tighten the fs import example to the canonical form `import { existsSync, promises as fs } from 'node:fs'` (was `someSyncThing` placeholder). - Explicitly forbid async `fileExists` wrappers and `fs.stat`-for-existence checks in addition to `fs.access`. No code changes.
1 parent 691cc07 commit 35e70d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ Follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). User-facing cha
114114

115115
- `.mts` extensions for TypeScript modules
116116
- 🚨 ALWAYS use separate `import type` statements -- NEVER mix runtime and type imports
117-
- Node.js fs: `import { someSyncThing, promises as fs } from 'node:fs'`
117+
- Node.js fs: `import { existsSync, promises as fs } from 'node:fs'` (cherry-pick `existsSync`, alias promises as `fs`)
118118
- Process spawning: MUST use `spawn` from `@socketsecurity/registry/lib/spawn` (NEVER `child_process`)
119-
- File existence: ALWAYS use `existsSync()` from `node:fs` (NEVER `fs.access`)
119+
- File existence: ALWAYS use `existsSync` from `node:fs`. NEVER `fs.access`, `fs.stat`-for-existence, or an async `fileExists` wrapper.
120120

121121
### Code Patterns
122122

0 commit comments

Comments
 (0)