2017-03-22 15:30:54 -04:00
# Style guides and linting
See the relevant style guides for our guidelines and for information on linting:
## JavaScript
We defer to [Airbnb][airbnb-js-style-guide] on most style-related
conventions and enforce them with eslint.
See [our current .eslintrc][eslintrc] for specific rules and patterns.
### Common
#### ESlint
2017-08-04 09:45:14 -04:00
1. **Never** disable eslint rules unless you have a good reason.
2017-05-04 10:13:52 -04:00
You may see a lot of legacy files with `/* eslint-disable some-rule, some-other-rule */`
at the top, but legacy files are a special case. Any time you develop a new feature or
refactor an existing one, you should abide by the eslint rules.
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
1. **Never Ever EVER** disable eslint globally for a file
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
/* eslint-disable */
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// better
/* eslint-disable some-rule, some-other-rule */
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// best
// nothing :)
2017-03-22 15:30:54 -04:00
```
2017-05-04 09:53:00 -04:00
1. If you do need to disable a rule for a single violation, try to do it as locally as possible
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
/* eslint-disable no-new */
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
import Foo from 'foo';
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
new Foo();
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// better
import Foo from 'foo';
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// eslint-disable-next-line no-new
new Foo();
2017-03-22 15:30:54 -04:00
```
2017-05-04 09:53:00 -04:00
1. There are few rules that we need to disable due to technical debt. Which are:
1. [no-new][eslint-new]
1. [class-methods-use-this][eslint-this]
2017-03-22 15:30:54 -04:00
2017-05-04 10:13:52 -04:00
1. When they are needed _always_ place ESlint directive comment blocks on the first line of a script,
followed by any global declarations, then a blank newline prior to any imports or code.
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
/* global Foo */
/* eslint-disable no-new */
import Bar from './bar';
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
/* eslint-disable no-new */
/* global Foo */
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
import Bar from './bar';
2017-03-22 15:30:54 -04:00
```
2017-05-04 09:53:00 -04:00
1. **Never** disable the `no-undef` rule. Declare globals with `/* global Foo */` instead.
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
1. When declaring multiple globals, always use one `/* global [name] */` line per variable.
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
/* globals Flash, Cookies, jQuery */
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
/* global Flash */
/* global Cookies */
/* global jQuery */
2017-03-22 15:30:54 -04:00
```
2017-04-20 12:39:56 -04:00
2017-05-04 09:53:00 -04:00
1. Use up to 3 parameters for a function or class. If you need more accept an Object instead.
2017-04-20 12:39:56 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
fn(p1, p2, p3, p4) {}
2017-04-20 12:39:56 -04:00
2017-05-04 09:53:00 -04:00
// good
fn(options) {}
2017-04-20 12:39:56 -04:00
```
2017-03-22 15:30:54 -04:00
#### Modules, Imports, and Exports
2017-05-04 09:53:00 -04:00
1. Use ES module syntax to import modules
2017-12-11 15:05:39 -05:00
```javascript
// bad
const SomeClass = require('some_class');
2017-03-22 15:30:54 -04:00
2017-12-11 15:05:39 -05:00
// good
import SomeClass from 'some_class';
2017-03-22 15:30:54 -04:00
2017-12-11 15:05:39 -05:00
// bad
module.exports = SomeClass;
2017-03-22 15:30:54 -04:00
2017-12-11 15:05:39 -05:00
// good
export default SomeClass;
```
Import statements are following usual naming guidelines, for example object literals use camel case:
2018-01-03 18:14:55 -05:00
2017-12-11 15:05:39 -05:00
```javascript
// some_object file
export default {
key: 'value',
};
2018-01-03 18:14:55 -05:00
2017-12-11 15:05:39 -05:00
// bad
import ObjectLiteral from 'some_object';
2018-01-03 18:14:55 -05:00
2017-12-11 15:05:39 -05:00
// good
import objectLiteral from 'some_object';
```
2017-03-22 15:30:54 -04:00
2017-08-04 09:45:14 -04:00
1. Relative paths: when importing a module in the same directory, a child
directory, or an immediate parent directory prefer relative paths. When
2017-08-29 17:55:35 -04:00
importing a module which is two or more levels up, prefer either `~/` or `ee/` .
2017-03-22 15:30:54 -04:00
2017-08-29 17:55:35 -04:00
In **app/assets/javascripts/my-feature/subdir** :
2017-03-22 15:30:54 -04:00
2017-08-29 17:55:35 -04:00
```javascript
// bad
import Foo from '~/my-feature/foo';
import Bar from '~/my-feature/subdir/bar';
import Bin from '~/my-feature/subdir/lib/bin';
2017-03-22 15:30:54 -04:00
2017-08-29 17:55:35 -04:00
// good
import Foo from '../foo';
import Bar from './bar';
import Bin from './lib/bin';
```
2017-03-22 15:30:54 -04:00
2017-08-29 17:55:35 -04:00
In **spec/javascripts** :
2017-08-04 09:45:14 -04:00
2017-08-29 17:55:35 -04:00
```javascript
// bad
import Foo from '../../app/assets/javascripts/my-feature/foo';
2017-08-04 09:45:14 -04:00
2017-08-29 17:55:35 -04:00
// good
import Foo from '~/my-feature/foo';
```
2017-08-04 09:45:14 -04:00
2017-08-29 17:55:35 -04:00
When referencing an **EE component** :
2017-08-04 09:45:14 -04:00
2017-08-29 17:55:35 -04:00
```javascript
// bad
import Foo from '../../../../../ee/app/assets/javascripts/my-feature/ee-foo';
2017-08-04 09:45:14 -04:00
2017-08-29 17:55:35 -04:00
// good
import Foo from 'ee/my-feature/foo';
```
2017-03-22 15:30:54 -04:00
2017-05-04 10:13:52 -04:00
1. Avoid using IIFE. Although we have a lot of examples of files which wrap their
contents in IIFEs (immediately-invoked function expressions),
this is no longer necessary after the transition from Sprockets to webpack.
Do not use them anymore and feel free to remove them when refactoring legacy code.
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
1. Avoid adding to the global namespace.
2017-08-29 17:55:35 -04:00
```javascript
// bad
window.MyClass = class { /* ... */ };
2017-03-22 15:30:54 -04:00
2017-08-29 17:55:35 -04:00
// good
export default class MyClass { /* ... */ }
```
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
1. Side effects are forbidden in any script which contains exports
2017-08-29 17:55:35 -04:00
```javascript
// bad
export default class MyClass { /* ... */ }
2017-03-22 15:30:54 -04:00
2017-08-29 17:55:35 -04:00
document.addEventListener("DOMContentLoaded", function(event) {
new MyClass();
}
```
2017-03-22 15:30:54 -04:00
#### Data Mutation and Pure functions
2017-05-04 09:53:00 -04:00
1. Strive to write many small pure functions, and minimize where mutations occur.
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
const values = {foo: 1};
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
function impureFunction(items) {
const bar = 1;
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
items.foo = items.a * bar + 2;
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
return items.a;
}
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
const c = impureFunction(values);
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
var values = {foo: 1};
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
function pureFunction (foo) {
var bar = 1;
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
foo = foo * bar + 2;
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
return foo;
}
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
var c = pureFunction(values.foo);
2017-03-22 15:30:54 -04:00
```
2018-02-09 05:53:07 -05:00
1. Avoid constructors with side-effects.
Although we aim for code without side-effects we need some side-effects for our code to run.
2018-02-09 07:01:05 -05:00
If the class won't do anything if we only instantiate it, it's ok to add side effects into the constructor (_Note:_ The following is just an example. If the only purpose of the class is to add an event listener and handle the callback a function will be more suitable.)
2018-02-09 05:53:07 -05:00
```javascript
// Bad
export class Foo {
constructor() {
this.init();
}
init() {
document.addEventListener('click', this.handleCallback)
},
handleCallback() {
}
}
// Good
export class Foo {
constructor() {
document.addEventListener()
}
handleCallback() {
}
}
```
2018-04-27 04:50:05 -04:00
On the other hand, if a class only needs to extend a third party/add event listeners in some specific cases, they should be initialized outside of the constructor.
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
1. Prefer `.map` , `.reduce` or `.filter` over `.forEach`
2018-02-09 05:53:07 -05:00
A forEach will most likely cause side effects, it will be mutating the array being iterated. Prefer using `.map` ,
2017-04-20 11:52:00 -04:00
`.reduce` or `.filter`
```javascript
2017-05-04 09:53:00 -04:00
const users = [ { name: 'Foo' }, { name: 'Bar' } ];
2017-04-20 11:52:00 -04:00
2017-05-04 09:53:00 -04:00
// bad
users.forEach((user, index) => {
user.id = index;
});
2017-04-20 11:52:00 -04:00
2017-05-04 09:53:00 -04:00
// good
const usersWithId = users.map((user, index) => {
return Object.assign({}, user, { id: index });
});
2017-04-20 11:52:00 -04:00
```
2017-03-22 15:30:54 -04:00
#### Parse Strings into Numbers
2017-05-04 09:53:00 -04:00
1. `parseInt()` is preferable over `Number()` or `+`
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
+'10' // 10
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
Number('10') // 10
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// better
parseInt('10', 10);
2017-03-22 15:30:54 -04:00
```
2017-04-20 07:24:40 -04:00
#### CSS classes used for JavaScript
2017-05-04 09:53:00 -04:00
1. If the class is being used in Javascript it needs to be prepend with `js-`
2017-04-20 07:24:40 -04:00
```html
// bad
< button class = "add-user" >
Add User
< / button >
// good
< button class = "js-add-user" >
Add User
< / button >
```
2017-03-22 15:30:54 -04:00
### Vue.js
2018-01-03 18:14:55 -05:00
#### `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.
2017-03-22 15:30:54 -04:00
#### Basic Rules
2017-05-04 10:13:52 -04:00
1. The service has it's own file
1. The store has it's own file
1. Use a function in the bundle file to instantiate the Vue component:
```javascript
// bad
class {
init() {
new Component({})
}
}
// good
document.addEventListener('DOMContentLoaded', () => new Vue({
el: '#element',
components: {
componentName
},
render: createElement => createElement('component-name'),
}));
```
1. Don not use a singleton for the service or the store
```javascript
// bad
class Store {
constructor() {
if (!this.prototype.singleton) {
// do something
}
}
}
// good
class Store {
constructor() {
// do something
}
}
```
2017-03-22 15:30:54 -04:00
#### Naming
2017-05-04 09:53:00 -04:00
1. **Extensions** : Use `.vue` extension for Vue components.
2018-02-08 14:06:18 -05:00
1. **Reference Naming** : Use PascalCase for their instances:
2017-03-22 15:30:54 -04:00
```javascript
2017-10-09 06:42:20 -04:00
// bad
2018-02-08 14:06:18 -05:00
import cardBoard from 'cardBoard.vue'
2017-10-09 06:42:20 -04:00
components: {
2018-02-08 14:06:18 -05:00
cardBoard,
2017-10-09 06:42:20 -04:00
};
2017-05-04 09:53:00 -04:00
// good
2018-02-08 14:06:18 -05:00
import CardBoard from 'cardBoard.vue'
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
components: {
2018-02-08 14:06:18 -05:00
CardBoard,
2017-05-04 09:53:00 -04:00
};
2017-03-22 15:30:54 -04:00
```
2017-04-20 07:24:40 -04:00
2017-05-04 10:13:52 -04:00
1. **Props Naming:** Avoid using DOM component prop names.
1. **Props Naming:** Use kebab-case instead of camelCase to provide props in templates.
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
< component class = "btn" >
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
< component css-class = "btn" >
2017-03-27 18:36:58 -04:00
2017-05-04 09:53:00 -04:00
// bad
< component myProp = "prop" / >
2017-03-27 18:36:58 -04:00
2017-05-04 09:53:00 -04:00
// good
< component my-prop = "prop" / >
```
2017-03-22 15:30:54 -04:00
#### Alignment
2017-05-04 09:53:00 -04:00
1. Follow these alignment styles for the template method:
2017-09-08 08:10:11 -04:00
1. With more than one attribute, all attributes should be on a new line:
2017-12-11 15:05:39 -05:00
```javascript
// bad
< component v-if = "bar"
param="baz" />
2017-03-22 15:30:54 -04:00
2017-12-11 15:05:39 -05:00
< button class = "btn" > Click me< / button >
2017-04-20 07:24:40 -04:00
2017-12-11 15:05:39 -05:00
// good
< component
v-if="bar"
param="baz"
/>
2017-03-22 15:30:54 -04:00
2017-12-11 15:05:39 -05:00
< button class = "btn" >
Click me
< / button >
```
2017-09-08 08:10:11 -04:00
1. The tag can be inline if there is only one attribute:
2017-12-11 15:05:39 -05:00
```javascript
// good
< component bar = "bar" / >
2017-04-20 07:24:40 -04:00
2017-12-11 15:05:39 -05:00
// good
< component
bar="bar"
/>
2018-01-09 06:58:34 -05:00
// bad
< component
bar="bar" />
2017-12-11 15:05:39 -05:00
```
2017-03-22 15:30:54 -04:00
#### Quotes
2017-05-04 09:53:00 -04:00
1. Always use double quotes `"` inside templates and single quotes `'` for all other JS.
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
template: `
< button :class = 'style' > Button< / button >
`
// good
template: `
< button :class = "style" > Button< / button >
`
2017-03-22 15:30:54 -04:00
```
#### Props
2017-05-04 09:53:00 -04:00
1. Props should be declared as an object
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
props: ['foo']
// good
props: {
foo: {
type: String,
required: false,
default: 'bar'
}
2017-03-22 15:30:54 -04:00
}
```
2017-05-04 09:53:00 -04:00
1. Required key should always be provided when declaring a prop
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
props: {
foo: {
type: String,
}
2017-03-22 15:30:54 -04:00
}
2017-05-04 09:53:00 -04:00
// good
props: {
foo: {
type: String,
required: false,
default: 'bar'
}
2017-03-22 15:30:54 -04:00
}
```
2017-09-08 08:10:11 -04:00
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.
2017-03-22 15:30:54 -04:00
```javascript
2017-09-08 08:10:11 -04:00
// good
2017-05-04 09:53:00 -04:00
props: {
foo: {
type: String,
required: false,
}
2017-03-22 15:30:54 -04:00
}
2017-05-04 09:53:00 -04:00
// good
props: {
foo: {
type: String,
required: false,
default: 'bar'
}
2017-03-22 15:30:54 -04:00
}
2017-05-04 09:53:00 -04:00
// good
props: {
foo: {
type: String,
required: true
}
2017-03-22 15:30:54 -04:00
}
```
#### Data
2017-05-04 09:53:00 -04:00
1. `data` method should always be a function
2017-03-22 15:30:54 -04:00
2017-08-29 17:55:35 -04:00
```javascript
// bad
data: {
2017-05-04 09:53:00 -04:00
foo: 'foo'
2017-08-29 17:55:35 -04:00
}
// good
data() {
return {
foo: 'foo'
};
}
```
2017-03-22 15:30:54 -04:00
#### Directives
2017-05-04 09:53:00 -04:00
1. Shorthand `@` is preferable over `v-on`
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
< component v-on:click = "eventHandler" / >
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
< component @click =" eventHandler " />
2017-03-22 15:30:54 -04:00
```
2017-05-04 09:53:00 -04:00
1. Shorthand `:` is preferable over `v-bind`
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
< component v-bind:class = "btn" / >
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
< component :class = "btn" / >
2017-03-22 15:30:54 -04:00
```
#### Closing tags
2017-05-04 09:53:00 -04:00
1. Prefer self closing component tags
2017-03-22 15:30:54 -04:00
```javascript
2017-05-04 09:53:00 -04:00
// bad
< component > < / component >
2017-03-22 15:30:54 -04:00
2017-05-04 09:53:00 -04:00
// good
< component / >
2017-03-22 15:30:54 -04:00
```
#### Ordering
2017-10-03 20:07:41 -04:00
1. Tag order in `.vue` file
2017-12-11 15:05:39 -05:00
```
< script >
// ...
< / script >
< template >
// ...
< / template >
// We don't use scoped styles but there are few instances of this
< style >
// ...
< / style >
```
2017-10-03 20:07:41 -04:00
1. Properties in a Vue Component:
2018-01-09 06:58:34 -05:00
Check [order of properties in components rule][vue-order].
2017-10-03 20:07:41 -04:00
2018-02-27 13:51:54 -05:00
#### `:key`
When using `v-for` you need to provide a *unique* `:key` attribute for each item.
2018-02-27 16:28:57 -05:00
1. If the elements of the array being iterated have an unique `id` it is advised to use it:
2018-02-27 13:51:54 -05:00
```html
2018-02-27 16:28:57 -05:00
< div
v-for="item in items"
:key="item.id"
>
2018-02-27 13:51:54 -05:00
<!-- content -->
< / div >
```
1. When the elements being iterated don't have a unique id, you can use the array index as the `:key` attribute
```html
2018-02-27 16:28:57 -05:00
< div
v-for="(item, index) in items"
:key="index"
>
2018-02-27 13:51:54 -05:00
<!-- content -->
< / div >
```
2018-02-27 16:28:57 -05:00
1. When using `v-for` with `template` and there is more than one child element, the `:key` values must be unique. It's advised to use `kebab-case` namespaces.
2018-02-27 13:51:54 -05:00
```html
< template v-for = "(item, index) in items" >
< span :key = "`span-${index}`" > < / span >
< button :key = "`button-${index}`" > < / button >
< / template >
```
2018-02-28 13:28:31 -05:00
1. When dealing with nested `v-for` use the same guidelines as above.
```html
< div
v-for="item in items"
:key="item.id"
>
< span
v-for="element in array"
:key="element.id"
>
<!-- content -->
< / span >
< / div >
```
2018-02-27 13:51:54 -05:00
Useful links:
1. [`key` ](https://vuejs.org/v2/guide/list.html#key )
1. [Vue Style Guide: Keyed v-for ](https://vuejs.org/v2/style-guide/#Keyed-v-for-essential )
2017-08-29 17:55:35 -04:00
#### Vue and Bootstrap
2017-06-06 16:46:31 -04:00
1. Tooltips: Do not rely on `has-tooltip` class name for Vue components
2017-08-04 09:45:14 -04:00
```javascript
2017-05-04 10:13:52 -04:00
// bad
2017-06-06 16:46:31 -04:00
< span
class="has-tooltip"
title="Some tooltip text">
2017-05-04 10:13:52 -04:00
Text
< / span >
// good
2017-06-06 16:46:31 -04:00
< span
v-tooltip
title="Some tooltip text">
2017-05-04 10:13:52 -04:00
Text
< / span >
```
2017-06-06 16:46:31 -04:00
1. Tooltips: When using a tooltip, include the tooltip directive, `./app/assets/javascripts/vue_shared/directives/tooltip.js`
2017-05-04 10:13:52 -04:00
1. Don't change `data-original-title` .
2017-05-04 12:56:46 -04:00
```javascript
// bad
< span data-original-title = "tooltip text" > Foo< / span >
// good
< span title = "tooltip text" > Foo< / span >
$('span').tooltip('fixTitle');
```
2017-08-29 17:55:35 -04:00
2017-08-14 21:42:43 -04:00
### The Javascript/Vue Accord
2017-09-08 08:10:11 -04:00
The goal of this accord is to make sure we are all on the same page.
2017-05-04 12:56:46 -04:00
2017-09-08 08:10:11 -04:00
1. When writing Vue, you may not use jQuery in your application.
2017-08-29 17:55:35 -04:00
1. If you need to grab data from the DOM, you may query the DOM 1 time while bootstrapping your application to grab data attributes using `dataset` . You can do this without jQuery.
2017-09-08 08:10:11 -04:00
1. You may use a jQuery dependency in Vue.js following [this example from the docs ](https://vuejs.org/v2/examples/select2.html ).
2017-08-29 17:55:35 -04:00
1. If an outside jQuery Event needs to be listen to inside the Vue application, you may use jQuery event listeners.
1. We will avoid adding new jQuery events when they are not required. Instead of adding new jQuery events take a look at [different methods to do the same task ](https://vuejs.org/v2/api/#vm-emit ).
2017-08-14 21:42:43 -04:00
1. You may query the `window` object 1 time, while bootstrapping your application for application specific data (e.g. `scrollTo` is ok to access anytime). Do this access during the bootstrapping of your application.
1. You may have a temporary but immediate need to create technical debt by writing code that does not follow our standards, to be refactored later. Maintainers need to be ok with the tech debt in the first place. An issue should be created for that tech debt to evaluate it further and discuss. In the coming months you should fix that tech debt, with it's priority to be determined by maintainers.
1. When creating tech debt you must write the tests for that code before hand and those tests may not be rewritten. e.g. jQuery tests rewritten to Vue tests.
1. You may choose to use VueX as a centralized state management. If you choose not to use VueX, you must use the *store pattern* which can be found in the [Vue.js documentation ](https://vuejs.org/v2/guide/state-management.html#Simple-State-Management-from-Scratch ).
1. Once you have chosen a centralized state management solution you must use it for your entire application. i.e. Don't mix and match your state management solutions.
2017-03-22 15:30:54 -04:00
## SCSS
- [SCSS ](style_guide_scss.md )
[airbnb-js-style-guide]: https://github.com/airbnb/javascript
[eslintrc]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/.eslintrc
2017-05-04 09:53:00 -04:00
[eslint-this]: http://eslint.org/docs/rules/class-methods-use-this
[eslint-new]: http://eslint.org/docs/rules/no-new
2018-01-03 18:14:55 -05:00
[eslint-plugin-vue]: https://github.com/vuejs/eslint-plugin-vue
[eslint-plugin-vue-rules]: https://github.com/vuejs/eslint-plugin-vue#bulb-rules
2018-01-09 06:58:34 -05:00
[vue-order]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/order-in-components.md