TypeScript编码样式指南? [英] TypeScript Coding Style Guide?

查看:75
本文介绍了TypeScript编码样式指南?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢 Airbnb JavaScript样式指南.大多数规则也适用于TypeScript,但是当然,它不涵盖特定的TypeScript语言功能.

I love the Airbnb JavaScript Style Guide. Most of the rules also apply to TypeScript, but of course it doesn't cover specific TypeScript language features.

我还找到了 Microsoft TypeScript编码指南,但它们仅用于TypeScript项目本身,而不用于用于使用 TypeScript的项目.

I have also found the Microsoft TypeScript Coding Guidelines but they are for the TypeScript project itself, not for projects that use TypeScript.

最后,我发现了 Platypi编写的TypeScript样式指南,但它并不像我希望的那样详细.我还错过了另一本(官方的)《 TypeScript样式指南》吗?还是我列出的仅有的两个存在?

Finally I found the TypeScript Style Guide by Platypi but it's not as detailed as I'd like it to be. Is there another (official?) TypeScript Style Guide that I missed? Or are the two I listed the only ones that exist?

推荐答案

TypeScript团队不会为使用TypeScript的其他项目发布官方"样式指南.有关编译器本身的准则既太具体又不够广泛,无法用于一般用途.我不会将它们用作基准.

The TypeScript team doesn't issue an "official" style guide for other projects using TypeScript. The guidelines for working on the compiler itself are both too specific and not broad enough for general use; I would not use them as a baseline.

任何最新的ES6 JavaScript样式指南都将涵盖除类型注释之外的几乎所有TypeScript构造,因此我将从您最喜欢的JS样式开始,并确定您希望类型注释的规则适用于什么会.

Any JavaScript style guide that is up-to-date for ES6 is going to cover nearly all TypeScript constructs except for type annotations, so I would start with your favorite JS style and decide on what you want the rules for type annotations to be.

TSLint 是围绕类型/类型注释执行样式规则的好选择.

TSLint is a good choice for enforcing style rules around types / type annotations.

这篇关于TypeScript编码样式指南?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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