Fix incorrect JSDoc async return annotations

The return type of an async function should be documented as a Promise
of what the function returns as this is what JSDoc expects.
This commit is contained in:
Hornwitser committed 2023-02-15 20:31:02 +01:00
1 parent a7dedcd3b7
commit 2d8b35291d
12 files changed
+33 -33

No files matched your search

+4 -4
View File
@@ -67,7 +67,7 @@ async function loadZip(server, modVersions, mod) {
* The server to load the file from.
* @param {Map<string, string>} modVersions - Mapping of mod to version used.
* @param {string} modPath - Factorio style path to the file to load.
* @returns {?Buffer} The content of the file or null if not found.
* @returns {Promise<?Buffer>} The content of the file or null if not found.
* @memberof module:lib/factorio
* @private
* @inner
@@ -255,7 +255,7 @@ function filterItems(prototypes) {
* @param {Map<string, string>} modVersions -
* Mapping of mod name to versions to get icons from.
* @param {Array<Object>} items - Array of item prototypes.
* @return {{itemSheet: Jimp, itemData: Map<string,Object>}}
* @return {Promise<{itemSheet: Jimp, itemData: Map<string,Object>}>}
* Item spritesheet and metadata.
* @memberof module:lib/factorio
* @private
@@ -327,7 +327,7 @@ async function exportItems(server, modVersions, items) {
* Mapping of mod name to version to export locale from.
* @param {Array<string>} modOrder - Load order of the mods.
* @param {string} languageCode - Language to export locale for.
* @returns {Map<string, string>} merged locale information
* @returns {Promise<Map<string, string>>} merged locale information
* @memberof module:lib/factorio
* @private
* @inner
@@ -379,7 +379,7 @@ async function exportLocale(server, modVersions, modOrder, languageCode) {
*
* @param {module:lib/factorio.FactorioServer} server -
* The server to export the data from.
* @returns {JSZip} zip file with exported data.
* @returns {Promise<JSZip>} zip file with exported data.
* @memberof module:lib/factorio
*/
async function exportData(server) {
+5 -5
View File
@@ -86,7 +86,7 @@ function versionOrder(a, b) {
* @param {string} targetVersion -
* Version to look for, supports the special value "latest" for the
* latest version available.
* @returns {Array} Array with path to data dir and version found.
* @returns {Promise<Array>} Array with path to data dir and version found.
* @memberof module:lib/factorio
* @private
* @inner
@@ -163,7 +163,7 @@ function randomDynamicPort() {
* the given length.
*
* @param {number} length - the length of the password to generate.
* @return {string} password of the given length
* @return {Promise<string>} password of the given length
* @memberof module:lib/factorio
* @private
* @inner
@@ -902,7 +902,7 @@ class FactorioServer extends events.EventEmitter {
* @param {boolean} expectEmpty -
* if true throw if the response is not empty. Useful for detecting
* errors that might have been sent in response.
* @returns {string} response from server.
* @returns {Promise<string>} response from server.
*/
async sendRcon(message, expectEmpty) {
this._check(["running", "stopping"]);
@@ -1036,7 +1036,7 @@ class FactorioServer extends events.EventEmitter {
* Ensures achievements are disabled on the save that's running. This is
* necessary in order to run any commands at all.
*
* @returns {boolean}
* @returns {Promise<boolean>}
* True if acheivements got disabled and false if they already where
* disabled.
*/
@@ -1104,7 +1104,7 @@ class FactorioServer extends events.EventEmitter {
*
* Loads server-settings.example.json from the data dir.
*
* @returns {object} the parsed server-settings.
* @returns {Promise<object>} the parsed server-settings.
*/
async exampleSettings() {
return JSON.parse(await fs.readFile(this.dataPath("server-settings.example.json"), "utf-8"));