Skip to content

fix(prefer-promises/fs): cover fs.watch - #566

Open
lprnmns wants to merge 1 commit into
eslint-community:masterfrom
lprnmns:fix/prefer-promises-fs-watch
Open

fix(prefer-promises/fs): cover fs.watch#566
lprnmns wants to merge 1 commit into
eslint-community:masterfrom
lprnmns:fix/prefer-promises-fs-watch

Conversation

@lprnmns

@lprnmns lprnmns commented Aug 31, 2026

Copy link
Copy Markdown

Problem

n/prefer-promises/fs does not report fs.watch() callback usage, even though Node.js provides fs.promises.watch(). The rule documentation says callback APIs should be disallowed in favor of promise APIs, so this leaves one supported API unprotected.

Fix

Add watch to the rule’s existing fs call trace map. This covers CommonJS, ESM, and process.getBuiltinModule("fs") references through the shared tracing logic, with no API or dependency changes.

Tests

  • npm run test:mocha -- tests/lib/rules/prefer-promises/fs.js — passed (56 passing)
  • npm test — passed (3149 passing, 3 pending)
  • git diff --check — passed

Compatibility

This adds a diagnostic only when the opt-in n/prefer-promises/fs rule is enabled. The change does not alter runtime APIs, generated files, or dependencies.

Related issue

Independent reproduction; no existing issue or pull request for fs.watch was found in the final duplicate search.

Copilot AI balanced review requested due to automatic review settings August 31, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lprnmns
lprnmns marked this pull request as ready for review August 31, 2026 12:15
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.

2 participants