This conventions file is written to help aider comply with our conventions.
- Always make chirurgical changes. Never try to improve any of the surrounding code, just make the intented change and minimize the change set.
- Avoid regressions at all costs. If unsure about what to prioritize then take the top five options and rank them based on their impact versus their risk of introducing a regression.
- Node stdlib imports first
- NPM package imports second
- Local file imports third
- Blank line between each group
- Prefer async/await for sequential operations
- Use Promise.allSettled for parallel operations
- Never use Promise.all (fails entire chain on single error)
- Consider promises when blocking would harm performance
- Use single short words as variables over camelCase
- Within a module or a context you can use quite generic names that then resolve within the name space. E.g. in a module named "email" you can call a function "send" and it then should be used as "email.send"
- Return or throw early to avoid nesting
- Keep code flat, avoid nested if statements
- Handle failure cases first
- One statement per try {} block in try/catch
Always declare parameters as variables first for clarity:
const key1 = a
const key2 = b
function(key1, key2)
This ensures every parameter has a clear, named purpose and improves code readability.
- Don't try to maintain state through complex classes etc., instead write a series of pure functions that all do one thing well.
- Comments only for information not expressed in code
- Use inline styles for all possible styling
- Only use CSS files for media queries and other special cases
- Prefer open source over commercial/proprietary dependencies
- Maximum line length of 80 characters
- Use 2 spaces for indentation
- No tabs, convert to spaces (expandtab)
- Abstractions always leak.
- Tightly act according to scope
- Abstractions grow naturally through iteration on code through making chirurgical changes. These are acceptable abstractions
- Always use the authoritative CSS variables defined in src/public/news.css:root
- Reference the root variables for colors, borders, fonts and other design tokens
- Never hardcode values that are defined in the root variables
- Use Inter font family exclusively
- Default text color should be black
- Implement clear text hierarchy based on content relevance:
- Prioritize primary information for immediate comprehension
- De-emphasize secondary and tertiary information
- Use visual weight and spacing to create natural reading flow
- Utilize browser features to reduce visual clutter:
- Apply :visited pseudo-class for viewed links
- Implement hover states thoughtfully
- Desktop links must have text-decoration: underline on hover
- Border radius must always be 2px
- Primary buttons must follow #button-onboarding style from news.css:
- Border radius: 2px
- Clear hover states
- Consistent padding
- Black background with white text in base state
- Design mobile layouts first
- Follow Apple's touch target size recommendations:
- Minimum 44x44 points for all touch targets
- Maintain adequate spacing between interactive elements
- Ensure proper scroll margins for mobile
- Use appropriate text sizes for mobile readability
- Consider thumb zones in mobile layouts
- Clear hover states for interactive elements
- Consistent touch feedback on mobile
- Use opacity changes to indicate state
- Implement proper touch-action handling
- Ensure proper user-select behavior