feat: add omitted frontmatter key to suppress expected-missing lint warnings#155
Open
zachshallbetter wants to merge 3 commits into
Open
feat: add omitted frontmatter key to suppress expected-missing lint warnings#155zachshallbetter wants to merge 3 commits into
zachshallbetter wants to merge 3 commits into
Conversation
|
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. |
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.
e72bbdf to
896418f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented support for an optional
omittedfrontmatter configuration key inDESIGN.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-sectionsandmissing-typographywarnings when standard categories (such asspacing,rounded, ortypography) 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 theomittedfrontmatter key makes the omission intent explicit to both human reviewers and agents.Changes
'omitted'toSCHEMA_KEYSin the parser spec.omittedkey inside frontmatter, supporting both bare strings (e.g.,- spacing) and objects with reasons (e.g.,section: rounded, reason: "no rounded corners").omittedconfiguration to the compiledDesignSystemState.ruleID property to all lint findings for better programmatic parsing.missing-sectionsandmissing-typographychecks if a section is listed inomitted.omittedRulewhich generates validation findings:declared-omission(info): Confirms that a section was intentionally skipped.redundant-omission(warning): Emitted if a section is listed inomittedbut tokens are still defined.unknown-omission(warning): Emitted if an invalid section name is listed.spec.mdx,README.md, and regeneratedocs/spec.mdwith the new schema key details.