Skip to content

New Rule: consistent-fs-deletion #497

Description

@zanminkian

Rule details

We have 3 apis for deleting files and directories:

  • fs.rm
  • fs.unlink
  • fs.rmdir

I prefer to consistently use fs.rm, so that I can easily find out all deleting operations by searching fs.rm in code base.

What type of rule is this?

Warns about a potential problem

Example code

import fs from 'node:fs';
import fs from 'node:fs/promises'; // This rule should support node:fs/promises

// These lines of code are considered problematic.
fs.unlink();
fs.rmdir();
fs.unlinkSync();
fs.rmdirSync();

Participation

  • I am willing to submit a pull request to implement this rule.

Additional comments

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions