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.',