Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A few updated commands need small consistency fixes (option typing completeness and quoting/prompt clarity) that could otherwise cause linting or parsing issues.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates multiple destructive “remove” commands across the CLI to recycle items by default and introduces a consistent --permanent switch for irreversible deletion, aligning behavior with the safety goals in #7110.
Changes:
- Inverted default deletion behavior to recycle when supported, and replaced
--recycle/--skipRecycleBinwith--permanent. - Updated telemetry, option typing, and command logic to reflect the new semantics.
- Updated unit tests and command reference docs for all affected commands.
File summaries
| File | Description |
|---|---|
| src/m365/spo/commands/site/site-remove.ts | Renames --skipRecycleBin to --permanent and updates logic/telemetry/types accordingly. |
| src/m365/spo/commands/site/site-remove.spec.ts | Updates tests to use permanent option name and revised validation expectations. |
| src/m365/spo/commands/page/page-remove.ts | Switches default behavior to recycle; uses --permanent to delete. |
| src/m365/spo/commands/page/page-remove.spec.ts | Updates tests to reflect the new --permanent flag semantics. |
| src/m365/spo/commands/listitem/listitem-remove.ts | Switches default behavior to recycle; replaces --recycle with --permanent. |
| src/m365/spo/commands/listitem/listitem-remove.spec.ts | Updates tests for default recycle behavior and the --permanent flag. |
| src/m365/spo/commands/listitem/listitem-batch-remove.ts | Switches batch remove default to recycle; replaces --recycle with --permanent. |
| src/m365/spo/commands/listitem/listitem-batch-remove.spec.ts | Updates tests to reflect default recycle behavior and --permanent. |
| src/m365/spo/commands/list/list-remove.ts | Switches list removal default to recycle; replaces --recycle with --permanent. |
| src/m365/spo/commands/list/list-remove.spec.ts | Updates tests for new default behavior and option name. |
| src/m365/spo/commands/folder/folder-remove.ts | Switches folder removal default to recycle; replaces --recycle with --permanent. |
| src/m365/spo/commands/folder/folder-remove.spec.ts | Updates tests to match the new default behavior and --permanent. |
| src/m365/spo/commands/file/file-remove.ts | Switches file removal default to recycle; replaces --recycle with --permanent. |
| src/m365/spo/commands/file/file-remove.spec.ts | Updates tests for default recycle behavior and --permanent. |
| src/m365/spe/commands/container/container-remove.ts | Switches default behavior to recycle (DELETE) and uses --permanent for permanentDelete. |
| src/m365/spe/commands/container/container-remove.spec.ts | Updates tests for new default behavior and --permanent. |
| src/m365/entra/commands/m365group/m365group-remove.ts | Replaces --skipRecycleBin with --permanent and updates follow-up permanent removal steps. |
| src/m365/entra/commands/m365group/m365group-remove.spec.ts | Updates tests to use --permanent and validates updated flow. |
| docs/docs/cmd/spo/site/site-remove.mdx | Documents --permanent replacing --skipRecycleBin. |
| docs/docs/cmd/spo/page/page-remove.mdx | Documents --permanent replacing --recycle and updates examples. |
| docs/docs/cmd/spo/listitem/listitem-remove.mdx | Documents --permanent and adds a permanent-delete example. |
| docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx | Documents --permanent and adds a permanent-delete example. |
| docs/docs/cmd/spo/list/list-remove.mdx | Documents --permanent replacing --recycle and updates examples. |
| docs/docs/cmd/spo/folder/folder-remove.mdx | Documents --permanent replacing --recycle and updates examples. |
| docs/docs/cmd/spo/file/file-remove.mdx | Documents --permanent replacing --recycle and updates examples. |
| docs/docs/cmd/spe/container/container-remove.mdx | Documents --permanent replacing --recycle and updates examples. |
| docs/docs/cmd/entra/m365group/m365group-remove.mdx | Documents --permanent replacing --skipRecycleBin and updates remarks/examples. |
Review details
Suppressed comments (2)
src/m365/spo/commands/listitem/listitem-remove.ts:162
- Use single quotes for string literals inside the template expression to match the project’s command-file quoting convention (and avoid lint issues).
const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.permanent ? "permanently remove" : "recycle"} the list item ${args.options.id} from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
src/m365/spo/commands/listitem/listitem-batch-remove.ts:193
- Use single quotes for the string literals in this ternary to match the project’s command-file quoting convention.
const result = await cli.promptForConfirmation({ message: `Are you sure you want to ${args.options.permanent ? "permanently remove" : "recycle"} the list items from list ${args.options.listId || args.options.listTitle || args.options.listUrl} located in site ${args.options.webUrl}?` });
- Files reviewed: 27/27 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
MartinM85
left a comment
There was a problem hiding this comment.
Hi @waldekmastykarz,
looks good overall, just one question.
Shouldn't we leave the skipRecycleBin option as a deprecated alias?
Closes pnp#7110 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Adds force to types.boolean in listitem-batch-remove and listitem-remove - Updates container-remove confirmation prompt to clarify recycle behavior - Uses single quotes in string literals for consistency Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Kept |
ef238d2 to
248e439
Compare
Closes #7110
Updates destructive commands that support recycling to recycle by default and replaces
--recycle/--skipRecycleBinwith--permanent. Includes updated tests, telemetry, option typing, and documentation for all affected commands.Validation
nrb: passesnt: 16,096 tests pass; the command exits on the existing upstream coverage gap insrc/utils/fsUtil.tslines 82-89 (99.99% global coverage)