From 4f66a1e95e14c17b7f545d820d40973242f4c847 Mon Sep 17 00:00:00 2001 From: Daniil Sapa Date: Mon, 15 Jul 2024 12:15:27 +0300 Subject: [PATCH] Delegate getting the folder name to path module --- .../src/no-segments-on-sliced-layers/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/steiger-plugin-fsd/src/no-segments-on-sliced-layers/index.ts b/packages/steiger-plugin-fsd/src/no-segments-on-sliced-layers/index.ts index 38d8050..b04a46f 100644 --- a/packages/steiger-plugin-fsd/src/no-segments-on-sliced-layers/index.ts +++ b/packages/steiger-plugin-fsd/src/no-segments-on-sliced-layers/index.ts @@ -1,4 +1,4 @@ -import { sep } from 'node:path' +import { basename } from 'node:path' import { getLayers, isSliced, conventionalSegmentNames } from '@feature-sliced/filesystem' import type { Diagnostic, Rule } from '@steiger/types' @@ -13,7 +13,7 @@ const noSegmentsOnSlicedLayers = { if (isSliced(layer)) { for (const directChild of layer.children) { if (directChild.type === 'folder') { - const folderName = directChild.path.split(sep).pop() + const folderName = basename(directChild.path) const isConventionalSegment = folderName && conventionalSegmentNames.includes(folderName) if (isConventionalSegment) {