Skip to content

Commit 205d11f

Browse files
committed
Add void return type when annotaded
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 8ba9322 commit 205d11f

26 files changed

Lines changed: 146 additions & 413 deletions

js/src/designer/database.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ var DesignerOfflineDB = (function () {
5353

5454
/**
5555
* @param {Function} callback
56-
* @return {void}
5756
*/
58-
designerDB.open = function (callback) {
57+
designerDB.open = function (callback): void {
5958
var version = 1;
6059
var request = window.indexedDB.open('pma_designer', version);
6160

@@ -94,9 +93,8 @@ var DesignerOfflineDB = (function () {
9493
* @param {String} table
9594
* @param {String} id
9695
* @param {Function} callback
97-
* @return {void}
9896
*/
99-
designerDB.loadObject = function (table, id, callback) {
97+
designerDB.loadObject = function (table, id, callback): void {
10098
if (datastore === null) {
10199
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
102100
return;
@@ -115,9 +113,8 @@ var DesignerOfflineDB = (function () {
115113
/**
116114
* @param {String} table
117115
* @param {Function} callback
118-
* @return {void}
119116
*/
120-
designerDB.loadAllObjects = function (table, callback) {
117+
designerDB.loadAllObjects = function (table, callback): void {
121118
if (datastore === null) {
122119
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
123120
return;
@@ -146,9 +143,8 @@ var DesignerOfflineDB = (function () {
146143
/**
147144
* @param {String} table
148145
* @param {Function} callback
149-
* @return {void}
150146
*/
151-
designerDB.loadFirstObject = function (table, callback) {
147+
designerDB.loadFirstObject = function (table, callback): void {
152148
if (datastore === null) {
153149
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
154150
return;
@@ -177,9 +173,8 @@ var DesignerOfflineDB = (function () {
177173
* @param {String} table
178174
* @param {Object} obj
179175
* @param {Function} callback
180-
* @return {void}
181176
*/
182-
designerDB.addObject = function (table, obj, callback) {
177+
designerDB.addObject = function (table, obj, callback): void {
183178
if (datastore === null) {
184179
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
185180
return;
@@ -201,9 +196,8 @@ var DesignerOfflineDB = (function () {
201196
* @param {String} table
202197
* @param {String} id
203198
* @param {Function} callback
204-
* @return {void}
205199
*/
206-
designerDB.deleteObject = function (table, id, callback) {
200+
designerDB.deleteObject = function (table, id, callback): void {
207201
if (datastore === null) {
208202
ajaxShowMessage(window.Messages.strIndexedDBNotWorking, null, 'error');
209203
return;
@@ -223,9 +217,8 @@ var DesignerOfflineDB = (function () {
223217

224218
/**
225219
* @param {Error} e
226-
* @return {void}
227220
*/
228-
designerDB.onerror = function (e) {
221+
designerDB.onerror = function (e): void {
229222
// eslint-disable-next-line no-console
230223
console.log(e);
231224
};

js/src/designer/history.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,8 @@ DesignerHistory.display = function (init, finit) {
139139
*
140140
*
141141
* @param {number} index index of DesignerHistory.historyArray where change is to be made
142-
* @return {void}
143142
*/
144-
DesignerHistory.andOr = function (index) {
143+
DesignerHistory.andOr = function (index): void {
145144
if (DesignerHistory.historyArray[index].getAndOr()) {
146145
DesignerHistory.historyArray[index].setAndOr(0);
147146
} else {
@@ -156,9 +155,8 @@ DesignerHistory.andOr = function (index) {
156155
* Deletes entry in DesignerHistory.historyArray
157156
*
158157
* @param {number} index of DesignerHistory.historyArray[] which is to be deleted
159-
* @return {void}
160158
*/
161-
DesignerHistory.historyDelete = function (index) {
159+
DesignerHistory.historyDelete = function (index): void {
162160
var fromArrayLength = window.fromArray.length;
163161
for (var k = 0; k < fromArrayLength; k++) {
164162
if (window.fromArray[k] === DesignerHistory.historyArray[index].getTab()) {
@@ -174,9 +172,8 @@ DesignerHistory.historyDelete = function (index) {
174172

175173
/**
176174
* @param {string} elementId
177-
* @return {void}
178175
*/
179-
DesignerHistory.changeStyle = function (elementId) {
176+
DesignerHistory.changeStyle = function (elementId): void {
180177
var element = document.getElementById(elementId);
181178
element.style.left = '530px';
182179
element.style.top = '130px';
@@ -190,9 +187,8 @@ DesignerHistory.changeStyle = function (elementId) {
190187
* To show where,rename,aggregate,having forms to edit a object
191188
*
192189
* @param {number} index index of DesignerHistory.historyArray where change is to be made
193-
* @return {void}
194190
*/
195-
DesignerHistory.historyEdit = function (index) {
191+
DesignerHistory.historyEdit = function (index): void {
196192
gIndex = index;
197193
var type = DesignerHistory.historyArray[index].getType();
198194
if (type === 'Where') {
@@ -218,9 +214,8 @@ DesignerHistory.historyEdit = function (index) {
218214
* checks for the type of object and then sets the new value
219215
*
220216
* @param {string} type of DesignerHistory.historyArray where change is to be made
221-
* @return {void}
222217
*/
223-
DesignerHistory.edit = function (type) {
218+
DesignerHistory.edit = function (type): void {
224219
if (type === 'Rename') {
225220
if (document.getElementById('e_rename').value !== '') {
226221
DesignerHistory.historyArray[gIndex].getObj().setRenameTo(document.getElementById('e_rename').value);

js/src/designer/move.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,8 @@ DesignerMove.resizeOsnTab = function () {
258258
* @param {number} y2
259259
* @param {HTMLElement} osnTab
260260
* @param {string} colorTarget
261-
* @return {void}
262261
*/
263-
DesignerMove.drawLine0 = function (x1, x2, y1, y2, osnTab, colorTarget) {
262+
DesignerMove.drawLine0 = function (x1, x2, y1, y2, osnTab, colorTarget): void {
264263
DesignerMove.line0(
265264
x1 + directionEffect * osnTab.offsetLeft,
266265
y1 - osnTab.offsetTop,

js/src/drag_drop_import.ts

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ var DragDropImport = {
5959
*
6060
* @param {string} hash, hash for specific file upload
6161
* @param {number} percent (float), file upload percentage
62-
*
63-
* @return {void}
6462
*/
65-
setProgress: function (hash, percent) {
63+
setProgress: function (hash, percent): void {
6664
$('.pma_sql_import_status div li[data-hash="' + hash + '"]')
6765
.children('progress').val(percent);
6866
},
@@ -71,10 +69,8 @@ var DragDropImport = {
7169
*
7270
* @param {object} formData FormData object for a specific file
7371
* @param {string} hash hash of the current file upload
74-
*
75-
* @return {void}
7672
*/
77-
sendFileToServer: function (formData, hash) {
73+
sendFileToServer: function (formData, hash): void {
7874
var jqXHR = $.ajax({
7975
xhr: function () {
8076
var xhrobj = $.ajaxSettings.xhr();
@@ -145,10 +141,8 @@ var DragDropImport = {
145141
* Triggered when an object is dragged into the PMA UI
146142
*
147143
* @param {MouseEvent} event obj
148-
*
149-
* @return {void}
150144
*/
151-
dragEnter: function (event) {
145+
dragEnter: function (event): void {
152146
// We don't want to prevent users from using
153147
// browser's default drag-drop feature on some page(s)
154148
if ($('.noDragDrop').length !== 0) {
@@ -186,10 +180,8 @@ var DragDropImport = {
186180
* Triggered when dragged file is being dragged over PMA UI
187181
*
188182
* @param {MouseEvent} event obj
189-
*
190-
* @return {void}
191183
*/
192-
dragOver: function (event) {
184+
dragOver: function (event): void {
193185
// We don't want to prevent users from using
194186
// browser's default drag-drop feature on some page(s)
195187
if ($('.noDragDrop').length !== 0) {
@@ -207,10 +199,8 @@ var DragDropImport = {
207199
* Triggered when dragged objects are left
208200
*
209201
* @param {MouseEvent} event obj
210-
*
211-
* @return {void}
212202
*/
213-
dragLeave: function (event) {
203+
dragLeave: function (event): void {
214204
// We don't want to prevent users from using
215205
// browser's default drag-drop feature on some page(s)
216206
if ($('.noDragDrop').length !== 0) {
@@ -229,10 +219,8 @@ var DragDropImport = {
229219
* @param {string} hash unique hash for a certain upload
230220
* @param {boolean} aborted true if upload was aborted
231221
* @param {boolean} status status of sql upload, as sent by server
232-
*
233-
* @return {void}
234222
*/
235-
importFinished: function (hash, aborted, status) {
223+
importFinished: function (hash, aborted, status): void {
236224
$('.pma_sql_import_status div li[data-hash="' + hash + '"]')
237225
.children('progress').hide();
238226
var icon = 'icon ic_s_success';
@@ -272,10 +260,8 @@ var DragDropImport = {
272260
* From this function, the AJAX Upload operation is initiated
273261
*
274262
* @param event object
275-
*
276-
* @return {void}
277263
*/
278-
drop: function (event) {
264+
drop: function (event): void {
279265
// We don't want to prevent users from using
280266
// browser's default drag-drop feature on some page(s)
281267
if ($('.noDragDrop').length !== 0) {
@@ -355,10 +341,7 @@ var DragDropImport = {
355341
};
356342

357343
/**
358-
* Called when some user drags, dragover, leave
359-
* a file to the PMA UI
360-
* @param {object}, Event data
361-
* @return {void}
344+
* Called when some user drags, dragover, leave a file to the PMA UI
362345
*/
363346
$(document).on('dragenter', DragDropImport.dragEnter);
364347
$(document).on('dragover', DragDropImport.dragOver);

js/src/error_report.ts

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ var ErrorReport = {
2626
*
2727
* @param {object} data
2828
* @param {any} exception
29-
* @return {void}
3029
*/
31-
errorDataHandler: function (data, exception) {
30+
errorDataHandler: function (data, exception): void {
3231
if (data.success !== true) {
3332
ajaxShowMessage(data.error, false);
3433
return;
@@ -78,10 +77,8 @@ var ErrorReport = {
7877
* Shows the modal dialog previewing the report
7978
*
8079
* @param exception object error report info
81-
*
82-
* @return {void}
8380
*/
84-
showReportDialog: function (exception) {
81+
showReportDialog: function (exception): void {
8582
const reportData = ErrorReport.getReportData(exception);
8683

8784
const sendErrorReport = function () {
@@ -119,10 +116,8 @@ var ErrorReport = {
119116
},
120117
/**
121118
* Shows the small notification that asks for user permission
122-
*
123-
* @return {void}
124119
*/
125-
showErrorNotification: function () {
120+
showErrorNotification: function (): void {
126121
var key = Math.random().toString(36).substring(2, 12);
127122
while (key in ErrorReport.keyDict) {
128123
key = Math.random().toString(36).substring(2, 12);
@@ -161,9 +156,8 @@ var ErrorReport = {
161156
* Removes the notification if it was displayed before
162157
*
163158
* @param {Event} e
164-
* @return {void}
165159
*/
166-
removeErrorNotification: function (e) {
160+
removeErrorNotification: function (e): void {
167161
if (e) {
168162
// don't remove the hash fragment by navigating to #
169163
e.preventDefault();
@@ -193,10 +187,8 @@ var ErrorReport = {
193187
},
194188
/**
195189
* Shows the modal dialog previewing the report
196-
*
197-
* @return {void}
198190
*/
199-
createReportDialog: function () {
191+
createReportDialog: function (): void {
200192
ErrorReport.removeErrorNotification();
201193
ErrorReport.showReportDialog(ErrorReport.lastException);
202194
},
@@ -263,10 +255,8 @@ var ErrorReport = {
263255
},
264256
/**
265257
* Automatically wraps the callback in AJAX.registerOnload
266-
*
267-
* @return {void}
268258
*/
269-
wrapAjaxOnloadCallback: function () {
259+
wrapAjaxOnloadCallback: function (): void {
270260
var oldOnload = AJAX.registerOnload;
271261
AJAX.registerOnload = function (file, func) {
272262
var wrappedFunction = ErrorReport.wrapFunction(func);
@@ -275,10 +265,8 @@ var ErrorReport = {
275265
},
276266
/**
277267
* Automatically wraps the callback in $.fn.on
278-
*
279-
* @return {void}
280268
*/
281-
wrapJqueryOnCallback: function () {
269+
wrapJqueryOnCallback: function (): void {
282270
var oldOn = $.fn.on;
283271
$.fn.on = function () {
284272
for (var i = 1; i <= 3; i++) {
@@ -292,10 +280,8 @@ var ErrorReport = {
292280
},
293281
/**
294282
* Wraps the callback in AJAX.registerOnload automatically
295-
*
296-
* @return {void}
297283
*/
298-
setUpErrorReporting: function () {
284+
setUpErrorReporting: function (): void {
299285
ErrorReport.wrapAjaxOnloadCallback();
300286
ErrorReport.wrapJqueryOnCallback();
301287
}

js/src/export.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,8 @@ Export.checkTimeOut = function (timeLimit) {
787787
* Handler for Alias dialog box
788788
*
789789
* @param event object the event object
790-
*
791-
* @return {void}
792790
*/
793-
Export.createAliasModal = function (event) {
791+
Export.createAliasModal = function (event): void {
794792
event.preventDefault();
795793
var modal = $('#renameExportModal');
796794
modal.modal('show');

js/src/modules/ajax-message.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,8 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) {
141141
* Removes the message shown for an Ajax operation when it's completed
142142
*
143143
* @param {JQuery} $thisMessageBox Element that holds the notification
144-
*
145-
* @return {void}
146144
*/
147-
const ajaxRemoveMessage = function ($thisMessageBox) {
145+
const ajaxRemoveMessage = function ($thisMessageBox): void {
148146
if ($thisMessageBox !== undefined && $thisMessageBox instanceof $) {
149147
$thisMessageBox
150148
.stop(true, true)

0 commit comments

Comments
 (0)