diff --git a/editor/embedapi.js b/editor/embedapi.js index fb50e201..44859b55 100644 --- a/editor/embedapi.js +++ b/editor/embedapi.js @@ -5,14 +5,9 @@ let cbid = 0; -/** -* @callback module:EmbeddedSVGEdit.GenericCallback -* @param {...*} args Signature dependent on the function -* @returns {*} Return dependent on the function -*/ /** * @callback module:EmbeddedSVGEdit.CallbackSetter -* @param {module:EmbeddedSVGEdit.GenericCallback} newCallback Callback to be stored (signature dependent on function) +* @param {GenericCallback} newCallback Callback to be stored (signature dependent on function) * @returns {undefined} */ /** @@ -339,7 +334,7 @@ class EmbeddedSVGEdit { /** * @param {string} name * @param {ArgumentsArray} args Signature dependent on function - * @param {module:EmbeddedSVGEdit.GenericCallback} callback + * @param {GenericCallback} callback * @returns {Integer} */ send (name, args, callback) { diff --git a/editor/typedefs.js b/editor/typedefs.js index 0b39edf0..2c83ab21 100644 --- a/editor/typedefs.js +++ b/editor/typedefs.js @@ -10,6 +10,12 @@ * @typedef {null|boolean|Float|string|GenericArray|PlainObject} JSON */ +/** +* @callback GenericCallback +* @param {...*} args Signature dependent on the function +* @returns {*} Return dependent on the function +*/ + /** * This should only be used for objects known to be potentially arbitrary in form. * For those whose determination has not yet been made, simply use type `object` diff --git a/grep-jsdoc.js b/jsdoc-check-overly-generic-types.js similarity index 96% rename from grep-jsdoc.js rename to jsdoc-check-overly-generic-types.js index bfec7498..afa89746 100644 --- a/grep-jsdoc.js +++ b/jsdoc-check-overly-generic-types.js @@ -65,8 +65,7 @@ function reduceFalseMatches (file, res) { case 'editor/embedapi.js': res.line = res.line.filter((line) => { return ![ - '* @param {...*} args Signature dependent on the function', - '* @returns {*} Return dependent on the function' + '* @param {...*} args Signature dependent on the function' ].includes(line); }); break; @@ -76,7 +75,9 @@ function reduceFalseMatches (file, res) { '* @typedef {number} Float', '* @typedef {object} ArbitraryObject', '* @typedef {object} ArbitraryModule', - '* @typedef {*} Any' + '* @typedef {*} Any', + '* @param {...*} args Signature dependent on the function', + '* @returns {*} Return dependent on the function' ].includes(line); }); break; diff --git a/package.json b/package.json index a939a1d1..82ccc684 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "scripts": { "prepublishOnly": "npm run test-prep", "build-config": "rollup -c rollup-config.config.js", - "grep-doc": "node grep-jsdoc", + "types-doc": "node jsdoc-check-overly-generic-types.js", "open-es-allext": "opn http://localhost:8000/editor/svg-editor-es.html?extensions=ext-arrows.js,ext-closepath.js,ext-foreignobject.js,ext-helloworld.js,ext-mathjax.js,ext-php_savefile.js,ext-server_moinsave.js,ext-server_opensave.js,ext-webappfind.js,ext-xdomain-messaging.js", "build-doc": "rm -rf docs/jsdoc/*;jsdoc --pedantic -c docs/jsdoc-config.json editor", "build-html": "node build-html.js",