For Agents
- Write code that passes this Biome config on first run. Use
biome check --writeto auto-fix.
Imports/Exports
- Use
node:for Node builtins (e.g.,node:fs) andnode:assert/strict. - Avoid barrel files and namespace imports. Prefer named imports.
- Use type-only imports/exports for types. Don’t export an imported binding; re-export from source.
TypeScript
- Prefer
typealiases overinterface; avoidenumandnamespace. - Use
Array<T>overT[]. - Don’t use non-null assertions or constructor parameter properties.
- Don’t annotate obvious types; lift magic numbers to named constants when needed.
Code Style
- Prefer
const; avoid.forEach()in favor offor...of/while. - Avoid nested ternaries and negation-else; use template strings.
- Use object spread and assignment shorthand; prefer optional chaining.
- Keep
switchdefault last; avoid fallthrough.
Correctness
- No floating promises; use
awaitin async functions when needed. - Don’t assign to globals; don’t re-declare; use
globalThisoverglobal/self. - React: no nested component defs; don’t assign to props; provide stable
keyin lists; no children on void elements. - Hooks: call at top level and specify dependencies.
React/Next
- Use function components. Don’t render
<head>directly. - Use framework image components instead of raw
<img>in supported frameworks. - Avoid async client components in Next.
Security
- Add
rel="noopener"totarget="_blank"links. - Don’t use
dangerouslySetInnerHTML.
Suspicious
consoleis limited towarn|error|debug(warned). No bitwise ops,with, orvar.- No import cycles, no import assignment, and don’t reassign imported bindings.
Data/Config Files
- JSON: tabs; width 2; no trailing commas. Comments/trailing commas allowed only in select config files (
package.json,tsconfig*.json,.vscode/*.json,.github/**/*.json). - Filenames: ASCII kebab-case (warn). Route files are exempt.
Overrides
- Tests: console and
anyallowed; cognitive complexity off. - Scripts/binaries: console allowed;
process.envallowed. - Stories: unused imports/vars allowed. Decls (
*.d.ts): unused/undeclared allowed. - Generated/minified/docs/env: linter/formatter disabled.