Keep all necessary components in the same folder or reference them by path / module name so that it becomes simple to reason about where to make changes. Grouping these together implies a relationship between them. See Universal project folder structure for an example.
Avoid 'global magic' or things that are defined outside of scope where they are not visible. Compact and readable functions can be simply written and repeated in the native language to avoid the need to look things up. If there is a good case for magic, leave a pathway to discovering where the abstractions are defined and how they can be used.
Avoid sorting by type. If a module or component has tests, styles, logic, localization, assets, images, place them together in the same folder as the main file.
Break things down to irreducible parts. If there's too much going on in one folder, maybe things can be extracted to another folder. Keep the purpose of each module clear. Ideally, the only things present in a given folder should be referenced by the corresponding tests.
Reply with a comment.