Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor syntax issues with JSDoc #30445

Open
PoseidonEnergy opened this issue Feb 2, 2025 · 1 comment
Open

Minor syntax issues with JSDoc #30445

PoseidonEnergy opened this issue Feb 2, 2025 · 1 comment

Comments

@PoseidonEnergy
Copy link
Contributor

PoseidonEnergy commented Feb 2, 2025

Description

I just want to highlight some minor things that are showing up as errors with my IDE (JetBrains Rider) with the new JSDoc annotations.

Primitive types shouldn't be capitalized:

  1. {String} should be {string}
  2. {Boolean} should be {boolean}
  3. {Number} should be {number}
  4. {Any} should be {any}

The question mark ? to denote a nullable type should come before the type, not after.

For example: {MyType?} should be {?MyType} (see https://jsdoc.app/tags-type)

Image

Example of invalid JSDoc syntax in src/nodes/core/Node.js:

/**
* The cache key of this node.
*
* @private
* @type {Number?}
* @default null
*/
this._cacheKey = null;

Screenshot of IDE error (JetBrains Rider):

Image

Version

173

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 2, 2025

Primitive types shouldn't be capitalized:

I thought that shouldn't matter. In any event, that should be an easy fix via search/replace.

The nullable thing is more tricky. Since there are about 600 places where ? is used, we need a small script that processes all core and addon files and moves ? at the beginning.

The regex for detecting the Strings in question should be something like {.*?\?}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants