From 4e5cdc87b9710e21e9909241948410b3959fa2c9 Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Sat, 17 May 2025 10:04:07 +0200 Subject: [PATCH] Fix eslint rule 'spaced-comment' Manual fixes needed for: eslint --no-config-lookup --rule '"spaced-comment": ["warn", "always"]' Ref: #7812 Signed-off-by: Ralph Sennhauser --- binaries/data/mods/mod/hwdetect/hwdetect.js | 4 +-- .../data/mods/public/globalscripts/vector.js | 29 ++++++++++--------- .../public/maps/random/rmgen-common/player.js | 5 ++-- .../mods/public/maps/random/rmgen/Noise.js | 29 ++++++++++--------- .../public/maps/random/rmgen/environment.js | 16 +++++----- .../mods/public/maps/random/rmgen/library.js | 6 ++-- .../rmgen/placer/centered/ClumpPlacer.js | 6 ++-- .../public/maps/scenarios/triggers_demo.js | 6 ++-- .../maps/scenarios/unit_pushing_test.js | 4 +-- .../public/simulation/helpers/Commands.js | 4 +-- .../mods/public/simulation/helpers/Walls.js | 2 +- 11 files changed, 56 insertions(+), 55 deletions(-) diff --git a/binaries/data/mods/mod/hwdetect/hwdetect.js b/binaries/data/mods/mod/hwdetect/hwdetect.js index 6bc676e2d3..f1a6ea0b9a 100644 --- a/binaries/data/mods/mod/hwdetect/hwdetect.js +++ b/binaries/data/mods/mod/hwdetect/hwdetect.js @@ -344,11 +344,11 @@ global.RunHardwareDetection = function(settings) if (settings.renderer_backend.name != 'gl' && settings.renderer_backend.name != 'glarb') return; - //print(JSON.stringify(settings, null, 1)+"\n"); + // print(JSON.stringify(settings, null, 1)+"\n"); var output = RunDetection(settings); - //print(JSON.stringify(output, null, 1)+"\n"); + // print(JSON.stringify(output, null, 1)+"\n"); for (var i = 0; i < output.warnings.length; ++i) warn(output.warnings[i]); diff --git a/binaries/data/mods/public/globalscripts/vector.js b/binaries/data/mods/public/globalscripts/vector.js index 696fe2492a..e1c0f10cd3 100644 --- a/binaries/data/mods/public/globalscripts/vector.js +++ b/binaries/data/mods/public/globalscripts/vector.js @@ -1,13 +1,13 @@ -///////////////////////////////////////////////////////////////////// -// Vector2D -// -// Class for representing and manipulating 2D vectors -// -///////////////////////////////////////////////////////////////////// - // TODO: Type errors if v not instanceof Vector classes // TODO: Possibly implement in C++ +/** + * @class Vector2D + * @brief Class for representing and manipulating 2D vectors + * + * @param {number} x First coordinate value, defaults to 0. + * @param {number} y Second coordinate value, defaults to 0. + */ function Vector2D(x = 0, y = 0) { this.set(x, y); @@ -252,13 +252,14 @@ Vector2D.dot = function(v1, v2) return v1.x * v2.x + v1.y * v2.y; }; -///////////////////////////////////////////////////////////////////// -// Vector3D -// -// Class for representing and manipulating 3D vectors -// -///////////////////////////////////////////////////////////////////// - +/** + * @class Vector3D + * @brief Class for representing and manipulating 3D vectors + * + * @param {number} x First coordinate value, defaults to 0. + * @param {number} y Second coordinate value, defaults to 0. + * @param {number} z Third coordinate value, defaults to 0. + */ function Vector3D(x = 0, y = 0, z = 0) { this.set(x, y, z); diff --git a/binaries/data/mods/public/maps/random/rmgen-common/player.js b/binaries/data/mods/public/maps/random/rmgen-common/player.js index d45780a1f8..8f234b4382 100644 --- a/binaries/data/mods/public/maps/random/rmgen-common/player.js +++ b/binaries/data/mods/public/maps/random/rmgen-common/player.js @@ -510,8 +510,9 @@ function getPlayerIDs() return Array.from(Array(getNumPlayers()), (_, index) => index + 1); } -/*** Sorts an array of player IDs by team index. Players without teams come first. - * Randomize order for players of the same team. +/** + * Sorts an array of player IDs by team index. + * Players without teams come first. Randomize order for players of the same team. */ function sortPlayers(playerIDs) { diff --git a/binaries/data/mods/public/maps/random/rmgen/Noise.js b/binaries/data/mods/public/maps/random/rmgen/Noise.js index 1bd0ad0a37..89145acece 100644 --- a/binaries/data/mods/public/maps/random/rmgen/Noise.js +++ b/binaries/data/mods/public/maps/random/rmgen/Noise.js @@ -14,13 +14,13 @@ function modPos(num, m) return p; } -///////////////////////////////////////////////////////////////////// -// Noise2D -// -// Class representing 2D noise with a given base frequency -// -///////////////////////////////////////////////////////////////////// - +/** + * @class Noise2D + * @brief Class representing 2D noise with a given base frequency + * + * @param {number} freq - The base frequency (grid resolution) of the noise. + * Determines the number of gradient vectors along each axis. + */ function Noise2D(freq) { freq = Math.floor(freq); @@ -64,13 +64,14 @@ Noise2D.prototype.get = function(x, y) return (a + ey*(b-a)) * 0.5 + 0.5; }; -///////////////////////////////////////////////////////////////////// -// Noise3D -// -// Class representing 3D noise with given base frequencies -// -///////////////////////////////////////////////////////////////////// - +/** + * @class Noise3D + * @brief Class representing 3D noise with given base frequencies + * + * @param {number} freq - The base frequency (grid resolution) of the noise. + * Determines the number of gradient vectors along the first to axis. + * @param {number} vfreq - The base frequency for the third dimension. + */ function Noise3D(freq, vfreq) { freq = Math.floor(freq); diff --git a/binaries/data/mods/public/maps/random/rmgen/environment.js b/binaries/data/mods/public/maps/random/rmgen/environment.js index 4637df9096..421d7a344a 100644 --- a/binaries/data/mods/public/maps/random/rmgen/environment.js +++ b/binaries/data/mods/public/maps/random/rmgen/environment.js @@ -42,9 +42,9 @@ var g_Camera = { "Declination": 0.523599 }; -//////////////////////////////////////////////////////////////////////////// +// // Sun, Sky and Terrain -//////////////////////////////////////////////////////////////////////////// +// function setSkySet(set) { @@ -71,9 +71,9 @@ function setAmbientColor(r, g, b) g_Environment.AmbientColor = { "r": r, "g": g, "b": b, "a": 0 }; } -//////////////////////////////////////////////////////////////////////////// +// // Water -//////////////////////////////////////////////////////////////////////////// +// function setWaterColor(r, g, b) { @@ -110,9 +110,9 @@ function setWindAngle(m) g_Environment.Water.WaterBody.WindAngle = m; } -//////////////////////////////////////////////////////////////////////////// +// // Fog (numerical arguments between 0 and 1) -//////////////////////////////////////////////////////////////////////////// +// function setFogFactor(s) { @@ -129,9 +129,9 @@ function setFogColor(r, g, b) g_Environment.Fog.FogColor = { "r": r, "g": g, "b": b, "a": 0 }; } -//////////////////////////////////////////////////////////////////////////// +// // Post Processing (numerical arguments between 0 and 1) -//////////////////////////////////////////////////////////////////////////// +// function setPPBrightness(s) { diff --git a/binaries/data/mods/public/maps/random/rmgen/library.js b/binaries/data/mods/public/maps/random/rmgen/library.js index bc9ac7ae8e..caacb9e43f 100644 --- a/binaries/data/mods/public/maps/random/rmgen/library.js +++ b/binaries/data/mods/public/maps/random/rmgen/library.js @@ -270,7 +270,7 @@ function createObjectGroup(group, player, constraints) /** * Create an avoid constraint for the given classes by the given distances */ -function avoidClasses(/*class1, dist1, class2, dist2, etc*/) +function avoidClasses(/* class1, dist1, class2, dist2, etc */) { const ar = []; for (let i = 0; i < arguments.length/2; ++i) @@ -286,7 +286,7 @@ function avoidClasses(/*class1, dist1, class2, dist2, etc*/) /** * Create a stay constraint for the given classes by the given distances */ -function stayClasses(/*class1, dist1, class2, dist2, etc*/) +function stayClasses(/* class1, dist1, class2, dist2, etc */) { const ar = []; for (let i = 0; i < arguments.length/2; ++i) @@ -302,7 +302,7 @@ function stayClasses(/*class1, dist1, class2, dist2, etc*/) /** * Create a border constraint for the given classes by the given distances */ -function borderClasses(/*class1, idist1, odist1, class2, idist2, odist2, etc*/) +function borderClasses(/* class1, idist1, odist1, class2, idist2, odist2, etc */) { const ar = []; for (let i = 0; i < arguments.length/3; ++i) diff --git a/binaries/data/mods/public/maps/random/rmgen/placer/centered/ClumpPlacer.js b/binaries/data/mods/public/maps/random/rmgen/placer/centered/ClumpPlacer.js index c8f674d7d6..249e12ffee 100644 --- a/binaries/data/mods/public/maps/random/rmgen/placer/centered/ClumpPlacer.js +++ b/binaries/data/mods/public/maps/random/rmgen/placer/centered/ClumpPlacer.js @@ -43,9 +43,9 @@ ClumpPlacer.prototype.place = function(constraint) if (ctrlPts > radius * 2 * Math.PI) ctrlPts = Math.floor(radius * 2 * Math.PI) + 1; - const noise = new Float32Array(intPerim); //float32 - const ctrlCoords = new Float32Array(ctrlPts+1); //float32 - const ctrlVals = new Float32Array(ctrlPts+1); //float32 + const noise = new Float32Array(intPerim); // float32 + const ctrlCoords = new Float32Array(ctrlPts+1); // float32 + const ctrlVals = new Float32Array(ctrlPts+1); // float32 // Generate some interpolated noise for (let i=0; i < ctrlPts; i++) diff --git a/binaries/data/mods/public/maps/scenarios/triggers_demo.js b/binaries/data/mods/public/maps/scenarios/triggers_demo.js index 887f26041d..c063014467 100644 --- a/binaries/data/mods/public/maps/scenarios/triggers_demo.js +++ b/binaries/data/mods/public/maps/scenarios/triggers_demo.js @@ -1,8 +1,8 @@ warn("loading the triggers file"); -/////////////////////// -// Trigger listeners // -/////////////////////// +// +// Trigger listeners +// // every function just logs when it gets fired, and shows the data Trigger.prototype.StructureBuiltAction = function(data) diff --git a/binaries/data/mods/public/maps/scenarios/unit_pushing_test.js b/binaries/data/mods/public/maps/scenarios/unit_pushing_test.js index c351c11136..ccf034cb6c 100644 --- a/binaries/data/mods/public/maps/scenarios/unit_pushing_test.js +++ b/binaries/data/mods/public/maps/scenarios/unit_pushing_test.js @@ -371,7 +371,6 @@ Trigger.prototype.Setup = function() { const start = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetTime(); - // /* let gx = 100; let gy = 100; for (const key in experiments) @@ -384,8 +383,7 @@ Trigger.prototype.Setup = function() gy += 150; } } - /**/ - //perf_experiments.LotsaLocalCollisions.spawn(); + // perf_experiments.LotsaLocalCollisions.spawn(); /* let time = 0; for (let key in perf_experiments) diff --git a/binaries/data/mods/public/simulation/helpers/Commands.js b/binaries/data/mods/public/simulation/helpers/Commands.js index 7d0e98fa27..470337ac6f 100644 --- a/binaries/data/mods/public/simulation/helpers/Commands.js +++ b/binaries/data/mods/public/simulation/helpers/Commands.js @@ -1341,7 +1341,7 @@ function TryConstructWall(player, cmpPlayer, controlAllUnits, cmd) } lastTowerControlGroup = cmpSnappedStartObstruction.GetControlGroup(); - //warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); + // warn("setting lastTowerControlGroup to control group of start snapped entity " + cmd.startSnappedEntity + ": " + lastTowerControlGroup); } var i = 0; @@ -1405,7 +1405,7 @@ function TryConstructWall(player, cmpPlayer, controlAllUnits, cmd) if (i > 0) { - //warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); + // warn(" updating previous wall piece's secondary control group to " + newTowerControlGroup); var cmpPreviousObstruction = Engine.QueryInterface(pieces[i-1].ent, IID_Obstruction); // TODO: ensure that cmpPreviousObstruction exists // TODO: ensure that the previous obstruction does not yet have a secondary control group set diff --git a/binaries/data/mods/public/simulation/helpers/Walls.js b/binaries/data/mods/public/simulation/helpers/Walls.js index 85ef07bdc2..4a349b55ea 100644 --- a/binaries/data/mods/public/simulation/helpers/Walls.js +++ b/binaries/data/mods/public/simulation/helpers/Walls.js @@ -191,7 +191,7 @@ function GetWallSegmentsRec(d, candidateSegments, minOverlap, maxOverlap, t, dis if (r < rLowerBound) { // we've allocated too much wall length, pop the last segment and try the next - //warn("Distance so far exceeds target, trying next level"); + // warn("Distance so far exceeds target, trying next level"); segments.pop(); continue; }