From 1413deb24d2ec8e9d4c23a28b1b2cb53c383ed31 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Wed, 2 Oct 2024 21:34:21 +0300 Subject: [PATCH] fix: cannot read properties of undefined (reading 'split') (#628) --- 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('/');