2
2
title : Guide de style
3
3
---
4
4
5
- import Tabs from " @theme/Tabs" ;
6
- import TabItem from " @theme/TabItem" ;
5
+ import Tabs from ' @theme/Tabs' ;
6
+ import TabItem from ' @theme/TabItem' ;
7
7
8
8
## Comment est-ce qu'on écrit une fonction (arrow function vs function declaration)
9
9
@@ -116,8 +116,8 @@ setTimeout(doSomething, TIMEOUT_DELAY);
116
116
```
117
117
118
118
``` jsx
119
- const EVENT_DATE_BY_LIST = " list" ;
120
- const EVENT_DATE_BY_DATE = " date" ;
119
+ const EVENT_DATE_BY_LIST = ' list' ;
120
+ const EVENT_DATE_BY_DATE = ' date' ;
121
121
// ...
122
122
const [selectedTab , setSelectedTab ] = useState (EVENT_DATE_BY_LIST );
123
123
```
@@ -126,9 +126,9 @@ Dans le cas où plusieurs constantes sont utilisées à plusieurs endroits, on p
126
126
127
127
``` tsx
128
128
export enum MODULE_TYPE {
129
- INFORMATION = " information" ,
130
- RECOMMENDATION = " recommendation" ,
131
- PROMOTE = " promote" ,
129
+ INFORMATION = ' information' ,
130
+ RECOMMENDATION = ' recommendation' ,
131
+ PROMOTE = ' promote' ,
132
132
}
133
133
134
134
function generateModule(moduleType : MODULE_TYPE ) {
@@ -156,10 +156,10 @@ Afin de gagner en lisibilité dans la lecture du code, on DOIT ajouter une ligne
156
156
function Foo () {
157
157
const { t } = useTranslation ();
158
158
const [loading , setLoading ] = useState (true );
159
- let name = " JD " ;
159
+ let name = ' JD ' ;
160
160
161
161
if (! loading) {
162
- name = " Chris" ;
162
+ name = ' Chris' ;
163
163
}
164
164
165
165
useEffect (() => {
@@ -172,7 +172,7 @@ function Foo() {
172
172
return < MpdLoader / > ;
173
173
}
174
174
175
- return < div> {t (" hello" , { name })}< / div> ;
175
+ return < div> {t (' hello' , { name })}< / div> ;
176
176
}
177
177
```
178
178
@@ -224,14 +224,14 @@ On **NE DEVRAIT PAS** avoir le nom de l'extension dans les imports
224
224
<TabItem value = " bad" >
225
225
226
226
``` tsx
227
- import Component from " ./components.jsx" ;
227
+ import Component from ' ./components.jsx' ;
228
228
```
229
229
230
230
</TabItem >
231
231
<TabItem value = " good" >
232
232
233
233
``` tsx
234
- import Component from " ./components" ;
234
+ import Component from ' ./components' ;
235
235
```
236
236
237
237
</TabItem >
@@ -251,7 +251,7 @@ On **DEVRAIT** privilégier les [variables makeup](https://makeup.mapado.net/?pa
251
251
<TabItem value = " bad" >
252
252
253
253
``` tsx
254
- const styled = " styled-components" ;
254
+ const styled = ' styled-components' ;
255
255
256
256
// ...
257
257
@@ -264,8 +264,8 @@ const Container = styled.div`
264
264
<TabItem value = " good" >
265
265
266
266
``` tsx
267
- const styled = " styled-components" ;
268
- import { $marginSmall } from " @mapado/makeup/build/variables" ;
267
+ const styled = ' styled-components' ;
268
+ import { $marginSmall } from ' @mapado/makeup/build/variables' ;
269
269
270
270
// ...
271
271
0 commit comments