简体   繁体   English

如何使用 Airbnb JavaScript 风格指南设置 Prettier

[英]How do I set up Prettier with Airbnb JavaScript Style Guide

How can I configure Airbnb's Style Guide in Prettier?如何在 Prettier 中配置 Airbnb 的风格指南? I'm using VS Code.我正在使用 VS 代码。 Thanks in advance!提前致谢!

eslint-config-prettier will disable all rule on formatting. eslint-config-prettier将禁用所有格式规则。 It mentions eslint-config-airbnb several times in the Readme file, but they didn't guarantee that it 100% follow airbnb rules.它在自述文件中多次提到eslint-config-airbnb ,但他们并不能保证它 100% 遵循 airbnb 规则。

I guess the if you want to make sure they work fine together, you have to check the rules yourself.我想如果你想确保它们一起正常工作,你必须自己检查规则。

Update:更新:

I have check the source file of eslint-config-prettier .我检查了eslint-config-prettier的源文件。 Here is the list of rules can be override:以下是可以覆盖的规则列表:

// The following rules can be used in some cases. See the README for more
// information. (These are marked with `0` instead of `"off"` so that a
// script can distinguish them.)

curly: 0,
"max-len": 0,
"no-confusing-arrow": 0,
"no-mixed-operators": 0,
"no-tabs": 0,
quotes: 0,

According to their comment, other format rules should never be used with Prettier.根据他们的评论,其他格式规则不应与 Prettier 一起使用。

您可以使用eslint-config-prettier来扩展Prettier配置。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何运行Airbnb javascript样式指南中的代码? - How do I run the code in the Airbnb javascript style guide? 如何使Airbnb的JavaScript样式eslint指南与React,ES6一起在vim中工作? - How to get Airbnb's JavaScript style eslint guide working in vim with react, es6? 通过解构或forEach进行缩减-迭代和Airbnb JavaScript样式指南 - Reduce with deconstruction or forEach - Iteration and Airbnb JavaScript Style Guide 如何将 eslint airbnb 风格指南合并成一个文件以复制到 package.json 中? - How can I concatinate the eslint airbnb style guide into one file to copy into package.json? Airbnb样式指南:命名约定的规则不起作用 - Airbnb style guide:rules for naming conventions not working 为什么即使我将其设置为两个空格和硬制表符,Eslint 仍会在 atom 中使用 Airbnb 样式指南的两个空格规则引发错误? - why does Eslint throws error with the Airbnb style guide's two spaces rule in atom even though I have it set to two spaces and hard tabs? Airbnb JavaScript指南中的开关示例用法是否不一致? - Is the switch example usage in airbnb javascript guide inconsistent? 如何在 Sublime 3 中设置 JavaScript? - How do I set up JavaScript in Sublime 3? 如何在JavaScript中设置`appendLink`? - How do I set up `appendLink` in JavaScript? 如何使用 Airbnb JavaScript 样式更新数组中的所有项目? - How to update all items in an Array with Airbnb JavaScript Style?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM