Skip to content

Commit 00e0f58

Browse files
committed
ensure NODE_PATH environment variable is honored when checking for extraneous dependencies
1 parent 12108bd commit 00e0f58

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

packages/eslint-config-react-app/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
'use strict';
1111

12+
const resolveNodePath = require('./utils/resolveNodePath');
13+
1214
// Inspired by https://github.com/airbnb/javascript but less opinionated.
1315

1416
// We use eslint-loader so even warnings are very visible.
@@ -49,6 +51,7 @@ module.exports = {
4951
'import/resolver': {
5052
node: {
5153
extensions: ['.js', '.json'],
54+
moduleDirectory: ['node_modules'].concat(resolveNodePath()),
5255
},
5356
},
5457
},

packages/eslint-config-react-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"url": "https://github.com/facebookincubator/create-react-app/issues"
99
},
1010
"files": [
11+
"utils",
1112
"index.js"
1213
],
1314
"peerDependencies": {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
function resolveNodePath() {
4+
const nodePaths = (process.env.NODE_PATH || '')
5+
.split(process.platform === 'win32' ? ';' : ':')
6+
.filter(Boolean);
7+
8+
return nodePaths;
9+
}
10+
11+
module.exports = resolveNodePath;

0 commit comments

Comments
 (0)