microsoft / microsoft/TypeScript
If autoimporting import that is commented out - uncomment it instead of adding new one
未关闭
还没有人认领这个 Issue。
Awaiting More Feedback
Suggestion
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.4k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 117
描述
Search Terms
autoimport commented uncomment import
Suggestion
Consider we have such imports already in some file:
import React, {
useState,
// useEffect,
} from 'react';
Then - if you write useEffect - TS will suggest auto importing it - which is cool. If you choose to auto import it - your import statement will look something like:
import React, {
useState,
// useEffect,
useEffect,
} from 'react';
Which is not a big deal, but leads to some kind of duplication.
Desired result would be:
import React, {
useState,
useEffect,
} from 'react';
Which is just removing the comment next to the import I want to use.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 TypeScript 的 language-service 自动导入处理开始,找到涵盖带有注释掉的命名导入的导入的测试。为所示的 React 风格导入添加一个回归测试用例,并验证选择自动导入时会移除注释,而不是添加重复的导入。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- tooling
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100