Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
70cc9861
Commit
70cc9861
authored
Sep 08, 2017
by
Filipa Lacerda
Committed by
Phil Hughes
Sep 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds a better explanation for alignment section
parent
39a93e0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
doc/development/fe_guide/style_guide_js.md
doc/development/fe_guide/style_guide_js.md
+18
-7
No files found.
doc/development/fe_guide/style_guide_js.md
View file @
70cc9861
...
@@ -311,6 +311,7 @@ A forEach will cause side effects, it will be mutating the array being iterated.
...
@@ -311,6 +311,7 @@ A forEach will cause side effects, it will be mutating the array being iterated.
#### Alignment
#### Alignment
1.
Follow these alignment styles for the template method:
1.
Follow these alignment styles for the template method:
1.
With more than one attribute, all attributes should be on a new line:
```
javascript
```
javascript
// bad
// bad
<
component
v
-
if
=
"
bar
"
<
component
v
-
if
=
"
bar
"
...
@@ -327,9 +328,16 @@ A forEach will cause side effects, it will be mutating the array being iterated.
...
@@ -327,9 +328,16 @@ A forEach will cause side effects, it will be mutating the array being iterated.
<
button
class
=
"
btn
"
>
<
button
class
=
"
btn
"
>
Click
me
Click
me
<
/button>
<
/button>
```
// if props fit in one line then keep it on the same line
1.
The tag can be inline if there is only one attribute:
```
javascript
// good
<
component
bar
=
"
bar
"
/>
<
component
bar
=
"
bar
"
/>
// good
<
component
bar
=
"
bar
"
/>
```
```
#### Quotes
#### Quotes
...
@@ -381,9 +389,12 @@ A forEach will cause side effects, it will be mutating the array being iterated.
...
@@ -381,9 +389,12 @@ A forEach will cause side effects, it will be mutating the array being iterated.
}
}
```
```
1.
Default key should always be provided if the prop is not required:
1.
Default key should be provided if the prop is not required.
_Note:_
There are some scenarios where we need to check for the existence of the property.
On those a default key should not be provided.
```
javascript
```
javascript
//
ba
d
//
goo
d
props
:
{
props
:
{
foo
:
{
foo
:
{
type
:
String
,
type
:
String
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment