简体   繁体   English

Angular 2标准编码样式指南

[英]Angular 2 standard coding style guide

I can see the style guide written by angular team over here: 我可以在这里看到Angular团队编写的样式指南:

https://angular.io/guide/styleguide https://angular.io/guide/styleguide

and i agree with most of the guides but there is not much information about the coding style guide like PSR-2 . 我同意大多数指南,但是关于coding style guidePSR-2)的信息并不多。

Example: 例:

About the starting and ending of curly braces, colon on selectors, variables name etc. 关于花括号的开始和结束,选择器上的冒号,变量名称等。

Is there any specific guide for above mentioned example? 上述示例是否有任何具体指南?

I can see this set of rules on angularClass's tslint but couldn't fully understand about it: 我可以在angularClass的tslint上看到这套规则,但无法完全理解:

https://github.com/AngularClass/angular-starter/blob/master/tslint.json https://github.com/AngularClass/angular-starter/blob/master/tslint.json

If the question seems unclear will be happy to edit and clearify more. 如果问题似乎不清楚,将很乐意编辑和澄清更多内容。

Angular team actually doesn't define it, because it's more related to the Javascript/Typescript language itself, than the framework. Angular团队实际上没有定义它,因为它与Javascript / Typescript语言本身相比,与框架更相关。

What I usually follow is the Airbnb's Javascript style guide . 我通常遵循的是Airbnb的Javascript样式指南 And for using its rules with TSLint, I use this package - I'm not sure about the completeness of it versus the original ESLint version - but it looks good for me). 对于与TSLint一起使用其规则的情况,我使用了此程序包 -我不确定它与原始ESLint版本的完整性-但对我来说看起来不错)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM