figma-plugin
figma-plugin copied to clipboard
Add support to treat references as "Invalid" when it's not suitable for that token
So I think the problem is that technically this resolves correctly, as the reference was found. It's just that that token is not a proper reference for this kind of token.
We should establish something like rules for what a token reference can be, such as a fontFamily token should only be able to refer to tokens that are of type string
or fontFamily
. or, technically, anything that isn't an object.
we do not have this logic yet.. and if we find this code 6 months from now we will have no idea why this code is there.
i'd say let's add code comments here to clarify why this is done the way it's done.
then we should do a refactor of the resolution to add something where we can - for each token type - schematically detect what a "valid" reference is, and treat it not as broken, but as "invalid". this requires more work than solving the current issue, which is why i'll approve, add code comments, and create a new issue to track this work.
Originally posted by @six7 in https://github.com/tokens-studio/figma-plugin/pull/2438#discussion_r1442279985
This came up in the case of atomic typography tokens for fontFamily reference a typograpy token, which should really be invalid. We need a new treatment for this during resolution.