Skip to content

Biome rules ​

Biome is the linter and formatter for JavaScript, JSX, and JSON in generated experiment projects. It replaces ESLint and Prettier.

Full configuration ​

The generated biome.json:

json
{
  "$schema": "https://biomejs.dev/schemas/2.5.0/schema.json",
  "files": {
    "includes": ["**", "!dist", "!scripts", "!lib"]
  },
  "formatter": {
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 120
  },
  "javascript": {
    "formatter": {
      "quoteStyle": "single"
    },
    "globals": [
      "window", "document", "fetch",
      "setTimeout", "setInterval", "clearInterval", "clearTimeout",
      "MutationObserver", "HTMLElement", "Intl", "s"
    ]
  },
  "assist": { "actions": { "source": { "organizeImports": "off" } } },
  "linter": {
    "enabled": true,
    "rules": {
      "preset": "none",
      "correctness": {
        "preset": "recommended",
        "noUndeclaredVariables": "error",
        "noUnusedVariables": "error"
      },
      "suspicious": {
        "preset": "recommended",
        "noConsole": "error"
      },
      "a11y": {
        "preset": "recommended"
      }
    }
  }
}

Formatter settings ​

SettingValueReason
indentStylespaceUses spaces rather than tabs
indentWidth2Two-space indentation, matching generated source and config files
lineWidth120Leaves room for JSX without forcing frequent wraps
quoteStylesingleSingle quotes throughout

Import sorting ​

Generated projects leave Biome import sorting disabled with organizeImports: "off". Keep imports readable, but do not expect pnpm format to reorder them.

Linter rules ​

The generated config keeps the top-level recommended setting off, then enables recommended rules in these groups:

GroupWhy it is enabled
correctnessCatches likely runtime errors and unused variables.
suspiciousCatches code that is usually accidental, including console logging.
a11yCatches common accessibility issues in JSX.

noConsole: error ​

js
// Fails the build
console.log('debug value:', data);

// Use the runtime's opt-in diagnostic helper instead
debug('product data', data);

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 '@sogody/experiment-framework/framework';
// watchFor is never used

// CORRECT - only import what you use
import { waitFor } from '@sogody/experiment-framework/framework';

This rule catches imports and variables left behind during editing.

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 without writing files
pnpm lint

# Format and apply safe fixes
pnpm format

Common errors and fixes ​

ErrorCauseFix
noConsoleconsole.log in src/Remove it or use framework log() / debug()
noUnusedVariablesUnused import or declared variableRemove the unused declaration
FormattingTabs instead of spaces, wrong quote styleRun pnpm format to auto-fix
Import orderImports are hard to scanReorder imports manually when needed

Internal tool - Samsung / Sogody experimentation team

Help improve the frameworkShare an idea or friction you encountered.Share framework feedback(opens in a new tab)