-
Notifications
You must be signed in to change notification settings - Fork 45
Find correct linter instance also in case of multiple folders in workspace #97
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
Conversation
I think the tests failed because of #94 and not anything I did... |
src/processor_options.js
Outdated
throw new Error('Could not find ESLint Linter in require cache'); | ||
} | ||
// there may be more than one instance in case of multiple folders in the workspace | ||
// try to find the one that's inside the same node_modules directory as this plugin | ||
// if not found for some reason, assume it's the last one in the array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate why you pick the last one in the array as fallback? The previous behavior was picking the first, maybe we should keep this as fallback behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because the extension will be loaded only when needed, i.e. when a Svelte file has to be linted for the first time. This also applies to ESLint itself though, so the chances are high that in the case like I had, where I first opened a JS file from the server project (loading the ESLint instance in the server directory and no Svelte plugin instance) and only afterwards a Svelte file from the frontend project (loading the second ESLint instance in the frontend directory and this time also the Svelte plugin instance), the right ESLint that belongs to the project in question will be loaded more recently.
Of course this still won't work if the order happens to be something like JS file in frontend in another directory where eslintrc doesn't specify the Svelte plugin -> JS file in server -> Svelte file. But this is less likely in my opinion. What do you think?
@dummdidumm Hi, is there any update on this? I have addressed your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Conduitry looks good to me. If for you, too, could you merge?
This has been released in 3.2.0. Thank you! |
This fixes #96