microsoft / microsoft/TypeScript
Quick Fix: Suggest correct capitalization when importing a file with incorrect capitalization
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 2.3
Mac does not enforce file name capitalization. I had an issue where tests was passing on my Mac and I was getting an error like this in Linux:
Cannot find module './isKind' from 'index.ts'
File was named iskind by mistake.
It should be easy to detect errors like this by reading all files in target directory and look for similar file names. This can go beyond capitalization and can suggest correct file names with edit distance.
Code
import {foo} from './myModule'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the import example with a mismatched filename such as ./isKind versus iskind, comparing behavior on a case-insensitive Mac and Linux. Trace TypeScript's module-resolution diagnostics and directory file lookup; done means reporting the likely correctly capitalized filename, including cases with similar names or edit distance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100