Skip to content

Commit 84dfa73

Browse files
committed
fix: detect case-sensitive filesystems correctly under yarn PnP
yarn under PnP does not create a `node_modules` directory, and instead files like `reSOLVE.js` file is served from a virtual filesystem, which is always case sensitive and not representative of the real underlying filesystem.
1 parent e156316 commit 84dfa73

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

utils/resolve.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ const path = require('path');
1010
const hashObject = require('./hash').hashObject;
1111
const ModuleCache = require('./ModuleCache').default;
1212

13-
const CASE_SENSITIVE_FS = !fs.existsSync(path.join(__dirname.toUpperCase(), 'reSOLVE.js'));
13+
const CASE_SENSITIVE_FS = !fs.existsSync(
14+
fs.existsSync(path.join(process.cwd(), 'package.json')) ?
15+
path.join(process.cwd().toUpperCase(), 'pacKAGE.json') :
16+
path.join(__dirname.toUpperCase(), 'reSOLVE.js')
17+
);
1418
exports.CASE_SENSITIVE_FS = CASE_SENSITIVE_FS;
1519

1620
const ERROR_NAME = 'EslintPluginImportResolveError';

0 commit comments

Comments
 (0)