question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve module resolution

See original GitHub issue

Tell us about your environment

  • ESLint Version: v4.16.0
  • Node Version: v9.4.0
  • npm Version: v5.6.0

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

This is a follow-up of #9746. See this repository, which explains the issue: chrisblossom/eslint-issue-9746

What did you expect to happen?

ESLint should be able to work inside Lerna projects.

What actually happened? Please include the actual, raw output from ESLint.

ESLint throws errors regarding module resolutions.

As described here (https://github.com/eslint/eslint/issues/9746#issuecomment-356810436) it seems that this is the expected behaviour, however I’d argue that the changes presented here: #9896 are actually improving the module resolution logic, while fixing #9746.

First, it splits up the extraLookup path into multiple paths where modules should be looked for, according to Node module specifications.

Secondly, the change to getBaseDir seems pretty straightforward: the projectPath should not be a node_modules directory.

If those changes are accepted, it would actually resolve issues users have with ESLint and Lerna, while improving the module resolution logic.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Jan 29, 2018

That does help. However, I am still confused about how this affects user-facing behavior in general, because you’re describing it in terms of implementation details such as getBaseDir and extraLookup, which users wouldn’t be aware of.

Again, this issue is intended to discuss the external behavior that users would see, not the implementation. If we were to put an entry in the changelog that says “Updated the return value of getBaseDir”, this would not be useful to users, because getBaseDir is an implementation detail that users generally don’t know about. On the other hand, if we were to put an entry in the changelog that says “Update config resolution to also search for shareable configs from the location of the files being linted”, then this would be more useful to users because they would understand how this change affects them.

I am looking for the second kind of description for this change. You’re proposing a change to user-facing behavior, and it might be worthwhile, but I can’t tell because I’m not sure what the proposed change actually does. I’m asking for a general description of how the proposed change affects users, without referencing implementation details such as getBaseDir.

1reaction
ngotchaccommented, Jan 31, 2018

But wouldn’t it rightly make sense to take the eslint-config-foo the closest to the config-extension.json? I guess if a user installs the same module but different versions at the root of the project and in the config sub-directory, he would expect ESLint to choose the version of the config sub-folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
Read more >
Can Module Resolution Cache Usage Be Improved? #40356
I'm looking at a specific section of src/compiler/program.ts and see a place module resolution cache is available but unused.
Read more >
Module Resolution Strategy | TypeScript Tutorial - YouTube
NODE moduleResolution option 03:23 Classic Relative Import ... for India): smartherd@okaxis :: If you want to develop a website or a mobile ...
Read more >
Module Resolution - webpack
A resolver is a library which helps in locating a module by its absolute path. A module can be required as a dependency...
Read more >
Module Resolution or Import Alias: The Final Guide - Raul Melo
Module resolution or import alias is a way we can emulate the same way we import node_modules but with our internal code. We...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found