GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — opencode/STYLE_GUIDE.md at dev · jkoelker/opencode

Expand file tree

/

STYLE_GUIDE.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
74 lines (53 loc) · 1.13 KB
/

STYLE_GUIDE.md

Copy path

File metadata and controls

74 lines (53 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Style Guide

  • Try to keep things in one function unless composable or reusable
  • AVOID unnecessary destructuring of variables. instead of doing const { a, b } = obj just reference it as obj.a and obj.b. this preserves context
  • AVOID try/catch where possible
  • AVOID using any type
  • PREFER single word variable names where possible
  • Use as many bun apis as possible like Bun.file()

Avoid let statements

we don't like let statements, especially combined with if/else statements. prefer const

This is bad:

Good:

const foo = condition ? 1 : 2

Bad:

let foo

if (condition) foo = 1
else foo = 2

Avoid else statements

Prefer early returns or even using iife to avoid else statements

Good:

function foo() {
  if (condition) return 1
  return 2
}

Bad:

function foo() {
  if (condition) return 1
  else return 2
}

Prefer single word naming

Try your best to find a single word name for your variables, functions, etc. Only use multiple words if you cannot.

Good:

const foo = 1
const bar = 2
const baz = 3

Bad:

const fooBar = 1
const barBaz = 2
const bazFoo = 3
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.