From d8c063d2918af08d2aa11655606f66ffeffd9a1b Mon Sep 17 00:00:00 2001 From: Daniil Sapa Date: Mon, 22 Jul 2024 14:04:01 +0300 Subject: [PATCH] Fix the problem of traversing the layer filesystem tree 2 times --- packages/steiger-plugin-fsd/src/_lib/index-source-files.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/steiger-plugin-fsd/src/_lib/index-source-files.ts b/packages/steiger-plugin-fsd/src/_lib/index-source-files.ts index 46ee27d..1a03131 100644 --- a/packages/steiger-plugin-fsd/src/_lib/index-source-files.ts +++ b/packages/steiger-plugin-fsd/src/_lib/index-source-files.ts @@ -31,7 +31,9 @@ export function indexSourceFiles(root: Folder): Record { // 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))) {