Inspiration
We don’t just need “a solution to a problem”—we need it at the right stage. Browser-compat issues caught in prod are expensive; caught in the editor are easy to miss; caught in the project + CI are impossible to ignore. Not everyone uses the same IDE/extension/Chrome add-on, so checks get skipped. baseline-guard moves compatibility checks to where they can’t be missed: your repo and pipeline.
What it does
- Scans JS/TS/TSX/CSS/HTML for modern web features (e.g.,
: has(), container queries, RegExp lookbehind, WebGPU). - Compares them against your target browsers (from
baseline.config.jsonor Browserslist) using the officialweb-featuresdataset. - Fails or warns (configurable) when a feature isn’t safely supported.
- Outputs pretty console logs or saves MD/HTML/JSON reports.
- Lets teams add inline custom rules directly in
baseline.config.json.
How we built it
- TypeScript + Node CLI (editor-agnostic).
- web-features for Baseline + per-browser minimum versions.
- browserslist to resolve targets like
safari 16.0–16.3. - fast-glob to scan project files; lightweight regex detectors per rule.
- Inline rules via JSON (
pattern+flags) compiled to RegExp at runtime. - Nice DX: compact Targets and Rules tables,
--pack,--tags,--only/--exclude,--watch, reports.
Challenges we ran into
- Mapping feature IDs → compat minima correctly across Safari/iOS ranges.
- Making regex detectors robust without being slow or noisy.
- Avoiding duplicate/contradictory configs (single
baseline.config.jsonsource of truth). - Clear output that works for both devs and CI logs.
Accomplishments that we’re proud of
- Project-level, default-on compatibility guard—no IDE dependency.
- Inline custom rules in
baseline.config.json(no extra files). - Clean CLI UX: summary tables, rule packs, and simple reporting.
- Works great in CI/CD (non-zero exit on
mode: "error"). - Real-world catches (e.g., RegExp lookbehind vs Safari 16.x targets).
What we learned
- Teams want guarantees at commit/CI time, not just editor hints.
- Baseline + minima beat “gut feel” and generic device requirements.
- Small UX touches (tables, saveable reports) make adoption stick.
- Regex gets you far fast; AST detectors will reduce false positives next.
What’s next for baseline-guard
- VS Code integration that piggybacks on the same CLI.
- Rule marketplace / presets by org, framework, or year (e.g., “Baseline 2025”).
- Suggestions: link to docs/polyfills or safe alternatives when a rule fires.
Built With
- css
- html
- javascript
- typescript
- web-features
Log in or sign up for Devpost to join the conversation.