Skip to content

Add no-sync-fs rule#44

Open
create-inc-service-account wants to merge 3 commits intomainfrom
no-sync-fs
Open

Add no-sync-fs rule#44
create-inc-service-account wants to merge 3 commits intomainfrom
no-sync-fs

Conversation

@create-inc-service-account

Summary

  • Flags synchronous fs methods (readFileSync, writeFileSync, existsSync, etc.) and suggests fs.promises or fs/promises instead
  • Detects both fs.xSync() member calls and destructured imports from 'fs'/'node:fs'
  • Uses endsWith('Sync') instead of a hardcoded method list — future-proof against new Node.js fs additions
  • Tagged as backend platform only
  • Codifies the code style preference from our escher CLAUDE.md: "Always use fs.promises.* instead of sync variants"

Test plan

Scenario Expected
npm test All 350 tests pass (14 new for this rule)
fs.readFileSync(...) Flagged with suggestion to use fs.promises.readFile
import { writeFileSync } from 'fs' then writeFileSync(...) Flagged
import fs from 'node:fs' then fs.existsSync(...) Flagged
await fs.promises.readFile(...) Allowed
import { readFile } from 'fs/promises' Allowed
someObj.readFileSync(...) Allowed (not an fs import)

🤖 Generated with Claude Code

arnavsurve and others added 2 commits February 16, 2026 11:39
Flag synchronous fs methods (readFileSync, writeFileSync, etc.) and
suggest using fs.promises or fs/promises instead. Detects both
fs.xSync() member calls and destructured imports from 'fs'/'node:fs'.
Scoped to backend platform.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments