-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow empty groups #208
Allow empty groups #208
Conversation
🦋 Changeset detectedLatest commit: 029a160 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
"@cobalt-ui/core": patch | ||
--- | ||
|
||
Allows DTCG files to contain empty groups. Previously they would cause a parsing error, now only a warning will be logged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Perfect! Agreed this should just be a patch.
@@ -42,6 +42,15 @@ describe('5. Group', () => { | |||
const tokens = getTokens(json); | |||
expect(tokens.find((t) => t.id === 'color.blue')!.$type).toBe('color'); | |||
}); | |||
|
|||
test('allow empty', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test!
This is great, thank you! After this merges, changeset will ship it to npm. 🎉 |
Hurray! Thanks for the quick review & release. Much appreciated. |
Changes
Makes the parser log a warning instead of an error when it encounters an empty group. Closes #206.
How to Review
Refer to the discussion in #206 for the rationale behind this change in behaviour.
I added a regression test that fails without this fix and passes with it. However, I'm not sure if the
expect(tokens.length).toBe(0)
line is really needed, asgetTokens()
already has anexpect()
assertion to check that there were no parsing errors. It felt a bit weird having a test without anexpect()
in it though, so I added that. Happy to remove it, if you think that's cleaner / clearer.Since this is a bug fix, I've classed it as a patch change in the changeset.