Skip to content

Switched to more correct JSDoc types for primitives#27430

Merged
EvanHahn merged 1 commit into
mainfrom
fix-jsdoc-types-with-primitives
Apr 16, 2026
Merged

Switched to more correct JSDoc types for primitives#27430
EvanHahn merged 1 commit into
mainfrom
fix-jsdoc-types-with-primitives

Conversation

@EvanHahn
Copy link
Copy Markdown
Contributor

no ref

This is a types-only change that should have no user impact.

This is, effectively, the whole diff:

-@param {String} foo
+@param {string} foo

String is less correct than string, and will not be supported by TypeScript in an upcoming version.

All I did was run sed on a bunch of files.

@github-actions github-actions Bot added the migration [pull request] Includes migration for review label Apr 16, 2026
@github-actions

This comment was marked as off-topic.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1016693e-c31b-40c4-b0ae-5c4804fe6acf

📥 Commits

Reviewing files that changed from the base of the PR and between bca3bad and 63ca4e4.

📒 Files selected for processing (79)
  • ghost/admin/app/utils/currency.js
  • ghost/admin/app/validators/mixins/password.js
  • ghost/core/core/boot.js
  • ghost/core/core/frontend/helpers/collection.js
  • ghost/core/core/frontend/helpers/get.js
  • ghost/core/core/frontend/helpers/has.js
  • ghost/core/core/frontend/services/data/entry-lookup.js
  • ghost/core/core/frontend/services/data/fetch-data.js
  • ghost/core/core/frontend/services/rendering/templates.js
  • ghost/core/core/frontend/services/routing/collection-router.js
  • ghost/core/core/frontend/services/routing/middleware/page-param.js
  • ghost/core/core/frontend/services/routing/parent-router.js
  • ghost/core/core/frontend/services/routing/registry.js
  • ghost/core/core/frontend/services/sitemap/base-site-map-generator.js
  • ghost/core/core/frontend/services/theme-engine/i18n/i18n.js
  • ghost/core/core/frontend/services/theme-engine/i18n/theme-i18n.js
  • ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js
  • ghost/core/core/server/adapters/cache/MemoryCache.js
  • ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js
  • ghost/core/core/server/adapters/scheduling/scheduling-default.js
  • ghost/core/core/server/adapters/storage/LocalStorageBase.js
  • ghost/core/core/server/adapters/storage/utils.js
  • ghost/core/core/server/api/endpoints/utils/serializers/output/settings.js
  • ghost/core/core/server/data/importer/import-manager.js
  • ghost/core/core/server/data/importer/importers/content-file-importer.js
  • ghost/core/core/server/data/schema/commands.js
  • ghost/core/core/server/data/schema/fixtures/fixture-manager.js
  • ghost/core/core/server/ghost-server.js
  • ghost/core/core/server/lib/common/events.js
  • ghost/core/core/server/lib/validate-password.js
  • ghost/core/core/server/models/base/plugins/generate-slug.js
  • ghost/core/core/server/models/base/plugins/sanitize.js
  • ghost/core/core/server/models/comment.js
  • ghost/core/core/server/models/member.js
  • ghost/core/core/server/models/newsletter.js
  • ghost/core/core/server/models/post.js
  • ghost/core/core/server/models/role.js
  • ghost/core/core/server/models/user.js
  • ghost/core/core/server/services/adapter-manager/index.js
  • ghost/core/core/server/services/adapter-manager/options-resolver.js
  • ghost/core/core/server/services/custom-redirects/custom-redirects-api.js
  • ghost/core/core/server/services/custom-redirects/validation.js
  • ghost/core/core/server/services/email-analytics/email-analytics-provider-mailgun.js
  • ghost/core/core/server/services/lib/mailgun-client.js
  • ghost/core/core/server/services/link-redirection/link-redirect-repository.js
  • ghost/core/core/server/services/members/importer/members-csv-importer-stripe-utils.js
  • ghost/core/core/server/services/members/importer/members-csv-importer.js
  • ghost/core/core/server/services/members/members-api/repositories/member-repository.js
  • ghost/core/core/server/services/members/stats/members-stats.js
  • ghost/core/core/server/services/oembed/oembed-service.js
  • ghost/core/core/server/services/posts/post-email-handler.js
  • ghost/core/core/server/services/posts/post-scheduling-service.js
  • ghost/core/core/server/services/route-settings/default-settings-manager.js
  • ghost/core/core/server/services/route-settings/route-settings.js
  • ghost/core/core/server/services/route-settings/settings-loader.js
  • ghost/core/core/server/services/route-settings/settings-path-manager.js
  • ghost/core/core/server/services/route-settings/yaml-parser.js
  • ghost/core/core/server/services/settings/settings-bread-service.js
  • ghost/core/core/server/services/settings/settings-utils.js
  • ghost/core/core/server/services/themes/installer.js
  • ghost/core/core/server/services/themes/theme-storage.js
  • ghost/core/core/server/services/update-check/index.js
  • ghost/core/core/server/services/url/local-file-cache.js
  • ghost/core/core/server/services/url/resource.js
  • ghost/core/core/server/services/url/resources.js
  • ghost/core/core/server/services/url/url-generator.js
  • ghost/core/core/server/services/url/url-service.js
  • ghost/core/core/server/services/url/urls.js
  • ghost/core/core/server/web/api/middleware/upload.js
  • ghost/core/core/shared/express.js
  • ghost/core/test/unit/server/services/members/importer/members-csv-importer-stripe-utils.test.js
  • ghost/core/test/utils/agents/admin-api-test-agent.js
  • ghost/core/test/utils/agents/content-api-test-agent.js
  • ghost/core/test/utils/agents/ghost-api-test-agent.js
  • ghost/core/test/utils/agents/members-api-test-agent.js
  • ghost/core/test/utils/agents/test-agent.js
  • ghost/core/test/utils/db-utils.js
  • ghost/core/test/utils/e2e-framework.js
  • ghost/core/test/utils/e2e-utils.js
✅ Files skipped from review due to trivial changes (78)
  • ghost/core/core/server/models/base/plugins/generate-slug.js
  • ghost/core/core/server/api/endpoints/utils/serializers/output/settings.js
  • ghost/core/core/frontend/helpers/collection.js
  • ghost/core/core/frontend/services/rendering/templates.js
  • ghost/core/core/server/lib/common/events.js
  • ghost/core/core/server/models/base/plugins/sanitize.js
  • ghost/core/core/boot.js
  • ghost/admin/app/validators/mixins/password.js
  • ghost/core/core/server/services/route-settings/yaml-parser.js
  • ghost/core/core/server/services/lib/mailgun-client.js
  • ghost/core/core/server/services/posts/post-scheduling-service.js
  • ghost/core/core/server/services/url/resource.js
  • ghost/core/core/shared/express.js
  • ghost/core/core/server/models/comment.js
  • ghost/core/core/server/data/importer/importers/content-file-importer.js
  • ghost/core/core/frontend/services/data/entry-lookup.js
  • ghost/core/test/utils/e2e-utils.js
  • ghost/core/core/server/services/url/resources.js
  • ghost/core/test/utils/db-utils.js
  • ghost/core/core/server/services/themes/installer.js
  • ghost/core/core/server/adapters/cache/MemoryCache.js
  • ghost/core/core/frontend/services/routing/parent-router.js
  • ghost/core/core/server/services/route-settings/settings-path-manager.js
  • ghost/core/core/frontend/services/sitemap/base-site-map-generator.js
  • ghost/core/core/frontend/services/theme-engine/i18n/theme-i18n.js
  • ghost/core/core/frontend/helpers/has.js
  • ghost/core/core/server/services/route-settings/settings-loader.js
  • ghost/core/core/server/models/member.js
  • ghost/core/core/server/models/user.js
  • ghost/core/core/server/services/adapter-manager/index.js
  • ghost/core/core/frontend/services/theme-engine/i18n/i18n.js
  • ghost/core/core/frontend/services/data/fetch-data.js
  • ghost/core/core/server/data/schema/fixtures/fixture-manager.js
  • ghost/core/core/server/models/newsletter.js
  • ghost/core/core/frontend/services/routing/collection-router.js
  • ghost/core/test/utils/agents/members-api-test-agent.js
  • ghost/core/core/server/services/posts/post-email-handler.js
  • ghost/core/core/server/services/route-settings/route-settings.js
  • ghost/core/test/utils/agents/test-agent.js
  • ghost/core/core/server/models/post.js
  • ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js
  • ghost/core/test/utils/agents/content-api-test-agent.js
  • ghost/core/core/server/services/adapter-manager/options-resolver.js
  • ghost/core/core/server/services/custom-redirects/validation.js
  • ghost/core/core/server/services/url/url-service.js
  • ghost/core/core/frontend/services/routing/registry.js
  • ghost/core/test/unit/server/services/members/importer/members-csv-importer-stripe-utils.test.js
  • ghost/core/test/utils/agents/ghost-api-test-agent.js
  • ghost/core/test/utils/agents/admin-api-test-agent.js
  • ghost/admin/app/utils/currency.js
  • ghost/core/core/server/services/url/url-generator.js
  • ghost/core/core/server/adapters/storage/LocalStorageBase.js
  • ghost/core/core/server/services/oembed/oembed-service.js
  • ghost/core/core/server/services/route-settings/default-settings-manager.js
  • ghost/core/core/server/services/url/urls.js
  • ghost/core/core/server/services/members/stats/members-stats.js
  • ghost/core/core/server/services/members/importer/members-csv-importer-stripe-utils.js
  • ghost/core/core/server/data/importer/import-manager.js
  • ghost/core/core/server/services/url/local-file-cache.js
  • ghost/core/core/server/web/api/middleware/upload.js
  • ghost/core/core/server/services/update-check/index.js
  • ghost/core/core/server/data/schema/commands.js
  • ghost/core/test/utils/e2e-framework.js
  • ghost/core/core/server/services/settings/settings-utils.js
  • ghost/core/core/server/services/members/members-api/repositories/member-repository.js
  • ghost/core/core/server/services/settings/settings-bread-service.js
  • ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js
  • ghost/core/core/server/ghost-server.js
  • ghost/core/core/server/adapters/storage/utils.js
  • ghost/core/core/server/models/role.js
  • ghost/core/core/server/services/link-redirection/link-redirect-repository.js
  • ghost/core/core/frontend/helpers/get.js
  • ghost/core/core/server/services/custom-redirects/custom-redirects-api.js
  • ghost/core/core/server/lib/validate-password.js
  • ghost/core/core/server/services/email-analytics/email-analytics-provider-mailgun.js
  • ghost/core/core/server/adapters/scheduling/scheduling-default.js
  • ghost/core/core/server/services/members/importer/members-csv-importer.js
  • ghost/core/core/server/services/themes/theme-storage.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • ghost/core/core/frontend/services/routing/middleware/page-param.js

