Skip to main content
The baseline command inserts glot-disable-next-line comments to suppress existing hardcoded text warnings. This is useful when adopting glot in an existing project.

Usage

npx glot baseline [OPTIONS]

Options

--apply
boolean
default:"false"
Actually insert comments. Without this flag, glot runs in dry-run mode and only shows what would be changed.
--path
string
default:"."
Directory to process.

Why Use Baseline?

When adding glot to an existing project, you might have hundreds of hardcoded strings. Fixing them all at once isn’t practical. The baseline command lets you:
  1. Suppress all existing warnings
  2. Start with a clean slate
  3. Prevent new hardcoded text from being added
  4. Gradually fix existing issues over time

Dry-Run Mode (Default)

Preview what comments would be inserted:
npx glot baseline
Output:
Dry-run mode: showing comments that would be inserted

./src/components/Button.tsx:5
  Would add: // glot-disable-next-line
  Before: return <button>Submit</button>;

./src/components/Form.tsx:12
  Would add: // glot-disable-next-line
  Before: <input placeholder="Enter your email" />

2 comments would be inserted. Run with --apply to insert.

Apply Changes

Insert the suppression comments:
npx glot baseline --apply
Output:
./src/components/Button.tsx:5
  Inserted: // glot-disable-next-line

./src/components/Form.tsx:12
  Inserted: // glot-disable-next-line

✓ 2 comments inserted

Result

Before:
export function Button() {
  return <button>Submit</button>;
}
After:
export function Button() {
  // glot-disable-next-line
  return <button>Submit</button>;
}

Workflow

1

Run Baseline

Insert suppression comments for all existing hardcoded text:
npx glot baseline --apply
2

Commit Changes

Commit the baseline to your repository: bash git add -A git commit -m "chore: add glot baseline comments"
3

Add to CI

Add glot check to your CI pipeline. New hardcoded text will be caught.
4

Gradually Fix

Over time, remove the suppression comments and add proper translations.

Smart Behavior

The baseline command is smart about where it inserts comments:
  • Skips lines that already have translation function calls
  • Places comments on the correct line for multiline JSX
  • Handles JSX attributes correctly