Skip to content

Commit 90be9d6

Browse files
committed
#19 [add] Javascript comments
1 parent 33f8c0e commit 90be9d6

File tree

1 file changed

+121
-1
lines changed

1 file changed

+121
-1
lines changed

translations/pt_BR/README.md

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
* [ORIGINAL](https://github.com/hemersonvianna/code-style-guidelines/)
99

10-
## Sumário
10+
## Summary
1111

1212
1. [Global](#global)
1313
* [Identation](#identation)
@@ -87,6 +87,8 @@ insert_final_newline = true
8787
trim_trailing_whitespace = false
8888
```
8989

90+
**[⬆ voltar ao topo](#summary)**
91+
9092
### Commits
9193

9294
#### English
@@ -120,6 +122,8 @@ git commit -m "#10 [add] readme with the rules"
120122
git commit -m "my first commit"
121123
```
122124

125+
**[⬆ voltar ao topo](#summary)**
126+
123127
### HTML
124128

125129
#### HTML Syntax
@@ -144,6 +148,7 @@ Não use o caractere `/`, para elementos que não tem tem tag de fechamento
144148
<img src="..." alt="..." />
145149
```
146150

151+
**[⬆ voltar ao topo](#summary)**
147152

148153
#### HTML Comments
149154

@@ -177,6 +182,8 @@ O ideal é que os comentários não estejam no ambiente de produção, sendo ape
177182
<div></div>
178183
```
179184

185+
**[⬆ voltar ao topo](#summary)**
186+
180187
#### HTML Character Encoding
181188

182189
Sempre use `UTF-8`
@@ -187,6 +194,8 @@ Sempre use `UTF-8`
187194
</head>
188195
```
189196

197+
**[⬆ voltar ao topo](#summary)**
198+
190199
#### HTML Attribute Order
191200

192201
A ordem de atributos facilita a leitura e organização
@@ -204,6 +213,8 @@ A ordem de atributos facilita a leitura e organização
204213
<img class="..." src="..." alt="...">
205214
```
206215

216+
**[⬆ voltar ao topo](#summary)**
217+
207218
#### HTML Performance
208219

209220
Se for necessário ter script externo dentro da tag `head`, sempre deve estar por último.
@@ -249,6 +260,8 @@ Eliminar espaços e comentários, sem dúvida trazem uma melhor performance e s
249260
</html>
250261
```
251262

263+
**[⬆ voltar ao topo](#summary)**
264+
252265
#### HTML Base Code
253266

254267
HTMl básico que uso para os projetos
@@ -311,6 +324,8 @@ Tags meta que mais uso.
311324
<link rel="canonical" href="Url">
312325
```
313326

327+
**[⬆ voltar ao topo](#summary)**
328+
314329
### CSS
315330

316331
#### CSS Syntax
@@ -436,6 +451,8 @@ Não especificar a unidade para valor `0`, exceto para a propriedade `rotate`.
436451
}
437452
```
438453

454+
**[⬆ voltar ao topo](#summary)**
455+
439456
#### CSS Comments
440457

441458
Os comentários sempre estarão antes do código a que se refere.
@@ -456,6 +473,8 @@ Os comentários sempre estarão antes do código a que se refere.
456473
========================================================================== */
457474
```
458475

476+
**[⬆ voltar ao topo](#summary)**
477+
459478
#### CSS Declaration Order
460479

461480
A declaração das propriedades, devem ser em ordem alfabética.
@@ -478,6 +497,8 @@ A declaração das propriedades, devem ser em ordem alfabética.
478497
}
479498
```
480499

500+
**[⬆ voltar ao topo](#summary)**
501+
481502
#### CSS Name
482503

483504
Use `camelCase` para nomes compostos
@@ -530,6 +551,8 @@ Escolha nomes que dão significado a função da mesma.
530551
.sb { ... }
531552
```
532553

554+
**[⬆ voltar ao topo](#summary)**
555+
533556
#### CSS Performance
534557

535558
Não use IDs
@@ -597,6 +620,8 @@ Eliminar espaços e comentários, no ambiente de produção.
597620
}
598621
```
599622

623+
**[⬆ voltar ao topo](#summary)**
624+
600625
#### CSS Media Queries
601626

602627
Sempre comece o desenvolvimento em `Mobile first`
@@ -649,6 +674,8 @@ Mantenha as regras para um seletor em dispositos móveis e demais dispositos, se
649674
}
650675
```
651676

677+
**[⬆ voltar ao topo](#summary)**
678+
652679
### Javascript
653680

654681
#### Javascript Syntax
@@ -754,8 +781,101 @@ if (foo == 'foo') {
754781
}
755782
```
756783

784+
**[⬆ voltar ao topo](#summary)**
785+
757786
#### Javascript Comments
758787

788+
Use `//` para comentário de uma linha
789+
790+
```javascript
791+
// Good
792+
// Description
793+
794+
// Bad
795+
/**
796+
* Description
797+
*/
798+
```
799+
800+
Use o comentário de uma linha acima do código referente.
801+
802+
```javascript
803+
// Good
804+
// set the default status to true
805+
const status = this._status || true;
806+
807+
// Bad
808+
const status = this._status || true; // set the default status to true
809+
```
810+
811+
Use `/** ... */` para blocos de comentários
812+
813+
```javascript
814+
// Good
815+
/**
816+
* Description
817+
* @param {String} Description of the param
818+
*/
819+
820+
// Bad
821+
//
822+
// Description
823+
//
824+
```
825+
826+
Pode ter comentários com prefixo de ação.
827+
828+
- FIXME - um problema que precisa ser revisto
829+
- TODO - sugestão de uma solução para o problema que precisa ser implementado
830+
831+
```javascript
832+
// FIXME: shouldn't use a global here
833+
total = 0;
834+
835+
// TODO: total should be configurable by an options param
836+
this.total = 0;
837+
```
838+
839+
Uma sugestão de sintaxe para escrever os comentários é o do [JSDuck](https://github.com/senchalabs/jsduck/wiki).
840+
841+
```javascript
842+
/**
843+
* @class Class name
844+
* @param {String} Description of the param
845+
* @extends name of the
846+
* Documentation for the class
847+
*/
848+
849+
/**
850+
* @event click
851+
* Documentation for the event
852+
* @param {String} Description of the param
853+
*/
854+
855+
/**
856+
* @method Method name
857+
* Documentation for the method
858+
* @param {String} Description of the param
859+
* @return {String} Description of the return
860+
*/
861+
862+
/**
863+
* @property {Boolean} [property=false]
864+
* Description
865+
*/
866+
867+
/**
868+
* @class Class name
869+
* Documentation for the class
870+
*
871+
* @constructor
872+
* Documentation for the constructor
873+
* @param {String} Description of the param
874+
*/
875+
```
876+
877+
**[⬆ voltar ao topo](#summary)**
878+
759879
#### Javascript Variables
760880

761881
#### Javascript Performance

0 commit comments

Comments
 (0)