### Example Commit Message for a Fix Source: https://github.com/mainsail-crew/mainsail/blob/develop/CONTRIBUTING.md This example demonstrates the format for a commit message when fixing an issue. It includes a type, scope, description, and a reference to the issue being fixed. ```git commit fix: incorrect handling of click event This PR will fix #123. Fixes correct handling of click event when button [X] is clicked. Signed-off-by: James Smith ``` -------------------------------- ### Pre-submission checks Source: https://github.com/mainsail-crew/mainsail/blob/develop/agent_docs/CONTRIBUTING.md Run these commands before submitting your changes to ensure code quality and consistency. These include formatting, linting, and unit tests. ```bash npm run format npm run lint:fix npm run test:unit ``` -------------------------------- ### Custom Console Logging Method Source: https://github.com/mainsail-crew/mainsail/blob/develop/agent_docs/CODE_STYLE.md Implement a class method for debug logging with a descriptive prefix to avoid raw console.log in production. ```typescript log(msg: string, obj?: unknown): void { const message = `[MyFeature] ${msg}` if (obj) { window.console.log(message, obj) return } window.console.log(message) } ``` -------------------------------- ### Early Return Guard Clauses Source: https://github.com/mainsail-crew/mainsail/blob/develop/agent_docs/CODE_STYLE.md Employ guard clauses with early returns to prevent deep nesting and improve code readability. ```typescript function process(item) { if (!item) return if (!item.isValid) return // main logic here } ``` -------------------------------- ### Named Constants for Magic Numbers Source: https://github.com/mainsail-crew/mainsail/blob/develop/agent_docs/CODE_STYLE.md Replace magic numbers with named constants for better clarity and maintainability. ```typescript const STATUS_PRINTING = 3 if (status === STATUS_PRINTING) { ... } ``` -------------------------------- ### Sign off commits with DCO Source: https://github.com/mainsail-crew/mainsail/blob/develop/agent_docs/CONTRIBUTING.md All commits must be signed off using the Developer Certificate of Origin (DCO). Append this line to your commit message. ```git Signed-off-by: Your Name ``` -------------------------------- ### Nullish Coalescing Operator Source: https://github.com/mainsail-crew/mainsail/blob/develop/agent_docs/CODE_STYLE.md Use the nullish coalescing operator (??) to provide default values for null or undefined inputs. ```typescript const value = input ?? 'default' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.