At Formbricks, we maintain strict documentation standards to ensure code clarity, maintainability, and ease of use for both internal developers and external contributors.
All functions with complex logic must include JSDoc comments
Document parameters, return types, and potential side effects
Example:
Copy
Ask AI
/**Creates a new user and initializes their preferences@param {string} name - User's full name@param {UserOptions} options - Configuration options for user creation@returns {Promise<User>} The created user object@throws {ValidationError} If name is invalid*/async function createUser(name: string, options: UserOptions): Promise<User> { // implementation}
TypeScript Ignore Comments
When using @ts-ignore or @ts-expect-error, always include a comment explaining why
Example:
Copy
Ask AI
// @ts-expect-error -- Required for dynamic function callsvoid window.formbricks.setup(...args);
These documentation requirements ensure that our codebase remains maintainable, accessible, and well-documented for both current and future developers.