WebStorm:配置 Prettier 以使用选项卡? [英] WebStorm: configure Prettier to use tabs?

查看:55
本文介绍了WebStorm:配置 Prettier 以使用选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

那是一个文件夹.我尝试将其更改为 npm\prettier.cmd 并添加开关,但这不起作用(它只是变成红色).

如何设置 WebStorm 以在 Prettier 中使用标签?

解决方案

由于 https://github.com/prettier/prettier/pull/2434 修复,Prettier(甚至全局!)在格式化时使用最接近当前文件(在目录树上)的配置文件.

因此,您可以通过在项目 package 中添加相应的 .prettierrc 文件或 "prettier" 部分来全局安装并在您的项目中配置它.json.

The Prettier docs say to use --use-tabs to override the default behavior. WebStorm automatically populated the Prettier package:

That's a folder. I tried changing it to npm\prettier.cmd and adding the switch, but that doesn't work (It just turns red).

How can I set WebStorm to use tabs with Prettier?

解决方案

Due to https://github.com/prettier/prettier/pull/2434 fix, Prettier (even global!) uses configuration file nearest to current file (up the directory tree) when formatting.

So, you can install it globally and configure it in your project, by adding the corresponding .prettierrc file or "prettier" section in project package.json.

这篇关于WebStorm:配置 Prettier 以使用选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