Skip to content

Commit

Permalink
ensure NODE_PATH environment variable is honored when checking for ex…
Browse files Browse the repository at this point in the history
…traneous dependencies
  • Loading branch information
matoilic committed Mar 10, 2017
1 parent 12108bd commit 00e0f58
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/eslint-config-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

'use strict';

const resolveNodePath = require('./utils/resolveNodePath');

// Inspired by https://github.com/airbnb/javascript but less opinionated.

// We use eslint-loader so even warnings are very visible.
Expand Down Expand Up @@ -49,6 +51,7 @@ module.exports = {
'import/resolver': {
node: {
extensions: ['.js', '.json'],
moduleDirectory: ['node_modules'].concat(resolveNodePath()),
},
},
},
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"url": "https://github.com/facebookincubator/create-react-app/issues"
},
"files": [
"utils",
"index.js"
],
"peerDependencies": {
Expand Down
11 changes: 11 additions & 0 deletions packages/eslint-config-react-app/utils/resolveNodePath.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

function resolveNodePath() {
const nodePaths = (process.env.NODE_PATH || '')
.split(process.platform === 'win32' ? ';' : ':')
.filter(Boolean);

return nodePaths;
}

module.exports = resolveNodePath;

0 comments on commit 00e0f58

Please sign in to comment.