-
No redundant code. If functionality already exists as a component or common function, reuse it. Never duplicate logic.
-
No
_prefixed variable names. No_temp,_private,_internal, etc. Use proper descriptive names. -
Functions at the bottom. All function definitions go after the main component/class logic, at file or closure scope. Never interleave function declarations with execution code.
-
Maintainable and readable. Prefer clarity over cleverness. Split files if they exceed ~200 lines. Use descriptive, self-documenting names.
-
No unnecessary comments. Comments only when the code itself can't explain why. Never comment what the code does — it should be obvious from the names and structure.
- Non-JS imports first (SCSS, CSS, images, fonts)
- Then library/package imports (React, third-party)
- Then local imports from
"src"root - Then same-directory relative imports (
./)
Concrete example:
import "./App.scss"; // 1. non-JS at top
import "res/icons/style.css";
import { useState } from "react"; // 2. packages
import Page from "components/Page";
import store from "lib/store"; // 3. src/ root imports
import localHelper from "./utils"; // 4. same-directoryRun pnpm format before committing. Biome auto-fixes:
- Tabs for indentation (
indentStyle: "tab") - Double quotes for strings (
quoteStyle: "double") - Organize imports automatically (sorts + removes unused)
- All recommended linter rules enabled (except disabled ones below)
- Disabled a11y rules:
noLabelWithoutControl,useAnchorContent,noStaticElementInteractions,useKeyWithClickEvents,useMediaCaption - Disabled:
noDangerouslySetInnerHtml(security),noControlCharactersInRegex(suspicious)
export default function/class/const— default exports everywhere- Imports from
"src"root — webpack resolvessrc/as a module root - React components:
export default function ComponentName() - Classes:
export default class ClassNamewith#privatefields - Types:
interfaceovertype, named exports fromsrc/types/ - SCSS: one
.scssper component, co-located consteverywhere,letonly when reassignment is requiredasync/awaitover raw Promisestry/catchwithconsole.errorfor errors