This document provides natural language coding guidelines extracted from the project's ESLint configuration and established patterns.
-
Always use double quotes for string literals
- ✅
const message = "Hello World" - ❌
const message = 'Hello World'
- ✅
-
Never use semicolons at the end of statements
- ✅
const value = 42 - ❌
const value = 42;
- ✅
-
Always include trailing commas in multi-line structures (arrays, objects, function parameters)
- ✅ Multi-line with trailing comma:
const config = { host: "localhost", port: 53550, debug: true, }
- ❌ Multi-line without trailing comma:
const config = { host: "localhost", port: 53550, debug: true, }
- Add space after colon in switch case statements, but not before
- ✅
case "test": return value - ❌
case "test" :return value - ❌
case "test":return value
- ✅
-
Use camelCase for all variables and function names
- ✅
const userName = "Alice" - ✅
function calculateTotal() { } - ❌
const user_name = "Alice" - ❌
function CalculateTotal() { }
- ✅
-
Leading underscores are allowed but should be used sparingly (typically for private/internal properties)
- ✅
const _internalState = {} - ✅
const normalVariable = {}
- ✅
- Use camelCase for all class and object methods
- ✅
class Service { processData() { } } - ❌
class Service { ProcessData() { } }
- ✅
-
Use PascalCase for all type definitions
- ✅
type UserProfile = { } - ✅
interface Configuration { } - ❌
type userProfile = { }
- ✅
-
Don't prefix interfaces with 'I'
- ✅
interface UserService { } - ❌
interface IUserService { }
- ✅
- Use PascalCase for all class names
- ✅
class NetworkManager { } - ❌
class networkManager { } - ❌
class network_manager { }
- ✅
- Use PascalCase for type aliases
- ✅
type ResponseStatus = "success" | "error" - ❌
type responseStatus = "success" | "error"
- ✅
- Using
anyis allowed when necessary, but should be avoided when possible- Prefer specific types or
unknownwhen the type is truly unknown - Document why
anyis used when it's necessary
- Prefer specific types or
- Empty functions are permitted (useful for default callbacks, placeholders, or optional handlers)
- ✅
const noop = () => {} - ✅
onError: () => {} // Default no-op handler
- ✅
require()statements are allowed when needed for dynamic imports or CommonJS compatibility- However, prefer ES6
importstatements when possible
- However, prefer ES6
varkeyword is technically allowed but strongly discouraged- Always prefer
constfor values that won't be reassigned - Use
letfor values that will be reassigned - ✅
const API_URL = "https://api.example.com" - ✅
let counter = 0 ⚠️ var oldStyle = "avoid this"
- Always prefer
- Unused variables are currently not enforced by the linter
- However, you should still remove unused code for cleanliness
- Consider commenting out code that might be needed later with explanation
- Console statements are allowed (no warning for console.log, console.error, etc.)
- Use them appropriately for debugging and logging
- Consider using a proper logging system for production code
- No extra semicolons allowed (this is enforced as an error)
- ❌
const value = 42;; - ❌
function test() { };
- ❌
- Import restrictions are configured as warnings
- Follow the project's module structure
- Avoid circular dependencies
- Use proper path aliases when configured
- Code runs primarily in Bun runtime (with Node.js compatibility)
- Bun is the preferred package manager and runtime
- ES6 modules are the primary module system (CommonJS supported for compatibility)
- Bun test is used for testing (Jest configuration maintained for compatibility)
- ECMAScript 2020+ features are available
- TypeScript is executed directly via Bun without compilation step
NodeJSnamespace is available (read-only)globalThisis available for global scope access- Bun-specific globals are available when running under Bun runtime
- Keep files focused on a single responsibility
- Group related functionality in feature modules
- Use clear, descriptive file names
- Always handle errors appropriately
- Use try-catch blocks for async operations
- Provide meaningful error messages
- Write self-documenting code when possible
- Add comments for complex logic
- Use JSDoc comments for public APIs
- Write tests for new features
- Maintain existing test coverage
- Follow the established testing patterns in the codebase
- Always use Bun as the package manager
- ✅
bun install - ✅
bun add <package> - ❌
npm install - ❌
yarn add
- ✅
- Use Bun to run TypeScript directly
- ✅
bun run <script> - ✅
bun src/index.ts ⚠️ Only usenpm runfor legacy compatibility scripts
- ✅
- Prefer Bun's built-in test runner
- ✅
bun test - ✅
bun test:chains(for specific test suites)
- ✅
Note: These guidelines are automatically extracted from the project's ESLint configuration and adapted for Bun-first development. When in doubt, run bun run lint to check compliance with these rules. Use bun run lint:fix to automatically fix formatting issues.