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
Options
Actually insert comments. Without this flag, glot runs in dry-run mode and
only shows what would be changed.
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:- Suppress all existing warnings
- Start with a clean slate
- Prevent new hardcoded text from being added
- Gradually fix existing issues over time
Dry-Run Mode (Default)
Preview what comments would be inserted:Apply Changes
Insert the suppression comments:Result
Before:Workflow
1
Run Baseline
Insert suppression comments for all existing hardcoded text:
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