-
Notifications
You must be signed in to change notification settings - Fork 37
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
Theme check for settings keys inside presets and default #742
Conversation
packages/theme-check-common/src/checks/valid-settings-key/index.spec.ts
Outdated
Show resolved
Hide resolved
packages/theme-check-common/src/checks/valid-settings-key/index.spec.ts
Outdated
Show resolved
Hide resolved
expect(offenses[0].message).to.equal( | ||
`Setting 'non-existent-setting' does not exist in schema.`, | ||
); | ||
}); |
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.
Let's add a case for n>1 offenses
+ a case where we have 1 missing 1 valid?
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.
I can definitely do 2 missing settings. But checking across multiple rules wouldn't be unit testing this rule.
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.
Yes this is known. Unfortunately, we have to be more lenient with our theme checks - which unfortunately makes theme check worse 😅. We could still try to do it, but seems on-par with a lot of other languages where you have syntax errors in referenced files. |
b696ba6
to
65f9c9d
Compare
What are you adding in this PR?
Fixes #624
Fixes #602
Shoutout to @AribaRajput for creating the initial PR to get this done quickly
What's next? Any followup issues?
How to test
NOTE: This check DOES NOT check if the theme block exists or not. That is the responsibility of another theme check. I have noticed a bug where if you have local blocks, and there are references to local blocks that dont exist within
presets
anddefault
, no theme check error is thrown. I will fix that in a following PR.Testing settings
presets.[].settings
anddefault.settings
that has keys that match thesettings.id
defined above. Create some that don't. See error.Testing preset/default block settings defined in local block
presets.[].blocks.[].settings
anddefault.blocks.[].settings
that has keys that match thesettings.id
defined above. Create some that don't. See error.Testing preset/default block settings defined in theme block
presets.[].blocks.[].settings
anddefault.blocks.[].settings
that has keys that match thesettings.id
defined in the block file being referenced. Create some that don't. See error.Before you deploy
changeset