summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repo
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-08-01 16:34:50 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-08-01 16:34:50 +0100
commit028c61130d8da2f2f9c20103fe91faa42c116b6d (patch)
tree0b2ca8ee88ad37ae8f7e6331312401a27dddb640 /app/assets/javascripts/repo
parent3b431cc08ce494ad03569eeec9aaa1d24b9509d7 (diff)
downloadgitlab-ce-028c61130d8da2f2f9c20103fe91faa42c116b6d.tar.gz
Fix eslint offenses
Diffstat (limited to 'app/assets/javascripts/repo')
-rw-r--r--app/assets/javascripts/repo/index.js10
-rw-r--r--app/assets/javascripts/repo/repo_binary_viewer.vue2
-rw-r--r--app/assets/javascripts/repo/repo_commit_section.vue1
-rw-r--r--app/assets/javascripts/repo/repo_editor.vue7
-rw-r--r--app/assets/javascripts/repo/repo_store.js7
5 files changed, 13 insertions, 14 deletions
diff --git a/app/assets/javascripts/repo/index.js b/app/assets/javascripts/repo/index.js
index 6b6fb4eeec1..6fb342e94d6 100644
--- a/app/assets/javascripts/repo/index.js
+++ b/app/assets/javascripts/repo/index.js
@@ -37,14 +37,12 @@ function addEventsForNonVueEls() {
Store.targetBranch = $('.project-refs-target-form input[name="ref"]').val();
});
- window.onbeforeunload = function (e) {
+ window.onbeforeunload = function confirmUnload(e) {
const hasChanged = Store.openedFiles
.some(file => file.changed);
- if (!hasChanged) return;
- e = e || window.event;
- if (e) {
- e.returnValue = 'Are you sure you want to lose unsaved changes?';
- }
+ if (!hasChanged) return undefined;
+ const event = e || window.event;
+ if (event) event.returnValue = 'Are you sure you want to lose unsaved changes?';
// For Safari
return 'Are you sure you want to lose unsaved changes?';
};
diff --git a/app/assets/javascripts/repo/repo_binary_viewer.vue b/app/assets/javascripts/repo/repo_binary_viewer.vue
index 49f8896fa5b..cc26b49e794 100644
--- a/app/assets/javascripts/repo/repo_binary_viewer.vue
+++ b/app/assets/javascripts/repo/repo_binary_viewer.vue
@@ -31,7 +31,7 @@ const RepoBinaryViewer = {
},
getBinaryType() {
- if (this.binaryTypes.hasOwnProperty(this.activeFile.extension)) {
+ if (Object.hasOwnProperty.call(this.binaryTypes, this.activeFile.extension)) {
return this.activeFile.extension;
}
return 'unknown';
diff --git a/app/assets/javascripts/repo/repo_commit_section.vue b/app/assets/javascripts/repo/repo_commit_section.vue
index 68a51680b76..e8681e21c92 100644
--- a/app/assets/javascripts/repo/repo_commit_section.vue
+++ b/app/assets/javascripts/repo/repo_commit_section.vue
@@ -27,7 +27,6 @@ const RepoCommitSection = {
const branch = Helper.getBranch();
const commitMessage = this.commitMessage;
const actions = this.changedFiles.map((f) => {
- const filePath = Helper.getFilePathFromFullPath(f.url, branch);
return {
action: 'update',
file_path: Helper.getFilePathFromFullPath(f.url, branch),
diff --git a/app/assets/javascripts/repo/repo_editor.vue b/app/assets/javascripts/repo/repo_editor.vue
index 1692d2a6427..1c6bce7c6ce 100644
--- a/app/assets/javascripts/repo/repo_editor.vue
+++ b/app/assets/javascripts/repo/repo_editor.vue
@@ -89,13 +89,16 @@ const RepoEditor = {
dialog: {
handler(obj) {
if (obj.status) {
- obj.status = false;
- this.openedFiles.map((f) => {
+ obj.status = false; // eslint-disable-line no-param-reassign
+ this.openedFiles.map((file) => {
+ const f = file;
if (f.active) {
this.blobRaw = f.plain;
}
f.changed = false;
delete f.newContent;
+
+ return f;
});
this.editMode = false;
}
diff --git a/app/assets/javascripts/repo/repo_store.js b/app/assets/javascripts/repo/repo_store.js
index a0c28d0205a..ee47c4be5ad 100644
--- a/app/assets/javascripts/repo/repo_store.js
+++ b/app/assets/javascripts/repo/repo_store.js
@@ -59,10 +59,9 @@ const RepoStore = {
readOnly: true,
resetBinaryTypes() {
- let s = '';
- for (s in RepoStore.binaryTypes) {
- RepoStore.binaryTypes[s] = false;
- }
+ Object.keys(RepoStore.binaryTypes).forEach((key) => {
+ RepoStore.binaryTypes[key] = false;
+ });
},
// mutations