Walkthrough

This pull request standardizes JSDoc annotations across the codebase by replacing boxed type identifiers (String, Number, Boolean) with JavaScript primitive lowercase names (string, number, boolean). Changes are limited to comment blocks for parameters, returns, typedefs, and private fields in many admin, core, and test files. No executable code, control flow, runtime behavior, or exported API signatures were modified.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: converting JSDoc types from capitalized primitive names (String, Number, Boolean) to lowercase primitives (string, number, boolean).
Description check ✅ Passed The description is directly related to the changeset, explaining the types-only changes, the sed transformation pattern, and referencing TypeScript compatibility concerns as the rationale.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-jsdoc-types-with-primitives

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EvanHahn EvanHahn removed the migration [pull request] Includes migration for review label Apr 16, 2026
@EvanHahn
Copy link
Copy Markdown
Contributor Author

This patch does not contain a migration.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
ghost/core/core/server/adapters/cache/MemoryCache.js (1)

29-29: ⚠️ Potential issue | 🟡 Minor

Inconsistent primitive type in return annotation.

Line 29 still uses Array<String> but should use Array<string> to be consistent with the PR's objective of replacing capitalized primitive types with lowercase equivalents.

📝 Proposed fix
-     * `@returns` {Array<String>} all keys present in the cache
+     * `@returns` {Array<string>} all keys present in the cache
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/adapters/cache/MemoryCache.js` at line 29, Update the
JSDoc return type for the keys-returning method in MemoryCache.js: replace the
capitalized primitive Array<String> with the lowercase Array<string> in the
`@returns` annotation so it matches the PR's primitive-type convention; locate the
JSDoc above the method (look for the comment containing "@returns
{Array<String>} all keys present in the cache") and change that type token to
"{Array<string>}".
ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js (1)

47-47: ⚠️ Potential issue | 🟡 Minor

Inconsistent primitive type in return annotation.

Line 47 still uses Array<String> but should use Array<string> to be consistent with the PR's objective of replacing capitalized primitive types with lowercase equivalents.

📝 Proposed fix
-     * `@returns` {Array<String>} all keys present in the cache
+     * `@returns` {Array<string>} all keys present in the cache
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js` at line 47,
The JSDoc return annotation in the AdapterCacheMemoryTTL class uses the
capitalized primitive type Array<String>; update the annotation to use the
lowercase primitive form Array<string> (e.g., in the JSDoc for the method that
documents "@returns {Array<String>} all keys present in the cache") so the
return type becomes "@returns {Array<string>} all keys present in the cache" to
match the PR's primitive-type conventions.
ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js (1)

274-274: ⚠️ Potential issue | 🟡 Minor

Inconsistent primitive type in return annotation.

Line 274 still uses Array<String> but should use Array<string> to be consistent with the PR's objective of replacing capitalized primitive types with lowercase equivalents.

📝 Proposed fix
-     * `@returns` {Promise<Array<String>>} all keys present in the cache
+     * `@returns` {Promise<Array<string>>} all keys present in the cache
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js` at line 274,
Update the JSDoc return type in AdapterCacheRedis: replace the capitalized
primitive Array<String> with the lowercase Array<string> in the `@returns`
annotation for the method that returns all cache keys (the comment reading
"@returns {Promise<Array<String>>} all keys present in the cache") so the return
type is consistent with the project's lowercase primitive style.
ghost/core/core/server/data/importer/import-manager.js (1)

141-142: ⚠️ Potential issue | 🟡 Minor

Incomplete migration of capitalized primitive types.

Several JSDoc annotations still use capitalized String for return types and array element types, while the PR aims to replace all capitalized primitives with lowercase forms. For consistency, these should also be changed:

  • Line 141: @param {String[]} items@param {string[]} items
  • Line 142: @returns {String}@returns {string}
  • Line 151: @param {String[]} extensions@param {string[]} extensions
  • Line 153: @returns {String}@returns {string}
  • Line 164: @param {String[]} directories@param {string[]} directories
  • Line 166: @returns {String}@returns {string}
  • Line 271: @returns {String}@returns {string}
📝 Proposed fix to complete the primitive type migration
 /**
  * Convert items into a glob string
- * `@param` {String[]} items
- * `@returns` {String}
+ * `@param` {string[]} items
+ * `@returns` {string}
  */
 getGlobPattern(items) {

 /**
- * `@param` {String[]} extensions
+ * `@param` {string[]} extensions
  * `@param` {number} [level]
- * `@returns` {String}
+ * `@returns` {string}
  */
 getExtensionGlob(extensions, level) {

 /**
  *
- * `@param` {String[]} directories
+ * `@param` {string[]} directories
  * `@param` {number} [level]
- * `@returns` {String}
+ * `@returns` {string}
  */
 getDirectoryGlob(directories, level) {

 /**
  * Get the name of the single base directory if there is one, else return an empty string
  * `@param` {string} directory
- * `@returns` {String}
+ * `@returns` {string}
  */
 getBaseDirectory(directory) {

Also applies to: 151-153, 164-166, 271-271

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/data/importer/import-manager.js` around lines 141 -
142, Update the JSDoc annotations in import-manager.js to use lowercase
primitive types: replace all occurrences of {String[]} with {string[]} for the
parameters named items, extensions, and directories, and replace all occurrences
of {String} with {string} for the corresponding `@returns` annotations (affecting
the docs around the functions that accept items, extensions, directories and the
return at line 271); ensure the param tags for items, extensions, directories
and their associated `@returns` tags are updated consistently to lowercase
`string` forms.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ghost/core/core/server/adapters/storage/LocalStorageBase.js`:
- Around line 277-281: The JSDoc above the async delete(...) method is using the
wrong param name (documents filePath) which mismatches the function signature
delete(fileName, targetDir); update the JSDoc to list the correct parameters
(e.g., `@param` {string} fileName and `@param` {string} [targetDir] or appropriate
type for targetDir) and keep the `@returns` as Promise.<*> to match the method's
return type so tooling and readers see the correct parameter names for the
delete function.

In `@ghost/core/core/server/adapters/storage/utils.js`:
- Line 59: Update the JSDoc `@returns` tag that still uses the uppercase primitive
"{Boolean}" to the lowercase "{boolean}" to match the earlier "{string}" change;
locate the JSDoc block where the previous line's type was changed from
"{String}" to "{string}" (the same comment block with the `@returns` tag) and
replace "{Boolean}" with "{boolean}" so all primitive types use lowercase.
- Line 43: Update the JSDoc return type from the uppercase primitive to the
lowercase form: change the JSDoc tag that currently reads "{Boolean}" to
"{boolean}" in the JSDoc block in core/server/adapters/storage/utils.js (the
return annotation for the utility function documented on the preceding lines) so
it matches the updated primitive style used elsewhere.

In `@ghost/core/core/server/lib/common/events.js`:
- Around line 21-23: The JSDoc for the event registration function uses an
inconsistent return type casing; update the `@returns` tag in the JSDoc comment
(the line currently reading "@returns {Boolean}") to use the lowercase primitive
"@returns {boolean}" so it matches the other parameter types and standard JSDoc
conventions in events.js and the related event/listener functions.

In `@ghost/core/core/server/services/adapter-manager/options-resolver.js`:
- Line 8: Update the JSDoc return annotation in options-resolver.js to use
lowercase primitive types: replace the uppercase `String` in the `@returns` object
for `adapterClassName` with `string` so the return annotation reads
{{adapterClassName: string, adapterConfig: Object}} (leave non-primitive
`Object` as-is or adjust similarly if following the same casing convention) to
match the PR's lowercase primitive types policy.

In
`@ghost/core/core/server/services/members/importer/members-csv-importer-stripe-utils.js`:
- Line 188: Update the JSDoc for the stripePriceId parameter in
members-csv-importer-stripe-utils.js from {number} to {string}; specifically
change the `@param` annotation for stripePriceId so it reflects Stripe price IDs
as strings (they come from newStripePrice.id and
ghostProductPrice.get('stripe_price_id')), ensuring correct TypeScript/JSDoc
type inference for any functions that accept stripePriceId.

In `@ghost/core/core/server/services/oembed/oembed-service.js`:
- Line 149: Update the JSDoc `@returns` type in the oembed-service.js JSDoc block
from uppercase "String" to lowercase "string" to match the parameter types
already updated on the same docblock; edit the `@returns` line for the method
documented there so the return type is "string" for consistency.

In `@ghost/core/core/server/services/settings/settings-utils.js`:
- Line 13: Update the JSDoc primitive type annotations in settings-utils.js so
they use lowercase primitives: change the `@returns` {Boolean} annotation to
`@returns` {boolean} and any `@type/`@param/@returns occurrences that use {String}
to {string} (the comment referenced around line 39). Locate the JSDoc blocks in
the file (the one with `@returns` {Boolean} and the one around line 39) and
replace the capitalized primitive types with the lowercase equivalents to match
the rest of the file.

In `@ghost/core/core/server/web/api/middleware/upload.js`:
- Line 171: Replace the primitive-type `String` in JSDoc `@returns` annotations
with lowercase `string` so the signatures read `@returns {Promise<string |
null>}` (and similarly for the other two occurrences that currently use
`String`) to match the `@param` annotations and complete the primitive-type
migration.

In `@ghost/core/test/utils/db-utils.js`:
- Line 43: Fix the JSDoc typo in the db-utils.js comment: update the description
for the options.truncate parameter (currently reads "whether to truncate rather
thann fully reset") to correct "thann" to "than" so it reads "whether to
truncate rather than fully reset" in the JSDoc block near the options.truncate
documentation.

---

Outside diff comments:
In `@ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js`:
- Line 47: The JSDoc return annotation in the AdapterCacheMemoryTTL class uses
the capitalized primitive type Array<String>; update the annotation to use the
lowercase primitive form Array<string> (e.g., in the JSDoc for the method that
documents "@returns {Array<String>} all keys present in the cache") so the
return type becomes "@returns {Array<string>} all keys present in the cache" to
match the PR's primitive-type conventions.

In `@ghost/core/core/server/adapters/cache/MemoryCache.js`:
- Line 29: Update the JSDoc return type for the keys-returning method in
MemoryCache.js: replace the capitalized primitive Array<String> with the
lowercase Array<string> in the `@returns` annotation so it matches the PR's
primitive-type convention; locate the JSDoc above the method (look for the
comment containing "@returns {Array<String>} all keys present in the cache") and
change that type token to "{Array<string>}".

In `@ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js`:
- Line 274: Update the JSDoc return type in AdapterCacheRedis: replace the
capitalized primitive Array<String> with the lowercase Array<string> in the
`@returns` annotation for the method that returns all cache keys (the comment
reading "@returns {Promise<Array<String>>} all keys present in the cache") so
the return type is consistent with the project's lowercase primitive style.

In `@ghost/core/core/server/data/importer/import-manager.js`:
- Around line 141-142: Update the JSDoc annotations in import-manager.js to use
lowercase primitive types: replace all occurrences of {String[]} with {string[]}
for the parameters named items, extensions, and directories, and replace all
occurrences of {String} with {string} for the corresponding `@returns` annotations
(affecting the docs around the functions that accept items, extensions,
directories and the return at line 271); ensure the param tags for items,
extensions, directories and their associated `@returns` tags are updated
consistently to lowercase `string` forms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: caf33018-5d08-467f-bfa5-cc3b1d08a765

📥 Commits

Reviewing files that changed from the base of the PR and between 434af39 and bca3bad.

📒 Files selected for processing (77)
  • ghost/admin/app/utils/currency.js
  • ghost/admin/app/validators/mixins/password.js
  • ghost/core/core/boot.js
  • ghost/core/core/frontend/helpers/collection.js
  • ghost/core/core/frontend/helpers/get.js
  • ghost/core/core/frontend/helpers/has.js
  • ghost/core/core/frontend/services/data/entry-lookup.js
  • ghost/core/core/frontend/services/data/fetch-data.js
  • ghost/core/core/frontend/services/rendering/templates.js
  • ghost/core/core/frontend/services/routing/middleware/page-param.js
  • ghost/core/core/frontend/services/routing/parent-router.js
  • ghost/core/core/frontend/services/routing/registry.js
  • ghost/core/core/frontend/services/sitemap/base-site-map-generator.js
  • ghost/core/core/frontend/services/theme-engine/i18n/i18n.js
  • ghost/core/core/frontend/services/theme-engine/i18n/theme-i18n.js
  • ghost/core/core/server/adapters/cache/AdapterCacheMemoryTTL.js
  • ghost/core/core/server/adapters/cache/MemoryCache.js
  • ghost/core/core/server/adapters/lib/redis/AdapterCacheRedis.js
  • ghost/core/core/server/adapters/scheduling/scheduling-default.js
  • ghost/core/core/server/adapters/storage/LocalStorageBase.js
  • ghost/core/core/server/adapters/storage/utils.js
  • ghost/core/core/server/api/endpoints/utils/serializers/output/settings.js
  • ghost/core/core/server/data/importer/import-manager.js
  • ghost/core/core/server/data/importer/importers/content-file-importer.js
  • ghost/core/core/server/data/schema/commands.js
  • ghost/core/core/server/data/schema/fixtures/fixture-manager.js
  • ghost/core/core/server/ghost-server.js
  • ghost/core/core/server/lib/common/events.js
  • ghost/core/core/server/lib/validate-password.js
  • ghost/core/core/server/models/base/plugins/generate-slug.js
  • ghost/core/core/server/models/base/plugins/sanitize.js
  • ghost/core/core/server/models/comment.js
  • ghost/core/core/server/models/member.js
  • ghost/core/core/server/models/newsletter.js
  • ghost/core/core/server/models/post.js
  • ghost/core/core/server/models/role.js
  • ghost/core/core/server/models/user.js
  • ghost/core/core/server/services/adapter-manager/index.js
  • ghost/core/core/server/services/adapter-manager/options-resolver.js
  • ghost/core/core/server/services/custom-redirects/custom-redirects-api.js
  • ghost/core/core/server/services/custom-redirects/validation.js
  • ghost/core/core/server/services/email-analytics/email-analytics-provider-mailgun.js
  • ghost/core/core/server/services/lib/mailgun-client.js
  • ghost/core/core/server/services/link-redirection/link-redirect-repository.js
  • ghost/core/core/server/services/members/importer/members-csv-importer-stripe-utils.js
  • ghost/core/core/server/services/members/importer/members-csv-importer.js
  • ghost/core/core/server/services/members/members-api/repositories/member-repository.js
  • ghost/core/core/server/services/members/stats/members-stats.js
  • ghost/core/core/server/services/oembed/oembed-service.js
  • ghost/core/core/server/services/posts/post-email-handler.js
  • ghost/core/core/server/services/posts/post-scheduling-service.js
  • ghost/core/core/server/services/route-settings/default-settings-manager.js
  • ghost/core/core/server/services/route-settings/route-settings.js
  • ghost/core/core/server/services/route-settings/settings-loader.js
  • ghost/core/core/server/services/route-settings/settings-path-manager.js
  • ghost/core/core/server/services/route-settings/yaml-parser.js
  • ghost/core/core/server/services/settings/settings-bread-service.js
  • ghost/core/core/server/services/settings/settings-utils.js
  • ghost/core/core/server/services/themes/installer.js
  • ghost/core/core/server/services/themes/theme-storage.js
  • ghost/core/core/server/services/update-check/index.js
  • ghost/core/core/server/services/url/local-file-cache.js
  • ghost/core/core/server/services/url/resources.js
  • ghost/core/core/server/services/url/url-generator.js
  • ghost/core/core/server/services/url/url-service.js
  • ghost/core/core/server/services/url/urls.js
  • ghost/core/core/server/web/api/middleware/upload.js
  • ghost/core/core/shared/express.js
  • ghost/core/test/unit/server/services/members/importer/members-csv-importer-stripe-utils.test.js
  • ghost/core/test/utils/agents/admin-api-test-agent.js
  • ghost/core/test/utils/agents/content-api-test-agent.js
  • ghost/core/test/utils/agents/ghost-api-test-agent.js
  • ghost/core/test/utils/agents/members-api-test-agent.js
  • ghost/core/test/utils/agents/test-agent.js
  • ghost/core/test/utils/db-utils.js
  • ghost/core/test/utils/e2e-framework.js
  • ghost/core/test/utils/e2e-utils.js

Comment on lines 277 to 281
/**
* @param {String} filePath
* @param {string} filePath
* @returns {Promise.<*>}
*/
async delete(fileName, targetDir) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix JSDoc param name mismatch for delete.

Line 278 documents filePath, but the method signature is delete(fileName, targetDir). This can mislead tooling and readers.

Suggested doc fix
 /**
- * `@param` {string} filePath
+ * `@param` {string} fileName
+ * `@param` {string} [targetDir]
  * `@returns` {Promise.<*>}
  */
 async delete(fileName, targetDir) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* @param {String} filePath
* @param {string} filePath
* @returns {Promise.<*>}
*/
async delete(fileName, targetDir) {
/**
* `@param` {string} fileName
* `@param` {string} [targetDir]
* `@returns` {Promise.<*>}
*/
async delete(fileName, targetDir) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/adapters/storage/LocalStorageBase.js` around lines 277
- 281, The JSDoc above the async delete(...) method is using the wrong param
name (documents filePath) which mismatches the function signature
delete(fileName, targetDir); update the JSDoc to list the correct parameters
(e.g., `@param` {string} fileName and `@param` {string} [targetDir] or appropriate
type for targetDir) and keep the `@returns` as Promise.<*> to match the method's
return type so tooling and readers see the correct parameter names for the
delete function.

Comment thread ghost/core/core/server/adapters/storage/utils.js Outdated
Comment thread ghost/core/core/server/adapters/storage/utils.js Outdated
Comment thread ghost/core/core/server/lib/common/events.js Outdated
* @param {string} name
* @param {Object} adapterServiceConfig
*
* @returns {{adapterClassName: String, adapterConfig: Object}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent JSDoc type casing in return annotation.

The return type annotation still uses uppercase String for the adapterClassName property. This is inconsistent with the PR's objective to replace all uppercase primitive types with lowercase equivalents.

📝 Proposed fix
- * `@returns` {{adapterClassName: String, adapterConfig: Object}} 
+ * `@returns` {{adapterClassName: string, adapterConfig: Object}} 
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @returns {{adapterClassName: String, adapterConfig: Object}}
* `@returns` {{adapterClassName: string, adapterConfig: Object}}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/services/adapter-manager/options-resolver.js` at line
8, Update the JSDoc return annotation in options-resolver.js to use lowercase
primitive types: replace the uppercase `String` in the `@returns` object for
`adapterClassName` with `string` so the return annotation reads
{{adapterClassName: string, adapterConfig: Object}} (leave non-primitive
`Object` as-is or adjust similarly if following the same casing convention) to
match the PR's lowercase primitive types policy.

* Archive a price in Stripe
*
* @param {Number} stripePriceId
* @param {number} stripePriceId
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, check if the file exists and read the relevant section
cat -n ghost/core/core/server/services/members/importer/members-csv-importer-stripe-utils.js | sed -n '180,200p'

Repository: TryGhost/Ghost

Length of output: 492


🏁 Script executed:

# Search for stripePriceId usage and how it's passed/received
rg -A 5 -B 5 "stripePriceId" ghost/core/core/server/services/members/importer/members-csv-importer-stripe-utils.js

Repository: TryGhost/Ghost

Length of output: 1877


🏁 Script executed:

# Search for Stripe price patterns to understand typical types
rg "price_" ghost/core/core/server/services/members/importer/ | head -20

Repository: TryGhost/Ghost

Length of output: 213


stripePriceId JSDoc type should be {string}, not {number}.

Stripe price IDs are strings (format: price_...). The parameter is assigned from newStripePrice.id (Stripe API response) and ghostProductPrice.get('stripe_price_id') (database field), both of which are strings. The incorrect type annotation causes incorrect TypeScript/JSDoc type inference.

Suggested fix
-     * `@param` {number} stripePriceId
+     * `@param` {string} stripePriceId
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param {number} stripePriceId
* `@param` {string} stripePriceId
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@ghost/core/core/server/services/members/importer/members-csv-importer-stripe-utils.js`
at line 188, Update the JSDoc for the stripePriceId parameter in
members-csv-importer-stripe-utils.js from {number} to {string}; specifically
change the `@param` annotation for stripePriceId so it reflects Stripe price IDs
as strings (they come from newStripePrice.id and
ghostProductPrice.get('stripe_price_id')), ensuring correct TypeScript/JSDoc
type inference for any functions that accept stripePriceId.

* @param {String} imageType - What is the image used for. Example - icon, thumbnail
* @param {string} imageUrl - URL of the image to process
* @param {string} imageType - What is the image used for. Example - icon, thumbnail
* @returns {Promise<String>} - URL where the image is stored
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent JSDoc type on return value.

The return type still uses uppercase String while the parameter types on lines 147-148 were correctly updated to lowercase string. This should be updated for consistency with the PR's objective.

📝 Proposed fix
-     * `@returns` {Promise<String>} - URL where the image is stored
+     * `@returns` {Promise<string>} - URL where the image is stored
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @returns {Promise<String>} - URL where the image is stored
* `@returns` {Promise<string>} - URL where the image is stored
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/services/oembed/oembed-service.js` at line 149, Update
the JSDoc `@returns` type in the oembed-service.js JSDoc block from uppercase
"String" to lowercase "string" to match the parameter types already updated on
the same docblock; edit the `@returns` line for the method documented there so the
return type is "string" for consistency.

Comment thread ghost/core/core/server/services/settings/settings-utils.js Outdated
*
* @param {String} filepath
* @param {string} filepath
* @returns {Promise<String | null>}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read-only verification: find remaining wrapper primitive JSDoc types in JS/TS files.
rg -nP --type-add 'jsall:*.{js,jsx,ts,tsx}' --type jsall \
'@(?:param|returns?)\s*\{[^}]*\b(String|Number|Boolean)\b[^}]*\}'

Repository: TryGhost/Ghost

Length of output: 7354


🏁 Script executed:

cat -n ghost/core/core/server/web/api/middleware/upload.js | sed -n '165,230p'

Repository: TryGhost/Ghost

Length of output: 2268


Finish the primitive-type migration in @returns annotations.

@returns still uses String in three places on lines 171, 197, and 223; this is inconsistent with the PR objective and with lowercase string used in @param annotations elsewhere in the same file.

Suggested fixes
- * `@returns` {Promise<String | null>}
+ * `@returns` {Promise<string | null>}
- * `@returns` {String | null}
+ * `@returns` {string | null>}
- * `@returns` {Promise<String | null>}
+ * `@returns` {Promise<string | null>}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/core/server/web/api/middleware/upload.js` at line 171, Replace the
primitive-type `String` in JSDoc `@returns` annotations with lowercase `string`
so the signatures read `@returns {Promise<string | null>}` (and similarly for
the other two occurrences that currently use `String`) to match the `@param`
annotations and complete the primitive-type migration.

*
* @param {Object} options
* @param {Boolean} options.truncate whether to truncate rather thann fully reset
* @param {boolean} options.truncate whether to truncate rather thann fully reset
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix typo in JSDoc description (Line 43).

thann should be than in the options.truncate description.

✏️ Suggested patch
- * `@param` {boolean} options.truncate whether to truncate rather thann fully reset
+ * `@param` {boolean} options.truncate whether to truncate rather than fully reset
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* @param {boolean} options.truncate whether to truncate rather thann fully reset
* `@param` {boolean} options.truncate whether to truncate rather than fully reset
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ghost/core/test/utils/db-utils.js` at line 43, Fix the JSDoc typo in the
db-utils.js comment: update the description for the options.truncate parameter
(currently reads "whether to truncate rather thann fully reset") to correct
"thann" to "than" so it reads "whether to truncate rather than fully reset" in
the JSDoc block near the options.truncate documentation.

no ref

This is a types-only change that should have no user impact.

This is, effectively, the whole diff:

```diff
-@param {String} foo
+@param {string} foo
```

`String` is less correct than `string`, and [will not be supported by
TypeScript in an upcoming version][0].

All I did was run `sed` on a bunch of files.

[0]: https://devblogs.microsoft.com/typescript/progress-on-typescript-7-december-2025/#javascript-checking-and-jsdoc-compatibility
@EvanHahn EvanHahn force-pushed the fix-jsdoc-types-with-primitives branch from bca3bad to 63ca4e4 Compare April 16, 2026 15:03
@sonarqubecloud
Copy link
Copy Markdown

@EvanHahn
Copy link
Copy Markdown
Contributor Author

EvanHahn commented Apr 16, 2026 via email

@EvanHahn EvanHahn enabled auto-merge (squash) April 16, 2026 15:48
@EvanHahn EvanHahn merged commit 8e77a86 into main Apr 16, 2026
81 of 83 checks passed
@EvanHahn EvanHahn deleted the fix-jsdoc-types-with-primitives branch April 16, 2026 15:58
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 93.80531% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.43%. Comparing base (aec99f7) to head (63ca4e4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ore/server/adapters/lib/redis/AdapterCacheRedis.js 0.00% 10 Missing ⚠️
...ore/server/adapters/cache/AdapterCacheMemoryTTL.js 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #27430   +/-   ##
=======================================
  Coverage   73.43%   73.43%           
=======================================
  Files        1553     1553           
  Lines      124901   124901           
  Branches    15096    15096           
=======================================
+ Hits        91721    91723    +2     
+ Misses      32174    32173    -1     
+ Partials     1006     1005    -1     
Flag Coverage Δ
admin-tests 54.38% <ø> (+0.01%) ⬆️
e2e-tests 73.43% <93.80%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

franky19 pushed a commit to franky19/Ghost that referenced this pull request Apr 18, 2026
no ref

This is a types-only change that should have no user impact.

This is, effectively, the whole diff:

```diff
-@param {String} foo
+@param {string} foo
```

`String` is less correct than `string`, and [will not be supported by
TypeScript in an upcoming version][0].

All I did was run `sed` on a bunch of files.

[0]: https://devblogs.microsoft.com/typescript/progress-on-typescript-7-december-2025/#javascript-checking-and-jsdoc-compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant