You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Strive to write many small pure functions, and minimize where mutations occur.
@@ -414,19 +412,19 @@ A forEach will cause side effects, it will be mutating the array being iterated.
414
412
#### Data
415
413
1.`data` method should always be a function
416
414
417
-
```javascript
418
-
// bad
419
-
data: {
420
-
foo: 'foo'
421
-
}
422
-
423
-
// good
424
-
data() {
425
-
return {
415
+
```javascript
416
+
// bad
417
+
data: {
426
418
foo:'foo'
427
-
};
428
-
}
429
-
```
419
+
}
420
+
421
+
// good
422
+
data() {
423
+
return {
424
+
foo:'foo'
425
+
};
426
+
}
427
+
```
430
428
431
429
#### Directives
432
430
@@ -481,7 +479,8 @@ A forEach will cause side effects, it will be mutating the array being iterated.
481
479
1.`beforeDestroy`
482
480
1.`destroyed`
483
481
484
-
#### Vue and Boostrap
482
+
#### Vue and Bootstrap
483
+
485
484
1. Tooltips: Do not rely on `has-tooltip`classnamefor Vue components
486
485
```javascript
487
486
// bad
@@ -511,23 +510,19 @@ A forEach will cause side effects, it will be mutating the array being iterated.
511
510
512
511
$('span').tooltip('fixTitle');
513
512
```
513
+
514
514
### The Javascript/Vue Accord
515
515
The goal of this accord is to make sure we are all on the same page.
516
516
517
517
1. When writing Vue, you may not use jQuery in your application.
518
-
1.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.
519
-
1.2 You may use a jQuery dependency in Vue.js following [this example from the docs](https://vuejs.org/v2/examples/select2.html).
520
-
1.3 If an outside jQuery Event needs to be listen to inside the Vue application, you may use jQuery event listeners.
521
-
1.4 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).
522
-
518
+
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.
519
+
1. You may use a jQuery dependency in Vue.js following [this example from the docs](https://vuejs.org/v2/examples/select2.html).
520
+
1. If an outside jQuery Event needs to be listen to inside the Vue application, you may use jQuery event listeners.
521
+
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).
523
522
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.
524
-
525
523
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.
526
-
527
524
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.
528
-
529
525
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).
530
-
531
526
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.
0 commit comments