summaryrefslogtreecommitdiff
path: root/doc/development
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-01-10 14:35:34 +0000
committerPhil Hughes <me@iamphill.com>2018-01-10 14:35:34 +0000
commit249b5015d79b0395f9fcfe696be8824e5b4c6ac9 (patch)
treec7d2410a253bae52939f93a5cb8c02a067c52199 /doc/development
parent16e2e4c75187979db73f4770270c37837a371c64 (diff)
parent3dfc91cf732369aab182629db0299153814d2068 (diff)
downloadgitlab-ce-249b5015d79b0395f9fcfe696be8824e5b4c6ac9.tar.gz
Merge branch '34312-eslint-vue-plugin' into 'master'
Resolve "Add eslint-vue-plugin to our stack" Closes #34312 See merge request gitlab-org/gitlab-ce!16210
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/fe_guide/style_guide_js.md37
1 files changed, 15 insertions, 22 deletions
diff --git a/doc/development/fe_guide/style_guide_js.md b/doc/development/fe_guide/style_guide_js.md
index 1cd66f27492..02773162801 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
@@ -360,6 +364,10 @@ A forEach will cause side effects, it will be mutating the array being iterated.
<component
bar="bar"
/>
+
+ // bad
+ <component
+ bar="bar" />
```
#### Quotes
@@ -509,25 +517,7 @@ On those a default key should not be provided.
```
1. Properties in a Vue Component:
- 1. `name`
- 1. `props`
- 1. `mixins`
- 1. `directives`
- 1. `data`
- 1. `components`
- 1. `computedProps`
- 1. `methods`
- 1. `beforeCreate`
- 1. `created`
- 1. `beforeMount`
- 1. `mounted`
- 1. `beforeUpdate`
- 1. `updated`
- 1. `activated`
- 1. `deactivated`
- 1. `beforeDestroy`
- 1. `destroyed`
-
+ Check [order of properties in components rule][vue-order].
#### Vue and Bootstrap
@@ -582,3 +572,6 @@ 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
+[vue-order]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/order-in-components.md