Skip to content

feat(rimraf): add fs.rm migration recipe#486

Open
Herrtian wants to merge 3 commits into
nodejs:mainfrom
Herrtian:rimraf-to-fs-rm-472
Open

feat(rimraf): add fs.rm migration recipe#486
Herrtian wants to merge 3 commits into
nodejs:mainfrom
Herrtian:rimraf-to-fs-rm-472

Conversation

@Herrtian
Copy link
Copy Markdown

@Herrtian Herrtian commented Jun 6, 2026

Fixes #472.\n\n## Summary\n- add a rimraf-to-fs-rm recipe for literal rimraf deletes\n- handle v3 callback calls, v4/v5 promise calls, v5 sync calls, aliases, and sync glob expansion\n- document manual-review cases for runtime-specific rimraf behavior\n\n## Validation\n- npm.cmd run test --workspace @nodejs/rimraf-to-fs-rm\n- npm.cmd run type-check\n- npm.cmd run lint

@AugustinMauroy
Copy link
Copy Markdown
Member

thanks for being volunteering but you have 4 opened PRs we didn't have a lot of maintainer on this initiative so plz don't open any other pr.

Copy link
Copy Markdown
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

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

  • give name to tests cases
  • add remove dep step but before calling the function analyse the json ast to know if rimraf isn't used as cli
  • add jsdocs to workflow

@Herrtian
Copy link
Copy Markdown
Author

Herrtian commented Jun 6, 2026

Thanks, understood. I won't open more PRs and will focus on the existing ones. I pushed the requested updates in the latest commit.

Comment on lines +7 to +9
'rimraf-v3',
'rimraf-v4',
'rimraf-v5',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think nearly nobody use this specifier.

rule: { kind: 'pair' },
});

return scriptPairs.some((pair) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

here I think we can simplify by catching string_content kind node inside string kind and on string_content you can add regex that have rimraf so no need to have js regex ...

/**
* Splits a comma-separated argument list without splitting nested expressions.
*/
const splitTopLevelArguments = (source: string): string[] => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@brunocroh I pretty sure that you will have a 3 line function that can simplify that

Comment on lines +267 to +269
rimrafImports.forEach((importNode, index) => {
edits.push(importNode.replace(index === 0 ? importReplacement : ''));
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use for(const ... of ...) with an if else statement inside it's will be much more easiest to read

rimrafImports.forEach((importNode, index) => {
edits.push(importNode.replace(index === 0 ? importReplacement : ''));
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (!edits.lenght) return null;

for security

- custom retry behavior
- custom glob options
- async glob deletes with callbacks
- package-specific fallback behavior on Windows
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- package-specific fallback behavior on Windows
- package-specific fallback behavior on Windows
- CLI usage isn't touch you may want to use something else

@AugustinMauroy AugustinMauroy added awaiting author Reviewer has requested something from the author ⚠️ fully-AI-generated labels Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting author Reviewer has requested something from the author ⚠️ fully-AI-generated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spec: Rimraf to Native fs.rm() Comparison Suite

2 participants