fix(ci): resolve latent PHPCS + JS lint failures

Latent debt surfaced by the reusable PHPCS job (previously continue-on-error).

PHPCS fixes (all pre-existing, not introduced by this PR):
- Add @package PeptideReconstitutionCalculator to file docblocks in all 12 PHP
  files (previously missing; phpcbf cannot insert missing docblock tags).
- Replace two short-ternary ?: operators in class-prc-preset-provider.php with
  full ternary (Universal.Operators.DisallowShortTernary.Found; lines 136+152).

JS lint fix:
- Add package.json + package-lock.json (no deps; lint script = node --check)
  so the reusable lint-js job's npm ci / cache: npm steps succeed. The
  calculator ships vanilla JS with no build toolchain — package.json is the
  minimal stub the reusable workflow requires for has_js: true.

Agent-Session: claude/adopt-ci-20260616
This commit is contained in:
peptiderepo
2026-06-16 15:24:19 +00:00
parent 73cd2df294
commit 8e1405d5a5
14 changed files with 36 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
* @see class-prc-preset-provider.php — Data source for presets.
* @see class-prc-math.php — Calculation engine.
* @see class-prc-shortcode.php — Frontend JS consumes these endpoints.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -5,6 +5,7 @@
* What: Runs on plugin activation — flushes rewrite rules.
* Who calls it: register_activation_hook in bootstrap.
* Dependencies: None.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -7,6 +7,7 @@
* Dependencies: None.
*
* @see class-pr-core-autoloader.php in Peptide Repo Core — same pattern.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -9,6 +9,7 @@
*
* @see class-prc-preset-provider.php — Cache being invalidated.
* @see PR_Core_Dosing_Repository — Fires the hooks we listen to.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -9,6 +9,7 @@
* @see class-prc-shortcode.php — Frontend calculator widget.
* @see class-prc-rest-controller.php — REST endpoints for presets.
* @see class-prc-preset-provider.php — PR Core integration + fallback defaults.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -5,6 +5,7 @@
* What: Runs on plugin deactivation — flushes rewrite rules.
* Who calls it: register_deactivation_hook in bootstrap.
* Dependencies: None.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -8,6 +8,7 @@
* Dependencies: None.
*
* @see class-prc-preset-provider.php — Merges these with live PR Core data.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -10,6 +10,7 @@
*
* @see assets/js/calculator.js — Client-side mirror of this math.
* @see api/class-prc-rest-controller.php — Server-side consumer.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);

View File

@@ -12,6 +12,7 @@
* @see class-prc-default-presets.php — Hardcoded fallback presets.
* @see PR_Core_Peptide_Repository (PR Core) — Peptide list source.
* @see PR_Core_Dosing_Repository (PR Core) — Dosing data source.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);
@@ -133,7 +134,7 @@ class PRC_Preset_Provider {
// Extract dose range across all rows.
$dose_mins = array_filter( array_map( fn( $r ) => $r->dose_min, $rows ) );
$dose_maxs = array_filter( array_map( fn( $r ) => $r->dose_max, $rows ) );
$dose_unit = $rows[0]->dose_unit ?: 'mcg';
$dose_unit = ! empty( $rows[0]->dose_unit ) ? $rows[0]->dose_unit : 'mcg';
// Derive typical vial sizes from dose range.
// Why: Most peptides are sold in standard vial sizes (2mg, 5mg, 10mg, 15mg, 30mg).
@@ -149,7 +150,7 @@ class PRC_Preset_Provider {
return array(
'slug' => $peptide->slug,
'name' => $display_name ?: $peptide->title,
'name' => ! empty( $display_name ) ? $display_name : $peptide->title,
'vial_sizes_mg' => $vial_sizes,
'default_vial_mg' => $vial_sizes[0] ?? 5,
'recommended_water_ml' => $this->recommend_water_ml( $vial_sizes[0] ?? 5 ),

View File

@@ -10,6 +10,7 @@
* @see assets/js/calculator.js — Client-side calculator logic.
* @see assets/css/calculator.css — Calculator styles.
* @see class-prc-calculator.php — Boot orchestrator.
* @package PeptideReconstitutionCalculator
*/
declare(strict_types=1);