Commit 028c6113 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Fix eslint offenses

parent 3b431cc0
/* eslint-disable func-names, space-before-function-paren, no-var, one-var, one-var-declaration-per-line, prefer-rest-params, max-len, vars-on-top, wrap-iife, no-unused-vars, quotes, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, comma-dangle, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func, no-mixed-operators */
/* eslint-disable func-names, no-underscore-dangle, space-before-function-paren, no-var, one-var, one-var-declaration-per-line, prefer-rest-params, max-len, vars-on-top, wrap-iife, no-unused-vars, quotes, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, comma-dangle, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func, no-mixed-operators */
/* global fuzzaldrinPlus */
import { isObject } from './lib/utils/type_utility';
......
......@@ -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?';
};
......
......@@ -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';
......
......@@ -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),
......
......@@ -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;
}
......
......@@ -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
......
......@@ -42,7 +42,9 @@ describe('RepoCommitSection', () => {
expect(changedFiles.length).toEqual(2);
changedFiles.forEach((changedFile, i) => {
expect(changedFile.textContent).toEqual(RepoHelper.getFilePathFromFullPath(openedFiles[i].url, branch));
const filePath = RepoHelper.getFilePathFromFullPath(openedFiles[i].url, branch);
expect(changedFile.textContent).toEqual(filePath);
});
expect(commitMessage.tagName).toEqual('TEXTAREA');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment