- Docs: For clarity, rename `grep-jsdoc.js` to `jsdoc-check-overly-generic-types.js`

- Docs: Move GenericCallback to typedefs.js for possible reuse
- npm: Update "grep-doc" to "types-doc" for greater clarity
master
Brett Zamir 2018-10-25 10:09:32 +08:00
parent 6b0e54af07
commit 89515b7e1e
4 changed files with 13 additions and 11 deletions

View File

@ -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) {

View File

@ -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`

View File

@ -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;

View File

@ -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",