From f513542be93d6ac14e90c2dc1e12df6c342834d8 Mon Sep 17 00:00:00 2001 From: splincode Date: Wed, 2 Oct 2024 21:26:51 +0300 Subject: [PATCH] fix: cannot read properties of undefined (reading 'split') --- projects/eslint-plugin-experience/rules/prefer-deep-imports.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/eslint-plugin-experience/rules/prefer-deep-imports.js b/projects/eslint-plugin-experience/rules/prefer-deep-imports.js index eb7cfc47..eba05cb8 100644 --- a/projects/eslint-plugin-experience/rules/prefer-deep-imports.js +++ b/projects/eslint-plugin-experience/rules/prefer-deep-imports.js @@ -115,7 +115,7 @@ module.exports = { * @return {any} */ function findNearestEntryPoint(filePath) { - const pathSegments = filePath.split('/'); + const pathSegments = (filePath ?? '')?.split('/') ?? []; for (let i = pathSegments.length - 1; i >= 0; i--) { const possibleEntryPoint = pathSegments.slice(0, i).join('/');