Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions es5/paths.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var path = require('path');

var delimiter = path.delimiter;
/**
* Temporary --es5 argument to support es5-compatible .eslintrc
* Remove when es5-fix.js is no longer necessary.
Expand All @@ -17,7 +17,7 @@ module.exports = function es5Paths() {
// the binPath using the configDir, which results in a broken
// binPath when using --es5, because the --es5 configDir has one
// more level of directory nesting.
var binPath = path.join(__dirname, '..', 'node_modules', '.bin');
var binPath = toBinPaths(__dirname);
if (es5) {
configDir = path.join(configDir, 'es5');
// We need to remove the --es5 argument because fashion-show
Expand All @@ -30,3 +30,16 @@ module.exports = function es5Paths() {
binPath: binPath
};
}

function toBinPaths(dir) {
var needleDir = dir;
var parentDir = path.dirname(needleDir);
var binPath = path.join(needleDir, 'node_modules', '.bin');
while (needleDir !== parentDir) {
needleDir = parentDir;
parentDir = path.dirname(needleDir);
binPath = path.join(needleDir, 'node_modules', '.bin') +
delimiter + binPath;
}
return binPath;
}