Are subfolders still discouraged if name conflicts aren't possible? #15549
|
The style guide says not to put components into subfolders, and one reason given is:
But if the tool, in my case it is nuxt, builds the component's name from its full folder path, not just the filename, then two files both called Concretely, we have several unrelated areas that each define their own Same suffix, different prefix, repeated across dozens of files (100+). With path-derived naming, grouping by area would let each just be Are there other downsides to using folders, besides the three the guide lists (slower to navigate, name conflicts, harder refactoring)? I posted a framework-specific version here: nuxt/nuxt#36362 |
Replies: 1 comment 1 reply
|
The advice is not an absolute ban: the guide itself says to consider directories for very large applications (its example threshold is 100+ components), which matches your case. Path-derived names solve the runtime registration collision, but they do not completely solve the editor problem: several tabs/search results can still be named For a 100+ component Nuxt app, domain folders are reasonable. A practical compromise is: Nuxt removes duplicate name segments, so you retain Reference: https://vuejs.org/style-guide/rules-strongly-recommended.html#order-of-words-in-component-names |
The advice is not an absolute ban: the guide itself says to consider directories for very large applications (its example threshold is 100+ components), which matches your case.
Path-derived names solve the runtime registration collision, but they do not completely solve the editor problem: several tabs/search results can still be named
Table.vue. The remaining trade-offs are directory navigation and path-based imports during refactors.For a 100+ component Nuxt app, domain folders are reasonable. A practical compromise is:
Nuxt removes duplicate name segments, so you retain
<ReportSalesTabl…