microsoft / microsoft/TypeScript

Enforce consistent imports when directory is in jsconfig's paths

Open
#38,222 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TS Template added by @mjbvz

TypeScript Version: 3.9.0-dev.20200427

Search Terms

  • javascript
  • auto import
  • symlink

  • VSCode Version: 1.43.2
  • OS Version: macOS 10.15.3

Steps to Reproduce:

  1. Specify a jsconfig.json that includes compilerOptions.paths to a specific directory
  2. Let intellisense import a variable from this specific directory
  3. Depending on how deep you are in the code base, it will resolve that variable relatively or absolutely

You can take a look at this reproduction repo: https://github.com/Floriferous/vscode-symlink-import

More specifically the 2 files code.js and deepCode.js, they both resolve the variable differently, as javascript.preferences.importModuleSpecifier is set to auto.

I'd like a folder specified in paths to always resolve as myPathsFolder/...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction repository and its jsconfig.json, then compare the imports generated in code.js and deepCode.js when javascript.preferences.importModuleSpecifier is set to auto. Verify how paths entries affect the selected module specifier. Done means both files consistently use the configured myPathsFolder/... form.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.