summaryrefslogtreecommitdiff
path: root/doc/development/fe_guide/style_guide_js.md
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2018-01-03 23:14:55 +0000
committerFilipa Lacerda <filipa@gitlab.com>2018-01-03 23:14:55 +0000
commitb299198e1eb5e1f26d5267f4a64944e600086d6b (patch)
tree441412c739e7dace4c2ba34099d19677d52e0314 /doc/development/fe_guide/style_guide_js.md
parentfb583c4b1839af16c50e27105a300695aa50bcad (diff)
downloadgitlab-ce-b299198e1eb5e1f26d5267f4a64944e600086d6b.tar.gz
Adds `eslint-plugin-vue`, fixes linter errors and adds docs
Diffstat (limited to 'doc/development/fe_guide/style_guide_js.md')
-rw-r--r--doc/development/fe_guide/style_guide_js.md14
1 files changed, 10 insertions, 4 deletions
diff --git a/doc/development/fe_guide/style_guide_js.md b/doc/development/fe_guide/style_guide_js.md
index 1cd66f27492..3c5d69e1f71 100644
--- a/doc/development/fe_guide/style_guide_js.md
+++ b/doc/development/fe_guide/style_guide_js.md
@@ -101,16 +101,16 @@ followed by any global declarations, then a blank newline prior to any imports o
```
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';
```
@@ -255,6 +255,10 @@ A forEach will cause side effects, it will be mutating the array being iterated.
### Vue.js
+#### `eslint-vue-plugin`
+We default to [eslint-vue-plugin][eslint-plugin-vue], with the `plugin:vue/recommended`.
+Please check this [rules][eslint-plugin-vue-rules] for more documentation.
+
#### Basic Rules
1. The service has it's own file
1. The store has it's own file
@@ -513,8 +517,8 @@ On those a default key should not be provided.
1. `props`
1. `mixins`
1. `directives`
- 1. `data`
1. `components`
+ 1. `data`
1. `computedProps`
1. `methods`
1. `beforeCreate`
@@ -582,3 +586,5 @@ The goal of this accord is to make sure we are all on the same page.
[eslintrc]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.eslintrc
[eslint-this]: http://eslint.org/docs/rules/class-methods-use-this
[eslint-new]: http://eslint.org/docs/rules/no-new
+[eslint-plugin-vue]: https://github.com/vuejs/eslint-plugin-vue
+[eslint-plugin-vue-rules]: https://github.com/vuejs/eslint-plugin-vue#bulb-rules