microsoft / microsoft/DefinitelyTyped-tools
no-self-import doesn't account for path "grandparents"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 423
- Forks
- 237
- Avg merge
- 18h 18m
- Merged PRs (30d)
- 11
Description
Two errors discovered in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/66522 are a result of upgrading from the TSLint no-self-import implementation to the ESLint @definitelytyped/no-self-import implementation from #652:
2> /home/runner/work/DefinitelyTyped/DefinitelyTyped/types/chrome/har-format/index.d.ts
2> 1:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
from:
import { Entry, Log } from 'har-format';
...and...
1> /home/runner/work/DefinitelyTyped/DefinitelyTyped/types/openfin/v50/_v2/api/events/emitterMap.d.ts
1> 2:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
from:
```ts
import { EventEmitter } from 'events';
Contributor guide
No contributing guide indexed for this repository
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 reading the @definitelytyped/no-self-import implementation and reproduce the two reported cases in types/chrome/har-format/index.d.ts and types/openfin/v50/_v2/api/events/emitterMap.d.ts. Compare the ESLint behavior with the former TSLint implementation; done means imports from path grandparents are not incorrectly reported as self-imports while genuine self-imports remain detected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100