Biome Rules
Biome is the linter and formatter for all JavaScript and JSX in generated experiment projects. It replaces ESLint and Prettier.
Full configuration
The generated biome.json:
{
"$schema": "https://biomejs.dev/schemas/latest/schema.json",
"files": {
"ignore": ["dist/**", "node_modules/**", "scripts/**", "lib/**"]
},
"formatter": {
"indentStyle": "space",
"indentWidth": 4,
"lineWidth": 120
},
"javascript": {
"formatter": {
"quoteStyle": "single"
},
"globals": [
"window", "document", "fetch",
"setTimeout", "setInterval", "clearInterval", "clearTimeout",
"MutationObserver", "HTMLElement", "Intl", "s"
]
},
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"noUnusedVariables": "error"
},
"suspicious": {
"noConsole": "error"
}
}
}
}Formatter settings
| Setting | Value | Reason |
|---|---|---|
indentStyle | space | Consistent with surrounding Samsung codebase |
indentWidth | 4 | 4-space indentation |
lineWidth | 120 | Wider than the 80-char default to accommodate JSX |
quoteStyle | single | Single quotes throughout |
Linter rules
recommended: true
Enables all of Biome's recommended rules. These cover common correctness issues, accessibility, and style consistency. See Biome recommended rules for the full list.
noConsole: error
// WRONG — will fail the build
console.log('debug value:', data);
// CORRECT — use tracking instead, or remove the log
trackAAEvent('eVar26', 'event26', 'my-experiment: v1 debug');console.log statements in IIFE bundles appear in all users' browser consoles. This rule prevents accidental logging in production bundles.
noUnusedVariables: error
// WRONG — unused import fails the build
import { waitFor, watchFor } from '@lib/framework';
// watchFor is never used
// CORRECT — only import what you use
import { waitFor } from '@lib/framework';Unused variables and imports increase bundle size unnecessarily. This rule enforces clean imports.
Globals
The javascript.globals array tells Biome which identifiers are available as browser globals without being imported:
| Global | Source |
|---|---|
window, document | Browser DOM |
fetch | Browser Fetch API |
setTimeout, setInterval, clearTimeout, clearInterval | Browser timer APIs |
MutationObserver | Browser Observer API |
HTMLElement | Browser DOM |
Intl | Browser Internationalization API |
s | Adobe Analytics AppMeasurement global |
The s global is specific to the Samsung/Adobe Analytics setup. Biome will not flag s.tl() or s.events as undeclared.
Ignored paths
| Path | Reason |
|---|---|
dist/** | Build output — not source |
node_modules/** | Dependencies |
scripts/** | Build scripts run outside the experiment context |
lib/** | Framework runtime — not linted per project |
Commands
# Check for violations (read-only — used in CI and build gate)
pnpm lint
# Auto-fix formatting violations
pnpm formatCommon errors and fixes
| Error | Cause | Fix |
|---|---|---|
noConsole | console.log in src/ | Remove the log, or replace with trackAAEvent |
noUnusedVariables | Unused import or declared variable | Remove the unused declaration |
| Formatting | Tabs instead of spaces, wrong quote style | Run pnpm format to auto-fix |