From 6c7775c458d6dffb648b00eb622094999031cde4 Mon Sep 17 00:00:00 2001 From: Jeroen Engels Date: Mon, 23 Jan 2017 19:49:33 +0100 Subject: [PATCH] Simplify implementation a bit --- src/rules/no-self-import.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/rules/no-self-import.js b/src/rules/no-self-import.js index 986af0c53f..ae3d4453b0 100644 --- a/src/rules/no-self-import.js +++ b/src/rules/no-self-import.js @@ -8,14 +8,9 @@ import isStaticRequire from '../core/staticRequire' function isImportingSelf(context, node, requireName) { const filePath = context.getFilename() - const resolvedPath = resolve(requireName, context) // If the input is from stdin, this test can't fail - if (filePath === '') { - return - } - - if (filePath === resolvedPath) { + if (filePath !== '' && filePath === resolve(requireName, context)) { context.report({ node, message: 'Module imports itself.',