BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
30e02628
Commit
30e02628
authored
Oct 09, 2017
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make naming imports more clear
parent
8af29c21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
style_guide_js.md
doc/development/fe_guide/style_guide_js.md
+26
-4
No files found.
doc/development/fe_guide/style_guide_js.md
View file @
30e02628
...
@@ -88,16 +88,31 @@ followed by any global declarations, then a blank newline prior to any imports o
...
@@ -88,16 +88,31 @@ followed by any global declarations, then a blank newline prior to any imports o
1.
Use ES module syntax to import modules
1.
Use ES module syntax to import modules
```javascript
```javascript
// bad
// bad
require('foo
');
const SomeClass = require('some_class
');
// good
// good
import
Foo from 'foo
';
import
SomeClass from 'some_class
';
// bad
// bad
module.exports =
Foo
;
module.exports =
SomeClass
;
// good
// good
export default Foo;
export default SomeClass;
```
Import statements are following usual naming guidelines, for example object literals use camel case:
```javascript
// some_object file
export default {
key: 'value',
};
// bad
import ObjectLiteral from 'some_object';
// good
import objectLiteral from 'some_object';
```
```
1.
Relative paths: when importing a module in the same directory, a child
1.
Relative paths: when importing a module in the same directory, a child
...
@@ -285,6 +300,13 @@ A forEach will cause side effects, it will be mutating the array being iterated.
...
@@ -285,6 +300,13 @@ A forEach will cause side effects, it will be mutating the array being iterated.
1.
**Extensions**
: Use
`.vue`
extension for Vue components.
1.
**Extensions**
: Use
`.vue`
extension for Vue components.
1.
**Reference Naming**
: Use camelCase for their instances:
1.
**Reference Naming**
: Use camelCase for their instances:
```javascript
```javascript
// bad
import CardBoard from 'cardBoard'
components: {
CardBoard:
};
// good
// good
import cardBoard from 'cardBoard'
import cardBoard from 'cardBoard'
...
...
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