From d790c27a19494346bc7293bee00026201f2910f0 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 6 Nov 2017 09:57:59 +0100 Subject: [PATCH] Reduce JSHint errors/warnings Signed-off-by: Morris Jobke --- .jshintrc | 5 ++++- core/js/js.js | 2 +- core/js/tests/specs/coreSpec.js | 4 ++-- core/js/tests/specs/files/clientSpec.js | 2 +- core/js/tests/specs/jquery.avatarSpec.js | 4 ++-- core/js/tests/specs/mimeTypeSpec.js | 10 +++++----- core/js/tests/specs/sharedialoglinkshareview.js | 1 - core/js/tests/specs/sharedialogshareelistview.js | 1 - core/js/tests/specs/sharedialogviewSpec.js | 1 - 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.jshintrc b/.jshintrc index 0b055afde3..19ce060629 100644 --- a/.jshintrc +++ b/.jshintrc @@ -28,7 +28,10 @@ "_": true, "OC": true, "OCA": true, + "OCP": true, "t": true, - "n": true + "n": true, + "escapeHTML": true, + "Promise": true } } diff --git a/core/js/js.js b/core/js/js.js index c02ef5c792..1f84b40a35 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1512,7 +1512,7 @@ function initCore() { var resizeMenu = function() { var appList = $('#appmenu li'); - var headerWidth = $('.header-left').width() - $('#nextcloud').width() + var headerWidth = $('.header-left').width() - $('#nextcloud').width(); var usePercentualAppMenuLimit = 0.33; var minAppsDesktop = 8; var availableWidth = headerWidth - $(appList).width(); diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js index dd13cba8e2..9848fb46ff 100644 --- a/core/js/tests/specs/coreSpec.js +++ b/core/js/tests/specs/coreSpec.js @@ -256,10 +256,10 @@ describe('Core base tests', function() { describe('filePath', function() { beforeEach(function() { OC.webroot = 'http://localhost'; - OC.appswebroots['files'] = OC.webroot + '/apps3/files'; + OC.appswebroots.files = OC.webroot + '/apps3/files'; }); afterEach(function() { - delete OC.appswebroots['files']; + delete OC.appswebroots.files; }); it('Uses a direct link for css and images,' , function() { diff --git a/core/js/tests/specs/files/clientSpec.js b/core/js/tests/specs/files/clientSpec.js index f75998029a..d66c209bca 100644 --- a/core/js/tests/specs/files/clientSpec.js +++ b/core/js/tests/specs/files/clientSpec.js @@ -448,7 +448,7 @@ describe('OC.Files.Client tests', function() { expect(info.id).toEqual(11); // file entry - var info = response[1]; + info = response[1]; expect(info instanceof OC.Files.FileInfo).toEqual(true); expect(info.id).toEqual(51); diff --git a/core/js/tests/specs/jquery.avatarSpec.js b/core/js/tests/specs/jquery.avatarSpec.js index d730573669..b9351d2a8a 100644 --- a/core/js/tests/specs/jquery.avatarSpec.js +++ b/core/js/tests/specs/jquery.avatarSpec.js @@ -11,7 +11,7 @@ describe('jquery.avatar tests', function() { var $div; - var devicePixelRatio + var devicePixelRatio; beforeEach(function() { $('#testArea').append($('
')); @@ -24,7 +24,7 @@ describe('jquery.avatar tests', function() { afterEach(function() { $div.remove(); - window.devicePixelRatio = devicePixelRatio + window.devicePixelRatio = devicePixelRatio; }); describe('size', function() { diff --git a/core/js/tests/specs/mimeTypeSpec.js b/core/js/tests/specs/mimeTypeSpec.js index 182941de1a..8ad0300a0a 100644 --- a/core/js/tests/specs/mimeTypeSpec.js +++ b/core/js/tests/specs/mimeTypeSpec.js @@ -26,17 +26,17 @@ describe('MimeType tests', function() { beforeEach(function() { _files = OC.MimeTypeList.files; _aliases = OC.MimeTypeList.aliases; - _theme = OC.MimeTypeList.themes['abc']; + _theme = OC.MimeTypeList.themes.abc; OC.MimeTypeList.files = ['folder', 'folder-shared', 'folder-external', 'foo-bar', 'foo', 'file']; OC.MimeTypeList.aliases = {'app/foobar': 'foo/bar'}; - OC.MimeTypeList.themes['abc'] = ['folder']; + OC.MimeTypeList.themes.abc = ['folder']; }); afterEach(function() { OC.MimeTypeList.files = _files; OC.MimeTypeList.aliases = _aliases; - OC.MimeTypeList.themes['abc'] = _theme; + OC.MimeTypeList.themes.abc = _theme; }); describe('_getFile', function() { @@ -109,9 +109,9 @@ describe('MimeType tests', function() { var res = OC.MimeType.getIconUrl('dir'); expect(Object.keys(OC.MimeType._mimeTypeIcons).length).toEqual(1); - expect(OC.MimeType._mimeTypeIcons['dir']).toEqual(res); + expect(OC.MimeType._mimeTypeIcons.dir).toEqual(res); - var res = OC.MimeType.getIconUrl('dir-shared'); + res = OC.MimeType.getIconUrl('dir-shared'); expect(Object.keys(OC.MimeType._mimeTypeIcons).length).toEqual(2); expect(OC.MimeType._mimeTypeIcons['dir-shared']).toEqual(res); }); diff --git a/core/js/tests/specs/sharedialoglinkshareview.js b/core/js/tests/specs/sharedialoglinkshareview.js index 811919b560..12f5e762ce 100644 --- a/core/js/tests/specs/sharedialoglinkshareview.js +++ b/core/js/tests/specs/sharedialoglinkshareview.js @@ -48,7 +48,6 @@ describe('OC.Share.ShareDialogLinkShareView', function () { configModel = new OC.Share.ShareConfigModel({ enforcePasswordForPublicLink: false, isResharingAllowed: true, - enforcePasswordForPublicLink: false, isDefaultExpireDateEnabled: false, isDefaultExpireDateEnforced: false, defaultExpireDate: 7 diff --git a/core/js/tests/specs/sharedialogshareelistview.js b/core/js/tests/specs/sharedialogshareelistview.js index bcc596a138..d256abcbff 100644 --- a/core/js/tests/specs/sharedialogshareelistview.js +++ b/core/js/tests/specs/sharedialogshareelistview.js @@ -59,7 +59,6 @@ describe('OC.Share.ShareDialogShareeListView', function () { configModel = new OC.Share.ShareConfigModel({ enforcePasswordForPublicLink: false, isResharingAllowed: true, - enforcePasswordForPublicLink: false, isDefaultExpireDateEnabled: false, isDefaultExpireDateEnforced: false, defaultExpireDate: 7 diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index 95349bc487..c6d5793623 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -67,7 +67,6 @@ describe('OC.Share.ShareDialogView', function() { configModel = new OC.Share.ShareConfigModel({ enforcePasswordForPublicLink: false, isResharingAllowed: true, - enforcePasswordForPublicLink: false, isDefaultExpireDateEnabled: false, isDefaultExpireDateEnforced: false, defaultExpireDate: 7