tsserver
feature: importModuleSpecifierPreference: "non-relative"
but allow siblings
#55160
Open
5 tasks done
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Domain: Auto-import
Suggestion
An idea for TypeScript
Suggestion
π Search Terms
importModuleSpecifierPreference
allow sibling
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Let auto-imports mirror:
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-parent-imports.md
or the old:
microsoft/tslint-microsoft-contrib#778
New option, could be named anything, "non-relative-allow-sibling", "no-parent", "relative-iff-sibling", etc
π Motivating Example
re: "why this feature improves the language", this is not a language feature, but an IDE feature which happens to be handled by TypeScript repo:
TypeScript/src/server/protocol.ts
Line 3487 in 3b45f4d
Motivating example: When you auto-import, you want to import as
./foo
if in same directory, otherwise something like@/utils/foo
.shortest
doesn't necessarily work since../foo
could be shorter than e.g.@/modules/feature/foo
π» Use Cases
Currently using
importModuleSpecifierPreference: "non-relative"
as-is.The text was updated successfully, but these errors were encountered: