Skip to content

feat: add omitted frontmatter key to suppress expected-missing lint warnings#155

Open
zachshallbetter wants to merge 3 commits into
google-labs-code:mainfrom
zachshallbetter:feat/omitted-key
Open

feat: add omitted frontmatter key to suppress expected-missing lint warnings#155
zachshallbetter wants to merge 3 commits into
google-labs-code:mainfrom
zachshallbetter:feat/omitted-key

Conversation

@zachshallbetter

Copy link
Copy Markdown

Implemented support for an optional omitted frontmatter configuration key in DESIGN.md. This allows design system authors to explicitly declare token categories that are intentionally skipped or absent, thereby suppressing default expected-missing warnings (Issue #78).

Background & Motivation

By default, the linter emits missing-sections and missing-typography warnings when standard categories (such as spacing, rounded, or typography) are absent. However, design systems under development or built for restricted contexts (e.g., minimalist layouts) may intentionally exclude some properties. Declaring these omissions under the omitted frontmatter key makes the omission intent explicit to both human reviewers and agents.

Changes

  • Parser & Spec:
    • Add 'omitted' to SCHEMA_KEYS in the parser spec.
    • Parse the omitted key inside frontmatter, supporting both bare strings (e.g., - spacing) and objects with reasons (e.g., section: rounded, reason: "no rounded corners").
  • Model Mapping:
    • Forward omitted configuration to the compiled DesignSystemState.
    • Inject the active rule ID property to all lint findings for better programmatic parsing.
  • Rule Support & Validation:
    • Bypass missing-sections and missing-typography checks if a section is listed in omitted.
    • Add a new omittedRule which generates validation findings:
      • declared-omission (info): Confirms that a section was intentionally skipped.
      • redundant-omission (warning): Emitted if a section is listed in omitted but tokens are still defined.
      • unknown-omission (warning): Emitted if an invalid section name is listed.
  • Test Coverage:
    • Add comprehensive tests for frontmatter parsing, model mapping, suppression logic, and omission validation rules.
  • Documentation:
    • Update spec.mdx, README.md, and regenerate docs/spec.md with the new schema key details.

@google-cla

google-cla Bot commented Jul 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@zachshallbetter

Copy link
Copy Markdown
Author

I signed it!

…test suite

* Introduce standard process.exitCode = 0 resets in export command test hooks to avoid Bun TypeError: exitCode must be an integer, which throws when assigned to undefined.

* Adjust FileReadError OS error test assertions in utils.test.ts to support both Node and Bun formatting structures (checking for ENOENT via error message substring or cause.code).

* Fix invalid format test assertions in export.test.ts to inspect the JSON error.message rather than error.error, resolving a stale expectation.
…arnings

Implement support for an optional omitted frontmatter configuration key in DESIGN.md, allowing design system authors to explicitly declare token categories that are intentionally skipped/absent (Issue google-labs-code#78).

* Update Parser: Add 'omitted' to the known schema keys and types. Implement frontmatter parsing supporting both bare strings (e.g. - spacing) and object mappings with reasons (e.g. section: rounded, reason: "No rounded corners").

* Update Model: Forward the parsed omitted sections to the compiled DesignSystemState. Add optional rule property to linter Findings.

* Implement Omission Validation & Suppression:
- Create omittedRule to validate the omitted configuration, warning on unknown or redundant sections (i.e. if tokens exist for a section listed in omitted).
- Update missing-sections and missing-typography rules to skip warnings if the targets are explicitly listed as omitted.
- Register the new rule in the default linter list.

* Test Coverage: Add comprehensive test suites verifying frontmatter parsing, model mapping, linter warnings (declared-omission, redundant-omission, unknown-omission), and rule suppressions.
* Update README.md: Add the 'omitted' key to the Token Schema block, update the active rules count to eleven, and add both 'token-like-ignored' and 'omitted-rules' to the summary table.

* Update spec.mdx: Add the 'omitted' property to the main schema block and add detailed type explanations for it.

* Regenerate spec.md: Run the spec:gen compiler tool to regenerate docs/spec.md with the updated schema content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant