returnsprintf(s__('mrWidget| Please restore it or use a different %{missingBranchName} branch'),{
missingBranchName:this.missingBranchName,
});
},
message(){
returnsprintf(s__('mrWidget|If the %{missingBranchName} branch exists in your local repository, you can merge this merge request manually using the command line'),{
@@ -207,10 +207,39 @@ Do not use them anymore and feel free to remove them when refactoring legacy cod
...
@@ -207,10 +207,39 @@ Do not use them anymore and feel free to remove them when refactoring legacy cod
varc=pureFunction(values.foo);
varc=pureFunction(values.foo);
```
```
1. Avoid constructors with side-effects
1. Avoid constructors with side-effects.
Although we aim for code without side-effects we need some side-effects for our code to run.
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.)
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 oustside of the constructor.
1. Prefer `.map`, `.reduce` or `.filter` over `.forEach`
1. Prefer `.map`, `.reduce` or `.filter` over `.forEach`
A forEach will cause side effects, it will be mutating the array being iterated. Prefer using `.map`,
A forEach will most likely cause side effects, it will be mutating the array being iterated. Prefer using `.map`,
`.reduce` or `.filter`
`.reduce` or `.filter`
```javascript
```javascript
constusers=[{name:'Foo'},{name:'Bar'}];
constusers=[{name:'Foo'},{name:'Bar'}];
...
@@ -302,20 +331,20 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation.
...
@@ -302,20 +331,20 @@ Please check this [rules][eslint-plugin-vue-rules] for more documentation.
#### Naming
#### Naming
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 PascalCase for their instances: