Some checks are pending
Go Benchmark / Performance Regression Check (push) Waiting to run
Cerberus Integration / Cerberus Security Stack Integration (push) Waiting to run
Upload Coverage to Codecov / Backend Codecov Upload (push) Waiting to run
Upload Coverage to Codecov / Frontend Codecov Upload (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (go) (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (javascript-typescript) (push) Waiting to run
CrowdSec Integration / CrowdSec Bouncer Integration (push) Waiting to run
Docker Build, Publish & Test / build-and-push (push) Waiting to run
Docker Build, Publish & Test / Security Scan PR Image (push) Blocked by required conditions
Quality Checks / Auth Route Protection Contract (push) Waiting to run
Quality Checks / Codecov Trigger/Comment Parity Guard (push) Waiting to run
Quality Checks / Backend (Go) (push) Waiting to run
Quality Checks / Frontend (React) (push) Waiting to run
Rate Limit integration / Rate Limiting Integration (push) Waiting to run
Security Scan (PR) / Trivy Binary Scan (push) Waiting to run
Supply Chain Verification (PR) / Verify Supply Chain (push) Waiting to run
WAF integration / Coraza WAF Integration (push) Waiting to run
31 lines
1.4 KiB
Markdown
Executable File
31 lines
1.4 KiB
Markdown
Executable File
---
|
|
description: "Guidelines for writing Node.js and JavaScript code with Vitest testing"
|
|
applyTo: '**/*.js, **/*.mjs, **/*.cjs'
|
|
---
|
|
|
|
# Code Generation Guidelines
|
|
|
|
## Coding standards
|
|
- Use JavaScript with ES2022 features and Node.js (20+) ESM modules
|
|
- Use Node.js built-in modules and avoid external dependencies where possible
|
|
- Ask the user if you require any additional dependencies before adding them
|
|
- Always use async/await for asynchronous code, and use 'node:util' promisify function to avoid callbacks
|
|
- Keep the code simple and maintainable
|
|
- Use descriptive variable and function names
|
|
- Do not add comments unless absolutely necessary, the code should be self-explanatory
|
|
- Never use `null`, always use `undefined` for optional values
|
|
- Prefer functions over classes
|
|
|
|
## Testing
|
|
- Use Vitest for testing
|
|
- Write tests for all new features and bug fixes
|
|
- Ensure tests cover edge cases and error handling
|
|
- NEVER change the original code to make it easier to test, instead, write tests that cover the original code as it is
|
|
|
|
## Documentation
|
|
- When adding new features or making significant changes, update the README.md file where necessary
|
|
|
|
## User interactions
|
|
- Ask questions if you are unsure about the implementation details, design choices, or need clarification on the requirements
|
|
- Always answer in the same language as the question, but use english for the generated content like code, comments or docs
|