From 5fd356da8abbcfec7c6108825646bbe34074acf1 Mon Sep 17 00:00:00 2001 From: LaySent Date: Thu, 1 Jun 2017 08:20:23 +0800 Subject: [PATCH 1/2] Fix issue #720 Simply prevent eslint to check any parent folder of current working directory. --- utils/resolve.js | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/resolve.js b/utils/resolve.js index 1d6e164b1..8193e7731 100644 --- a/utils/resolve.js +++ b/utils/resolve.js @@ -21,6 +21,7 @@ exports.fileExistsWithCaseSync = function fileExistsWithCaseSync(filepath, cache // null means it resolved to a builtin if (filepath === null) return true + if (filepath.toLowerCase() === process.cwd().toLowerCase()) return true const parsedPath = path.parse(filepath) , dir = parsedPath.dir From ac3d76a5157142487001af43c9e8154fc2e097d2 Mon Sep 17 00:00:00 2001 From: LaySent Date: Thu, 1 Jun 2017 12:21:04 +0800 Subject: [PATCH 2/2] Add unit test --- tests/src/core/resolve.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/src/core/resolve.js b/tests/src/core/resolve.js index e8f255f34..71791c500 100644 --- a/tests/src/core/resolve.js +++ b/tests/src/core/resolve.js @@ -3,6 +3,7 @@ import { expect } from 'chai' import resolve, { CASE_SENSITIVE_FS, fileExistsWithCaseSync } from 'eslint-module-utils/resolve' import ModuleCache from 'eslint-module-utils/ModuleCache' +import * as path from 'path' import * as fs from 'fs' import * as utils from '../utils' @@ -43,6 +44,11 @@ describe('resolve', function () { expect(fileExistsWithCaseSync(file, ModuleCache.getSettings(testContext))) .to.be.false }) + it('detecting case does not include parent folder path (issue #720)', function () { + const f = path.join(process.cwd().toUpperCase(), './tests/files/jsx/MyUnCoolComponent.jsx') + expect(fileExistsWithCaseSync(f, ModuleCache.getSettings(testContext), true)) + .to.be.true + }) }) describe('rename cache correctness', function () {