Prompt
When implementing code that uses the Fastify package in TypeScript, ensure the following conventions are followed:
- Avoid Contractions: Use full words instead of contractions in code and comments. For example, use “it is” instead of “it’s”.
// Incorrect
// app.get('/hello', (req, res) => res.send("it's working!"));
// Correct
app.get('/hello', (req, res) => res.send("it is working!"));
- Use Oxford Commas: Include an Oxford comma (serial comma) when listing three or more items in function parameters, middleware, or plugin configurations.
// Incorrect
app.use(helmet, compression, morgan);
// Correct
app.use(helmet, compression, and morgan);
- Maintain Consistent Formatting: Keep formatting consistent throughout the codebase, including:
- Avoid emojis in function/variable names or comments unless used consistently
- Use relative paths for internal Fastify plugin imports
- Maintain consistent capitalization in function and variable names
Adhering to these conventions ensures the Fastify codebase remains readable, maintainable, and cohesive across different developers and components.