Skip to content

Commit

Permalink
Fix the problem of traversing the layer filesystem tree 2 times
Browse files Browse the repository at this point in the history
  • Loading branch information
daniilsapa committed Jul 22, 2024
1 parent 935407c commit d8c063d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/steiger-plugin-fsd/src/_lib/index-source-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export function indexSourceFiles(root: Folder): Record<string, SourceFile> {
// Even though files that are directly inside a layer are not encouraged by the FSD and are forbidden in most cases
// (except for an index/root file for the app layer as an entry point to the application), users can still add them.
// So, we need to index all files directly inside a layer to find errors.
walk(layer, { layerName: layerName as LayerName, sliceName: null, segmentName: null })
layer.children
.filter((child) => child.type === 'file')
.forEach((file) => walk(file, { layerName: layerName as LayerName, sliceName: null, segmentName: null }))

if (!isSliced(layer)) {
for (const [segmentName, segment] of Object.entries(getSegments(layer))) {
Expand Down

0 comments on commit d8c063d

Please sign in to comment.