-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Is JSDoc case sensitive? #1046
Comments
JSDoc doesn't care. It's up to the user's preference. I tend to use lowercase for primitive types (and In the future, please send this sort of question to the jsdoc-users mailing list. Thanks! |
From TypeScript's do's and don'ts:[0] Don’t ever use the types Number, String, Boolean, or Object. These types refer to non-primitive boxed objects that are almost never used appropriately in JavaScript code. Although Minerva only uses JSDocs at this time which seemingly doesn't care about casing[1], we should endeavor to use the proper return types. This patch lowercases typing to indicate primitive / boxed type as appropriate.[2] As a special case, function types are uppercased for compatibility with TypeScript type checking. Also, JQuery types are of type "JQuery". The global JQuery object's identifier is "jQuery". This patch uppercases J's where appropriate. Lastly, replace unsupported type "Integer" with "number" and a comment. [0] https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#general-types [1] jsdoc/jsdoc#1046 (comment) [2] find resources tests -iname \*.js| xargs -rd\\n sed -ri ' s%\{\s*(number|string|boolean|object|null|undefined)%{\L\1%gi; s%\{\s*function%{Function%g; s%\{\s*jquery%{JQuery%gi; s%\{\s*integer\s*\}%{number} An integer.%gi ' Change-Id: I6cbac15940e4501aee7ede8f421b77ffd027170d
* Update MinervaNeue from branch 'master' to d5ae9915223ac70a78af7cdbd981ef6d69161e8e - Merge "Hygiene: update JSDoc boxed and JQuery types" - Hygiene: update JSDoc boxed and JQuery types From TypeScript's do's and don'ts:[0] Don’t ever use the types Number, String, Boolean, or Object. These types refer to non-primitive boxed objects that are almost never used appropriately in JavaScript code. Although Minerva only uses JSDocs at this time which seemingly doesn't care about casing[1], we should endeavor to use the proper return types. This patch lowercases typing to indicate primitive / boxed type as appropriate.[2] As a special case, function types are uppercased for compatibility with TypeScript type checking. Also, JQuery types are of type "JQuery". The global JQuery object's identifier is "jQuery". This patch uppercases J's where appropriate. Lastly, replace unsupported type "Integer" with "number" and a comment. [0] https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#general-types [1] jsdoc/jsdoc#1046 (comment) [2] find resources tests -iname \*.js| xargs -rd\\n sed -ri ' s%\{\s*(number|string|boolean|object|null|undefined)%{\L\1%gi; s%\{\s*function%{Function%g; s%\{\s*jquery%{JQuery%gi; s%\{\s*integer\s*\}%{number} An integer.%gi ' Change-Id: I6cbac15940e4501aee7ede8f421b77ffd027170d
Although Popups only uses JSDocs at this time which seemingly doesn't care about casing[1], we should endeavor to use the proper return types. This patch lowercases typing to indicate primitive / boxed type as appropriate.[2] As a special case, function types are uppercased for compatibility with TypeScript type checking. Lastly, JQuery types are of type "JQuery". The global JQuery object's identifier is "jQuery". This patch uppercases J's where appropriate. [0] jsdoc/jsdoc#1046 (comment) [1] find src tests -iname \*.js| xargs -rd\\n sed -ri ' s%\{\s*([?!])?(number|string|boolean|null|undefined)%{\1\L\2%gi; s%\{\s*([?!])?(function|object)%{\1\u\2%gi; s%\{\s*([?!])?jquery%{\1JQuery%gi ' Change-Id: I771bdbb69dc978796a331998c0657622ac39c449
Does the number of issues pointing to this one suggest that GitHub might have become a better place for similar questions than the jsdoc-users mailing list? |
So does JSDocs... And typeof in javascript... typeof true // "boolean"
typeof '' // "string"
typeof 4 // "number"
typeof undefined // "undefined"
typeof Symbol() // "symbol"
typeof function() {} // "function" |
- Some param types were starting with a lowercase letter (e.g. `string`), while others were starting with an uppercase letter (e.g. `String`). Switched all of them to lowercase for primitive types. Refer to jsdoc/jsdoc#1046 and https://jsdoc.app/tags-type.html (to see what JSDoc uses) for more information - Fixed a few typos and minor grammar mistakes - Fixed a few JSDoc params that were not matching the actual param name - Some returns were using the `@return` tag, while others were using the `@returns` tag. Switched all of them to `@return` for consistency - Some `@param`s were ending with a period, while others were not. Switched all of them to end with a period for consistency - Made sure that all JSDoc comments include a `@return` tag (including `@return {void}` and `@return {Promise<void>}` - Documented object structures were possible (e.g. `@return {Promise<{code: number, stdout: string, stderr: string}>}`) - Expanded the documentation of functions like `exec()`, `run()`, etc., where their types could be confusing when you first come in the project
Maybe this is a silly question, but a search for "case sensitive" in the repo doesn't reveal anything as of now. Same search on Google.
At http://usejsdoc.org/tags-type.html I see "number", "boolean", "string" and "Array".
At http://usejsdoc.org/tags-returns.html I see Titlecase: "Number", "Boolean", "Array".
The text was updated successfully, but these errors were encountered: