From d5c2c992c6e817c8f05e5bec46c27d7fbc4db98b Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 30 May 2026 00:19:53 +0000 Subject: [PATCH 1/3] docs: add JSDoc to exported constant in `os/num-cpus/lib/main.js` The exported value `n` had no JSDoc block. Seven of eight sibling packages in `@stdlib/os` document the exported entity (88%), and four of the five constant-export siblings (`arch`, `byte-order`, `float-word-order`, `platform`; 80%) use the `@constant`/`@type` form. Adds the same form here (`@type {PositiveInteger}`) and consolidates the forward declaration in `// VARIABLES //` with the assignment in `// MAIN //` so the JSDoc sits on the declaration itself, matching the `arch` / `platform` pattern. Documentation-only; no behavior change. https://claude.ai/code/session_01Q2F7CFsfQVmmEfNU8MS1Nc --- lib/node_modules/@stdlib/os/num-cpus/lib/main.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/os/num-cpus/lib/main.js b/lib/node_modules/@stdlib/os/num-cpus/lib/main.js index 1d0f37b251fa..df8a4ff13e5d 100644 --- a/lib/node_modules/@stdlib/os/num-cpus/lib/main.js +++ b/lib/node_modules/@stdlib/os/num-cpus/lib/main.js @@ -23,11 +23,6 @@ var os = require( 'os' ); -// VARIABLES // - -var n; - - // FUNCTIONS // /** @@ -47,7 +42,13 @@ function numCPUs() { // MAIN // -n = numCPUs(); +/** +* Number of CPUs. +* +* @constant +* @type {PositiveInteger} +*/ +var n = numCPUs(); // EXPORTS // From 62b6f679cdb4c12d500e0921bc81dccd7f078d3d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 30 May 2026 04:22:38 +0000 Subject: [PATCH 2/3] fix: keep `var n` forward-declared to satisfy `vars-on-top` The previous commit moved `var n = numCPUs();` into `// MAIN //` so the JSDoc could sit directly on the declaration. With a `// FUNCTIONS //` block between `// VARIABLES //` and `// MAIN //`, that placement violates `vars-on-top` (a `var` declaration may not appear after a `function` declaration in the same scope), which the `Lint Changed Files` CI job correctly rejected. Restores the original `var n;` forward declaration in `// VARIABLES //` and the `n = numCPUs();` assignment in `// MAIN //`. Moves the `@constant @type {PositiveInteger}` JSDoc block onto the forward declaration, with `@private` added so the tag is consistent with the fact that the declaration's value at this point is `undefined` (the JSDoc describes what `n` becomes after `// MAIN //` runs, which is what `module.exports` ships). https://claude.ai/code/session_01Q2F7CFsfQVmmEfNU8MS1Nc --- .../@stdlib/os/num-cpus/lib/main.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/os/num-cpus/lib/main.js b/lib/node_modules/@stdlib/os/num-cpus/lib/main.js index df8a4ff13e5d..8ec74ab6775e 100644 --- a/lib/node_modules/@stdlib/os/num-cpus/lib/main.js +++ b/lib/node_modules/@stdlib/os/num-cpus/lib/main.js @@ -23,6 +23,18 @@ var os = require( 'os' ); +// VARIABLES // + +/** +* Number of CPUs. +* +* @private +* @constant +* @type {PositiveInteger} +*/ +var n; + + // FUNCTIONS // /** @@ -42,13 +54,7 @@ function numCPUs() { // MAIN // -/** -* Number of CPUs. -* -* @constant -* @type {PositiveInteger} -*/ -var n = numCPUs(); +n = numCPUs(); // EXPORTS // From a694ffb9639631b5d68a9a26d3cc0b623a0a6af2 Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 30 May 2026 03:10:56 -0700 Subject: [PATCH 3/3] refactor: move declaration Signed-off-by: Athan --- .../@stdlib/os/num-cpus/lib/main.js | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/os/num-cpus/lib/main.js b/lib/node_modules/@stdlib/os/num-cpus/lib/main.js index 8ec74ab6775e..17016f942f17 100644 --- a/lib/node_modules/@stdlib/os/num-cpus/lib/main.js +++ b/lib/node_modules/@stdlib/os/num-cpus/lib/main.js @@ -23,18 +23,6 @@ var os = require( 'os' ); -// VARIABLES // - -/** -* Number of CPUs. -* -* @private -* @constant -* @type {PositiveInteger} -*/ -var n; - - // FUNCTIONS // /** @@ -54,7 +42,13 @@ function numCPUs() { // MAIN // -n = numCPUs(); +/** +* Number of CPUs. +* +* @constant +* @type {PositiveInteger} +*/ +var n = numCPUs(); // eslint-disable-line vars-on-top // EXPORTS //