elicwhite / ESLint-Formatter

Sublime Text 3 Plugin to Autoformat with Eslint
MIT License
139 stars 20 forks source link

Programmatically find Node and ESLint directory #65

Closed memoryonrepeat closed 4 years ago

memoryonrepeat commented 6 years ago

Hi, I just tried your plugin and it works great. My only concern is that the directory for Node and ESLint is hardcoded into the settings which makes it inconvenient for nvm users who use a different directory. How about making it dynamic instead? I am asking since I faced the similar issue with plugins that depend on Node before, so I'm using a script which overrides the PATH to fix it. If you don't have time I'm always happy to help with PR.

katerlouis commented 4 years ago

also a nvm user here; @tienthanh8490 did you make a pr yet? could you share your script overriding the PATH?

skeggse commented 4 years ago

In 2.4.0, you can specify false in the local_eslint_path and node_path objects, which let you use an arbitrary command that's available on the PATH. For example, if you want to use the globally available eslint_d:

{
  "node_path": {"linux": false},
  "eslint_path": {"linux": "eslint_d"},
  "local_eslint_path": {"linux": false},
  "format_on_save": true,
  "fix_to_stdout": true
}

If that doesn't fix your problem, please reopen!