PR Checklist
This document outlines the requirements for submitting a pull request (PR) to the project.
General guidelines
- Ensure the build passes.
- No ESLint errors.
- Achieve 100% code coverage.
- The submission should match the specification.
- Maintain a single commit, or squash multiple commits.
- Use single quotes
' 'for strings. - If submitting a sample, ensure it is properly formatted and indented.
Coding standards
- Command options should follow the naming convention (kebab-case for CLI flags).
- The command should have a correct name.
- The command name added to
commands.tsshould be placed so that commands are sorted alphabetically. - The command class is named following the pattern
[Service][Command]Command. For example,SpoWebRemoveCommand. - Verify the command works as expected.
- List commands must have readable output in
textmode, with each item fitting in one row of 130 characters preferably. - Avoid commented-out code and usage of
anytypes, preferring specific types. - Remove commands should include a
forceoption. - For bug fixes, include a test for the fixed use case.
- Avoid unnecessary retrieval of form digest.
- Handle failed promises properly when
responseType: 'json'is used by usinghandleRejectedODataJsonPromise. - Escape user input in XML and URLs using
formatting.encodeQueryParameter()orformatting.escapeXml(). - Verbose and debug outputs are logged to stdErr (
logger.logToStderrinstead oflogger.log). - Do not do conditional output in JSON output mode; use
defaultPropertiesfor defining default properties in list commands. - For commands with multiple options where the user is required to choose one, define these options using a custom Zod validation.
- Use
async/awaitinstead ofpromise/then. -
npm testmust pass without errors.
Documentation
- Include an
mdxhelp page. - Reference the
mdxhelp page in the sidebar navigation. - Start all code samples with
m365. - Ensure samples use long names of options rather than short ones.
- If there is an option modifying the output, include responses for both default and modified output.
- For a command page, ensure it includes the following sections: title, description, usage, options, examples, permissions, and response. In some cases a remarks section is also allowed.