Browse Source

Reduce JSHint errors/warnings

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Morris Jobke 2 years ago
parent
commit
d790c27a19

+ 4 - 1
.jshintrc

@@ -28,7 +28,10 @@
 		"_": true,
 		"OC": true,
 		"OCA": true,
+		"OCP": true,
 		"t": true,
-		"n": true
+		"n": true,
+		"escapeHTML": true,
+		"Promise": true
 	}
 }

+ 1 - 1
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();

+ 2 - 2
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() {

+ 1 - 1
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);
 

+ 2 - 2
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($('<div id="avatardiv">'));
@@ -24,7 +24,7 @@ describe('jquery.avatar tests', function() {
 	afterEach(function() {
 		$div.remove();
 
-		window.devicePixelRatio = devicePixelRatio
+		window.devicePixelRatio = devicePixelRatio;
 	});
 
 	describe('size', function() {

+ 5 - 5
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);
 			});

+ 0 - 1
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

+ 0 - 1
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

+ 0 - 1
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