diff --git a/.eslintrc.json b/.eslintrc.json index e20dc99236..1b945ee38a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,15 +17,6 @@ "es6": true }, "rules": { - "valid-jsdoc": ["error", { - "prefer": { - "returns": "return" - }, - "requireReturn": false, - "requireParamType": false, - "requireReturnDescription": false, - "requireParamDescription": false - }], "array-bracket-spacing": "error", "brace-style": "error", "camelcase": "error", diff --git a/js/src/main.ts b/js/src/main.ts index bd546f6404..ebf7f42f18 100644 --- a/js/src/main.ts +++ b/js/src/main.ts @@ -1,6 +1,6 @@ import $ from 'jquery'; import { AJAX } from './modules/ajax.ts'; -import { Functions } from './modules/functions.ts'; +import { addNoCacheToAjaxRequests, Functions } from './modules/functions.ts'; import { KeyHandlerEvents } from './modules/keyhandler.ts'; import { PageSettings } from './modules/page_settings.ts'; import { crossFramingProtection } from './modules/cross_framing_protection.ts'; @@ -29,7 +29,7 @@ crossFramingProtection(); AJAX.registerTeardown('main.js', Config.off()); AJAX.registerOnload('main.js', Config.on()); -$.ajaxPrefilter(Functions.addNoCacheToAjaxRequests()); +$.ajaxPrefilter(addNoCacheToAjaxRequests); AJAX.registerTeardown('main.js', teardownFunctions()); AJAX.registerOnload('main.js', onloadFunctions()); diff --git a/js/src/modules/functions.ts b/js/src/modules/functions.ts index 4cbf3f0211..e1be9e508d 100644 --- a/js/src/modules/functions.ts +++ b/js/src/modules/functions.ts @@ -62,10 +62,9 @@ window.centralColumnList = []; /** * Make sure that ajax requests will not be cached by appending a random variable to their parameters. - * @return {function(JQuery.AjaxSettings, JQuery.AjaxSettings): void} */ -Functions.addNoCacheToAjaxRequests = () => function (options, originalOptions) { - var nocache = new Date().getTime() + '' + Math.floor(Math.random() * 1000000); +export function addNoCacheToAjaxRequests (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings): void { + const nocache = new Date().getTime() + '' + Math.floor(Math.random() * 1000000); if (typeof options.data === 'string') { options.data += '&_nocache=' + nocache + '&token=' + encodeURIComponent(CommonParams.get('token')); } else if (typeof options.data === 'object') { @@ -74,7 +73,7 @@ Functions.addNoCacheToAjaxRequests = () => function (options, originalOptions) { 'token': CommonParams.get('token') }); } -}; +} /** * Adds a date/time picker to an element