-
Notifications
You must be signed in to change notification settings - Fork 46
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
Default to using require to find 'eslint' if the module isn't found in the test directory #40
Comments
Related to #35. Note that a normal require does not find eslint in the PATH, it only finds it in a It sounds like you’re just asking the findUp to start lower than the root dir - can you elaborate on your use case where you have a nested node_modules? |
In my particular use case, I have a side by side folder structure as shown below. In this structure there is a single
If I want to run tests over a single project, say with The situation looks to be similar if
Hope this sheds some light on what I'm trying to do, Thanks |
In consolidating my test tools in a separate project I'm trying to prevent a proliferation of In other words, is the project structure that I'd prefer to use likely to be supported by this module? |
Hi there,
I'd like the runner to be able to find the
eslint
module in a path relative to the runner, or one that has been installed globally.Currently the runner imports eslint according to the rules in
getLocalESLint
. This function finds the first node_modules directory up from the<rootDir>
then tries to require eslint from it, regardless of whether the package exists there or not.Would it be possible to provide a fallback require in case this fails?
The new method would search for
'node_modules/eslint'
in thefindUp
, then if that fails to find a path, try to import the module with a plain oldrequire('eslint')
. This will prefer existing versions of eslint in the test directory, and default to an eslint that can be found using the standardrequire
call.Can submit a PR if req'd
The text was updated successfully, but these errors were encountered: