Skip to content

Feature: warn on unknown top-level schema keys (catch typos like colours:) #83

@ryo-manba

Description

@ryo-manba

Problem

The parser silently discards unknown top-level YAML keys. ParserHandler.toDesignSystem builds the design system from a fixed whitelist (name, description, colors, typography, rounded, spacing, components); any key not in that list is dropped without an error or a warning. A misspelled section name therefore disappears with no signal to the author:

---
name: "Example"
colours:               # typo for `colors` — silently ignored
  primary: "#E30613"
---

lint reports no findings for the colours block, and downstream missing-sections even reports colors as absent — the author is told the opposite of what they intended, with no hint that a typo is the cause. There is currently no way for a user to notice this class of mistake.

Proposal

Add a lint rule that warns when the front matter contains a top-level key that is not part of the known schema.

Known top-level keys (allowlist): name, description, colors, typography, rounded, spacing, components, version.

New linting rule

Rule Severity What it checks
unknown-key warning A top-level front-matter key is not part of the known schema

Proposed message

Unexpected unknown top-level key "colours"

Example output

{
  "findings": [
    {
      "severity": "warning",
      "path": "colours",
      "message": "Unexpected unknown top-level key \"colours\""
    }
  ],
  "summary": { "errors": 0, "warnings": 1, "infos": 0 }
}

Version

@google/design.md 0.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions