英文:
Prettier config for intellij settings
问题
在我们的前端(React)代码库中,有代码已经写了两年,使用了默认的 IntelliJ 代码设置。我们想开始使用 Prettier,不与一个 IDE 耦合,我们看到有两个选择:
- 在所有旧代码上运行 Prettier 并为代码样式配置 IntelliJ。
- 配置 Prettier 与 IntelliJ 默认的相同设置。
我们更倾向于选择第二个选项,因为我们想保持清晰的 Git 历史记录,关于如何使用 IntelliJ 设置配置 Prettier 以及是否听起来合适,您有什么建议吗?由于 Prettier 在一些代码样式方面持有特定意见。
英文:
On one of our frontend (react) repos we have code written for the past 2 years styled with default IntelliJ code-settings
We would like to start using Prettier and not be coupled with 1 IDE, we see 2 options:
- Run prettier on all legacy code and configure IntelliJ with prettier for code-style
- Configure prettier to the same settings IntelliJ has as default
We would prefer to go with option #2 since we want to keep a clean git history, any suggestions on how to configure Prettier with IntelliJ settings, and if that sounds like the right thing to do as Prettier is opinionated about some code-styles.
答案1
得分: 1
Prettier是一个有着非常有限一组配置选项的主观格式化工具,并且其团队不会接受添加新选项的请求,详情请见https://prettier.io/docs/en/option-philosophy.html。因此,很难配置Prettier以生成与IDEA格式化工具相同的输出。
我建议将Prettier用作您的代码格式化工具,可以将其设置为IDEA的默认格式化工具。
英文:
Prettier is opinionated formatter with a very limited set of configuration options, and its team is not going to accept any requests for adding new options, see https://prettier.io/docs/en/option-philosophy.html. So Prettier can hardly be configured to produce the same output as IDEA formatter.
I'd suggest using Prettier as a formatter for your code, it can be set up as a default formatter for IDEA
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论