Skip to content

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:

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 ​

SettingValueReason
indentStylespaceConsistent with surrounding Samsung codebase
indentWidth44-space indentation
lineWidth120Wider than the 80-char default to accommodate JSX
quoteStylesingleSingle quotes throughout

Linter rules ​

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 ​

js
// 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 ​

js
// 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:

GlobalSource
window, documentBrowser DOM
fetchBrowser Fetch API
setTimeout, setInterval, clearTimeout, clearIntervalBrowser timer APIs
MutationObserverBrowser Observer API
HTMLElementBrowser DOM
IntlBrowser Internationalization API
sAdobe 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 ​

PathReason
dist/**Build output — not source
node_modules/**Dependencies
scripts/**Build scripts run outside the experiment context
lib/**Framework runtime — not linted per project

Commands ​

bash
# Check for violations (read-only — used in CI and build gate)
pnpm lint

# Auto-fix formatting violations
pnpm format

Common errors and fixes ​

ErrorCauseFix
noConsoleconsole.log in src/Remove the log, or replace with trackAAEvent
noUnusedVariablesUnused import or declared variableRemove the unused declaration
FormattingTabs instead of spaces, wrong quote styleRun pnpm format to auto-fix

Internal tool — Samsung / Sogody experimentation team