字体脚本编码样式指南 TypeScript? ?

我喜欢 Airbnb JavaScript 样式指南。大多数规则也适用于 TypeScript,但是当然它不包括特定的 TypeScript 语言特性。

我也找到了 MicrosoftTypeScript 编码指南,但它们是针对 TypeScript 项目本身的,而不是针对 使用 TypeScript 项目的。

最后,我找到了 Platypi 的字体指南,但它没有我想要的那么详细。还有其他(官员?)我错过的字体样式指南?还是只有我列出来的那两个存在?

58321 次浏览

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.

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 is a good choice for enforcing style rules around types / type annotations.

Update: TSLint is currently deprectated in favour of ESLint.

Maybe this is a bit late, but I stumbled upon https://github.com/excelmicro/typescript which also provides a bit more detailed tslint.json in the linters folder ... it is also based on the airbnb/javascript styleguide ...

Yet another Styleguide (which we use for angular 1 development with TypeScript) is https://angular.io/guide/styleguide