Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of local plugins #10

Closed
roadhump opened this issue Oct 4, 2015 · 8 comments
Closed

Add support of local plugins #10

roadhump opened this issue Oct 4, 2015 · 8 comments

Comments

@roadhump
Copy link

roadhump commented Oct 4, 2015

eslint_d does not resolve local plugins in project's node_modules as eslint does

It means

npm install eslint eslint_d babel-eslint --save-dev

// .eslintrc
{"parser": "babel-eslint"}

$ ./node_modules/.bin/eslint_d src/1.js 

/Users/roadhump/Projects/xx/src/1.js
  0:0  error  Cannot find module 'babel-eslint'

$ ./node_modules/.bin/eslint_d src/1.js 
// no errors
@mantoni
Copy link
Owner

mantoni commented Oct 4, 2015

I guess I know why this happens: eslint uses a simple require statement to load the configured parser. If the eslint_d server was started in a directory that doesn't have the parser in the node_modules resolve path, it can't find the parser. You can easily check by running eslint_d restart, which should fix it.

A possible solution could be to run a new eslint_d server for each directory in use, or restart the existing one transparently whenever the directory changes. Any other ideas?

@Schniz
Copy link

Schniz commented Nov 4, 2015

Maybe: whenever I call to eslint_d, it adds the current directory to the module resolver, and removes it afterwards?

@Schniz
Copy link

Schniz commented Nov 4, 2015

Or synlinking and unlinking afterwards

@mantoni
Copy link
Owner

mantoni commented Nov 5, 2015

Just release eslint_d v2.2.0 which addresses this issue. See the changelog entry for details.

@roadhump @Schniz Can you please test whether this works for you now? I'd appreciate your feedback, or new issues in case things don't work as expected.

@mantoni mantoni closed this as completed Nov 5, 2015
@roadhump
Copy link
Author

roadhump commented Nov 8, 2015

@mantoni seems working just fine, thank you!

@Schniz
Copy link

Schniz commented Nov 13, 2015

@mantoni works great! 👍

@expelledboy
Copy link
Contributor

@mantoni Amazing work! I have just noticed that if I change the plugin configuration in .eslintrc after using eslint_d that it requires a eslint_d restart. Would be useful if it was auto-restarted on changes to that file, or just add a note to the README.

@mantoni
Copy link
Owner

mantoni commented Aug 10, 2016

Yes, this could be added to the readme…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants