Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

升级@umijs/fabric后, 格式化import自动排序问题 #137

Open
cwjTerrace opened this issue Jun 13, 2022 · 4 comments
Open

升级@umijs/fabric后, 格式化import自动排序问题 #137

cwjTerrace opened this issue Jun 13, 2022 · 4 comments

Comments

@cwjTerrace
Copy link

注意:这只是一个讨论issue,不需要解决

今天依赖重新安装后,格式化文件突然发现所有的import被重新排序了,因为有强迫症已经排序好了import,被强行改了之后很难受,所以排查原因。

排查到v2.11.0新增了2个插件prettier-plugin-organize-imports、prettier-plugin-packagejson,通过查询prettier插件文档可知是符合命名规则插件是自动导入的,prettier-plugin-organize-imports这个插件起了作用,要关闭插件自动导入可以配置{ pluginSearchDirs: false }

完整配置

const fabric = require('@umijs/fabric');

module.exports = {
  ...fabric.prettier,
  pluginSearchDirs: false
};
@pear794
Copy link

pear794 commented Jun 14, 2022

终于找到这个问题了,升级莫名其妙的改配置,这种配置难道默认不应该是false吗

@WayYOLO
Copy link

WayYOLO commented Jun 17, 2022

+1

@sanheng
Copy link

sanheng commented Jun 20, 2022

看 prettier-plugin-organize-imports 文档没有找到配置的地方,这个插件的规则可以配置吗?

@maqinghao
Copy link

官方好像没有给出克配置项,可以使用prettier-plugin-import插件实现,或者是eslint的sort-imports规则,在不行vscode 1.68 对import排序进行了优化支持

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants