diff --git a/.eslintrc.js b/.eslintrc.js index 79cee6b11..210ba3909 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { root: true, - plugins: ["prettier", "node", "jest"], + plugins: ["prettier", "node", "jest", "jsdoc"], extends: [ "eslint:recommended", "plugin:node/recommended", @@ -57,7 +57,8 @@ module.exports = { "node/no-missing-require": ["error", { allowModules: ["webpack"] }], "node/no-unpublished-bin": "error", "node/no-unpublished-require": "error", - "node/process-exit-as-throw": "error" + "node/process-exit-as-throw": "error", + "jsdoc/require-hyphen-before-param-description": ["error", "never"] }, overrides: [ { diff --git a/lib/OptionsDefaulter.js b/lib/OptionsDefaulter.js index 59b3b0895..90fc895ce 100644 --- a/lib/OptionsDefaulter.js +++ b/lib/OptionsDefaulter.js @@ -6,8 +6,8 @@ /** * Gets the value at path of object - * @param {object} obj - object to query - * @param {string} path - query path + * @param {object} obj object to query + * @param {string} path query path * @returns {any} - if {@param path} requests element from array, then `undefined` will be returned */ const getProperty = (obj, path) => { @@ -21,9 +21,9 @@ const getProperty = (obj, path) => { /** * Sets the value at path of object. Stops execution, if {@param path} requests element from array to be set - * @param {object} obj - object to query - * @param {string} path - query path - * @param {any} value - value to be set + * @param {object} obj object to query + * @param {string} path query path + * @param {any} value value to be set * @returns {void} */ const setProperty = (obj, path, value) => { @@ -65,7 +65,7 @@ class OptionsDefaulter { /** * Enhancing {@param options} with default values - * @param {object} options - provided options + * @param {object} options provided options * @returns {object} - enhanced options * @throws {Error} - will throw error, if configuration value is other then `undefined` or {@link ConfigType} */ @@ -122,9 +122,9 @@ class OptionsDefaulter { /** * Builds up default values - * @param {string} name - option path - * @param {ConfigType | any} config - if {@param def} is provided, then only {@link ConfigType} is allowed - * @param {MakeConfigHandler | CallConfigHandler | AppendConfigValues} [def] - defaults + * @param {string} name option path + * @param {ConfigType | any} config if {@param def} is provided, then only {@link ConfigType} is allowed + * @param {MakeConfigHandler | CallConfigHandler | AppendConfigValues} [def] defaults * @returns {void} */ set(name, config, def) { diff --git a/lib/Template.js b/lib/Template.js index adb168364..05439578e 100644 --- a/lib/Template.js +++ b/lib/Template.js @@ -49,7 +49,7 @@ const stringifyIdSortPredicate = (a, b) => { class Template { /** * - * @param {Function} fn - a runtime function (.runtime.js) "template" + * @param {Function} fn a runtime function (.runtime.js) "template" * @returns {string} the updated and normalized function string */ static getFunctionContent(fn) { diff --git a/lib/util/objectToMap.js b/lib/util/objectToMap.js index 31713646f..f8c13c277 100644 --- a/lib/util/objectToMap.js +++ b/lib/util/objectToMap.js @@ -2,7 +2,7 @@ * convert an object into its 2D array equivalent to be turned * into an ES6 map * - * @param {object} obj - any object type that works with Object.keys() + * @param {object} obj any object type that works with Object.keys() * @returns {Map} an ES6 Map of KV pairs */ module.exports = function objectToMap(obj) { diff --git a/lib/wasm/WebAssemblyGenerator.js b/lib/wasm/WebAssemblyGenerator.js index c15eddee7..9cfd5258f 100644 --- a/lib/wasm/WebAssemblyGenerator.js +++ b/lib/wasm/WebAssemblyGenerator.js @@ -48,7 +48,7 @@ const compose = (...fns) => { /** * Removes the start instruction * - * @param {Object} state - unused state + * @param {Object} state unused state * @returns {ArrayBufferTransform} transform */ const removeStartFunc = state => bin => { @@ -62,7 +62,7 @@ const removeStartFunc = state => bin => { /** * Get imported globals * - * @param {Object} ast - Module's AST + * @param {Object} ast Module's AST * @returns {Array} - nodes */ const getImportedGlobals = ast => { @@ -96,7 +96,7 @@ const getCountImportedFunc = ast => { /** * Get next type index * - * @param {Object} ast - Module's AST + * @param {Object} ast Module's AST * @returns {t.Index} - index */ const getNextTypeIndex = ast => { @@ -116,8 +116,8 @@ const getNextTypeIndex = ast => { * in order to have the correct index we shift the index by number of external * functions. * - * @param {Object} ast - Module's AST - * @param {Number} countImportedFunc - number of imported funcs + * @param {Object} ast Module's AST + * @param {Number} countImportedFunc number of imported funcs * @returns {t.Index} - index */ const getNextFuncIndex = (ast, countImportedFunc) => { @@ -163,7 +163,7 @@ const createDefaultInitForGlobal = globalType => { * * Note that globals will become mutable. * - * @param {Object} state - unused state + * @param {Object} state unused state * @returns {ArrayBufferTransform} transform */ const rewriteImportedGlobals = state => bin => { @@ -279,7 +279,7 @@ const rewriteImports = ({ ast, usedDependencyMap }) => bin => { * The init function fills the globals given input arguments. * * @param {Object} state transformation state - * @param {Object} state.ast - Module's ast + * @param {Object} state.ast Module's ast * @param {t.Identifier} state.initFuncId identifier of the init function * @param {t.Index} state.startAtFuncOffset index of the start function * @param {t.ModuleImport[]} state.importedGlobals list of imported globals diff --git a/package.json b/package.json index 07526120c..4feff445f 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "eslint": "^5.8.0", "eslint-config-prettier": "^4.0.0", "eslint-plugin-jest": "^22.2.2", + "eslint-plugin-jsdoc": "^15.3.2", "eslint-plugin-node": "^8.0.0", "eslint-plugin-prettier": "^3.0.0", "express": "~4.16.4", diff --git a/yarn.lock b/yarn.lock index 5db514910..a720a2afa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1524,6 +1524,11 @@ commander@~2.6.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d" integrity sha1-nfflL7Kgyw+4kFjugMMQQiXzfh0= +comment-parser@^0.5.5: + version "0.5.5" + resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-0.5.5.tgz#c2584cae7c2f0afc773e96b2ee98f8c10cbd693d" + integrity sha512-oB3TinFT+PV3p8UwDQt71+HkG03+zwPwikDlKU6ZDmql6QX2zFlQ+G0GGSDqyJhdZi4PSlzFBm+YJ+ebOX3Vgw== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -2141,6 +2146,11 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= +escape-regex-string@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/escape-regex-string/-/escape-regex-string-1.0.6.tgz#f536d8997ab19ec395385dcf2ea28b4e080899eb" + integrity sha512-AcaPwAOKpF52ETT4uu4vmpqQphuQGjIEhdDwG/gAJYah8ixJlrSBFjhtLMT7frc9y3RWgOnLov9E0MsRBdeRbw== + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.4, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -2190,6 +2200,19 @@ eslint-plugin-jest@^22.2.2: resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.7.2.tgz#7ab118a66a34e46ae5e16a128b5d24fd28b43dca" integrity sha512-Aecqe3ulBVI7amgOycVI8ZPL8o0SnGHOf3zn2/Ciu8TXyXDHcjtwD3hOs3ss/Qh/VAwlW/DMcuiXg5btgF+XMA== +eslint-plugin-jsdoc@^15.3.2: + version "15.3.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-15.3.2.tgz#222e3013101c59ebf10b49fb2d2accf5e5eae677" + integrity sha512-EpdXvRO5oS1mxsD8Jhkq4f3f5ZwM+OxJl7J93cw2H+XlZpu41Gl5n+dohDnG1poq7x6HRp3ONXHFWNHZ5n4Wnw== + dependencies: + comment-parser "^0.5.5" + debug "^4.1.1" + escape-regex-string "^1.0.6" + flat-map-polyfill "^0.3.8" + jsdoctypeparser "5.0.1" + lodash "^4.17.11" + regextras "^0.6.1" + eslint-plugin-node@^8.0.0: version "8.0.1" resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-8.0.1.tgz#55ae3560022863d141fa7a11799532340a685964" @@ -2608,6 +2631,11 @@ flat-cache@^2.0.1: rimraf "2.6.3" write "1.0.3" +flat-map-polyfill@^0.3.8: + version "0.3.8" + resolved "https://registry.yarnpkg.com/flat-map-polyfill/-/flat-map-polyfill-0.3.8.tgz#4ec0bfb7c70e2962f00db03548d3620471fd8697" + integrity sha512-ZfmD5MnU7GglUEhiky9C7yEPaNq1/wh36RDohe+Xr3nJVdccwHbdTkFIYvetcdsoAckUKT51fuf44g7Ni5Doyg== + flatted@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" @@ -3925,6 +3953,11 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= +jsdoctypeparser@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-5.0.1.tgz#0d6bc09bb8bebeca5a588fcd508228d2189409a3" + integrity sha512-dYwcK6TKzvq+ZKtbp4sbQSW9JMo6s+4YFfUs5D/K7bZsn3s1NhEhZ+jmIPzby0HbkbECBe+hNPEa6a+E21o94w== + jsdom@^11.5.1: version "11.12.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" @@ -5743,6 +5776,11 @@ regexpp@^2.0.0, regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== +regextras@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/regextras/-/regextras-0.6.1.tgz#9689641bbb338e0ff7001a5c507c6a2008df7b36" + integrity sha512-EzIHww9xV2Kpqx+corS/I7OBmf2rZ0pKKJPsw5Dc+l6Zq1TslDmtRIP9maVn3UH+72MIXmn8zzDgP07ihQogUA== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef"