From e14cb2fdc4ba4e89fb16d76e4d2bc502d6453b27 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 3 Feb 2021 20:18:50 +0100 Subject: [PATCH] fs: remove permissive rmdir recursive --- doc/api/deprecations.md | 14 ++-- doc/api/fs.md | 66 +++++++++++++------ lib/fs.js | 20 ++++-- lib/internal/fs/promises.js | 5 +- lib/internal/fs/utils.js | 40 ++++------- ...fs-rmdir-recursive-sync-warns-not-found.js | 19 ------ ...t-fs-rmdir-recursive-sync-warns-on-file.js | 21 ------ ...est-fs-rmdir-recursive-throws-not-found.js | 36 ++++++++++ .../test-fs-rmdir-recursive-throws-on-file.js | 30 +++++++++ ...test-fs-rmdir-recursive-warns-not-found.js | 23 ------- .../test-fs-rmdir-recursive-warns-on-file.js | 21 ------ test/parallel/test-fs-rmdir-recursive.js | 15 +++-- 12 files changed, 159 insertions(+), 151 deletions(-) delete mode 100644 test/parallel/test-fs-rmdir-recursive-sync-warns-not-found.js delete mode 100644 test/parallel/test-fs-rmdir-recursive-sync-warns-on-file.js create mode 100644 test/parallel/test-fs-rmdir-recursive-throws-not-found.js create mode 100644 test/parallel/test-fs-rmdir-recursive-throws-on-file.js delete mode 100644 test/parallel/test-fs-rmdir-recursive-warns-not-found.js delete mode 100644 test/parallel/test-fs-rmdir-recursive-warns-on-file.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 09f05df5b44906..76a2ee19e93ee5 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2668,19 +2668,25 @@ The [`crypto.Certificate()` constructor][] is deprecated. Use ### DEP0147: `fs.rmdir(path, { recursive: true })` -Type: Runtime +Type: Documentation-only -In future versions of Node.js, `fs.rmdir(path, { recursive: true })` will throw +`fs.rmdir(path, { recursive: true })`, `fs.rmdirSync(path, { recursive:true })` +and `fs.promises.rmdir(path, { recursive:true })` throws if `path` does not exist or is a file. -Use `fs.rm(path, { recursive: true, force: true })` instead. +Use `fs.rm(path, { recursive: true, force: true })`, +`fs.rmSync(path, { recursive: true, force: true })` or +`fs.promises.rm(path, { recursive: true, force: true })` instead. ### DEP0148: Folder mappings in `"exports"` (trailing `"/"`)