Fix not finding eslint plugins relative to js file
Fix not finding eslint plugins relative to js file

This ended up being tricky. I was running `importjs fix`  on a file in
the brigade codebase and got the following error:

  Error: Cannot find module 'eslint-config-brigade/react'

After some digging into how node finds modules, and looking at the
source code for eslint [2] I realized that eslint will try to find
modules based on the location of the locally installed eslint module. In
our case, we have a local eslint installation in the import-js's
node_modules folder. In my case, the paths where eslint ended up trying
to find 'eslint-config-brigade' were the following:

  /Users/henrictrotzig/import-js/node_modules/node_modules
  /Users/henrictrotzig/import-js/node_modules/eslint/lib/util/node_modules
  /Users/henrictrotzig/import-js/node_modules/eslint/lib/node_modules
  /Users/henrictrotzig/import-js/node_modules/eslint/node_modules
  /Users/henrictrotzig/import-js/node_modules
  /Users/henrictrotzig/node_modules
  /Users/node_modules
  /node_modules
  /Users/henrictrotzig/.node_modules
  /Users/henrictrotzig/.node_libraries
  /usr/local/Cellar/node/4.2.1/lib/node

To also take the node_modules folder relative to the file being
processed into account, I tried a few things:

 - force eslint to use a different working directory, which might work
   but it will likely lead to other issues down the line.
 - programmatically editing module.paths, which had no effect.

The solution I ended up with that works requires using an internal
method of the node 'module' module. This is not great, as it will
eventually lead us into trouble along the way. The good part is that it
works, at least temporarily. So I'm leaving this hack here, hoping that
some smart soul (maybe a future me?) will come up with a better
solution.

[1]: https://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders
[2]: https://github.com/eslint/eslint/blob/master/lib/util/module-resolver.js

trotzig/import-js,trotzig/import-js,Galooshi/import-js,trotzig/import-js