-
Notifications
You must be signed in to change notification settings - Fork 18
Conversation
7078350
to
763dc1b
Compare
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.
Code makes sense to me, just made some suggests for the way you describe this rule.
In this case, I don't think you need a folder prefix. Do we imagine a lot of images related rules? Probably not.
Wish I had a good answer and I imagine we are pretty inconsistent. I think there are official standards out there somewhere but I couldn't find them unfortunately. In the past, I've just chosen the one that sounds right to me 🤷♂️ In this case I would go with
I don't think an images config is worthwhile. I think just keep it amongst the other generic ones, this has nothing to do with polaris specifically. If anything, we have a number of file-location-y/import (strict-component-boundaries, no-ancestry-direct-import) rules that would be a more appropriate config-grouping for this. Also, remember to add this to the Readme, Changelog, etc... |
There might be one or two more down the line but that's it. No folder it is :)
I was thinking that if we do "prefer" then what comes after becomes a positive statement -
Cool. I'll toss it into the same config as strict-component-boundaries and no-ancestry-direct-import. Thanks for being a sounding board for my overthinking :) |
848a0a9
to
e0ef3cd
Compare
The Polaris team has been doing some research into how icons (and kinda images in general) get used.
One thing that was identified was that we strongly tend towards putting images in a dedicated folder within a component (overwhelmingly either
images
,icons
orillustrations
) then create an index file for that folder. Then within the component you import from that index file.Once https://github.com/Shopify/web/pull/10568 is merged then the stats will be: 494 svg files are imported into an index, 36 are imported elsewhere.
images-no-direct-imports
is a new rule to enforce the convention of creating an index file by disallowing imports of image files into any file that is not the index file in the same directory as the svg resides.Open questions:
no-direct-imports
orprefer-folder-imports
(or something to that effect)